RSSI system variable

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Galeforce9
New user
Posts: 6
Joined: 31 Mar 2018, 17:53

RSSI system variable

#1 Post by Galeforce9 » 31 Mar 2018, 18:04

Hello All,

Recently just found ESPeasy and have it working sending data to my HA PC. I wanted to also send the RSSI from the ESPeasy to the HA PC. I managed to do this every minute with the rules section however this has highlighted an issue. My HA system does not respond with negative values and of course all the RSSI values are negative! Is there anyway I can perform any math on the variable or make it positive in value before I send it. I am very new to ESPeasy ie yesterday but I have searched the docs etc but I cant seem to find a way of doing this.

Thanks in advance,

regards

Ian

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: RSSI system variable

#2 Post by grovkillen » 31 Mar 2018, 19:19

Code: Select all

Publish,TOPIC,[%RSSI%/-1]
Haven't tried it myself but worth a shot.

BUT:
You can also do it with the plugin "Genetic - System Info". Use the formula %value%/-1 and set the delay to 60 seconds.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Galeforce9
New user
Posts: 6
Joined: 31 Mar 2018, 17:53

Re: RSSI system variable

#3 Post by Galeforce9 » 31 Mar 2018, 21:28

Hello,

Many thanks for the suggestion. I should have mentioned I am using http as the sending method. this is the rule below:

On Rules#Timer=1 do //When Timer1 expires, do
SendToHTTP 192.168.2.203,80,/JSON?request=controldevicebyvalue&ref=92&value=%rssi%/-1
timerSet,1,60
endon

As you see I did try to add the divide by -1 on the end of SendToHTTP but this simply sent out the following:

Request URI Query: request=controldevicebyvalue&ref=92&value=-82/-1

as grabbed by Wireshark running on the HA PC. You also mentioned "Genetic - System Info" as a plugin. I have not got as far as plugins so I'll do some more research and see what I can find..

Thank you

Ian

AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Re: RSSI system variable

#4 Post by AndrewJ » 31 Mar 2018, 21:59

A suggestion (but it's only that, as I've never played with negative numbers in ESPeasy!) - you might need to use a dummy task, and do the division (or multiplication) by -1 in a rule, putting the result into the dummy. Then a rule to send the (now positive) value out.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: RSSI system variable

#5 Post by TD-er » 31 Mar 2018, 23:09

AndrewJ wrote: 31 Mar 2018, 21:59 A suggestion (but it's only that, as I've never played with negative numbers in ESPeasy!) - you might need to use a dummy task, and do the division (or multiplication) by -1 in a rule, putting the result into the dummy. Then a rule to send the (now positive) value out.
Any plugin has some very basic formula option to do something with the recorded value.
Just to give an idea on the interpretation of the RSSI values.
For the Domoticz controllers, the RSSI value is converted to a range of 0...10.
RSSI values > -50 -> 10
RSSI values < -98 -> 0
For the rest: ((rssi + 97) /5 ) +1

Oxyandy
Normal user
Posts: 95
Joined: 09 Mar 2018, 08:45

Re: RSSI system variable

#6 Post by Oxyandy » 01 Apr 2018, 00:04

Excellent tip, thanks TD-er

Galeforce9
New user
Posts: 6
Joined: 31 Mar 2018, 17:53

Re: RSSI system variable

#7 Post by Galeforce9 » 01 Apr 2018, 14:45

Thanks all for the help,

As I mentioned very new to ESPeasy so please bear with me in case I am missing something straight forward.

So the rule is as follows:
On Rules#Timer=1 do //When Timer1 expires, do
SendToHTTP 192.168.2.203,80,/JSON?request=controldevicebyvalue&ref=92&value=%rssi%
timerSet,1,60
endon

I am fairly certain I can not add anything on the SendToHTTP line as this simply gets sent out as the HTTP message as is and doesn't actually perform any math etc.
So normally I would use a variable do the math then send out the new variable. No variables in ESPEasy but dummy devices as a fix. Looking at dummydevices I have found this post

viewtopic.php?t=1808

I understand how to set the value I think as follows:

TaskValueSet 10,1,%rssi% / -1

So this would use dummy device 10 var 1 to hold the new rssi value. However on the ESPeasy webpage I dont have the option to select a "Dummy" as a device which I have seen in a screen shot elsewhere and also I'm not sure how to send out the new dummy value. I am sure I am missing something but cant find the answer. I need to change this line to include the new value which would normally be something like this
SendToHTTP 192.168.2.203,80,/JSON?request=controldevicebyvalue&ref=92&value=%TaskValueSet10,1%

Which I know is incorrect but I cant see were any other reference is made to the name of 10,1 to use it to assign, unless it is to do with the dummy device which I dont have and could explain why i am struggling to do this.

once again thanks for the help.

regards

Ian

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: RSSI system variable

#8 Post by grovkillen » 01 Apr 2018, 14:56

Math need to be closed with brackets:

Code: Select all

[%rss%/-1]
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Galeforce9
New user
Posts: 6
Joined: 31 Mar 2018, 17:53

Re: RSSI system variable

#9 Post by Galeforce9 » 01 Apr 2018, 22:49

Hi

This is proving to be more difficult than I had expected. I changed the rule but didnt get any value so as a test I just added the brackets like this

On Rules#Timer=1 do //When Timer1 expires, do
SendToHTTP 192.168.2.203,80,/JSON?request=controldevicebyvalue&ref=92&value=[%rssi%]
timerSet,1,60
endon

Now I dont get any value sent at all the http request is terminated after the "value=" and nothing more.

I have searched for any example of math being done on a SendToHTTP command but so far have not found anything.

Thank you

Ian

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: RSSI system variable

#10 Post by grovkillen » 01 Apr 2018, 22:52

You could dump the result to a dummy device before publishing it.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Galeforce9
New user
Posts: 6
Joined: 31 Mar 2018, 17:53

Re: RSSI system variable

#11 Post by Galeforce9 » 02 Apr 2018, 00:33

Many thanks to everyone, I now have this working.

The rule is as follows:
On Rules#Timer=1 do //When Timer1 expires, do
TaskValueSet 10,1,%rssi%/-1
SendToHTTP 192.168.2.203,80,/JSON?request=controldevicebyvalue&ref=92&value=[Dummy#Dummy_1]
timerSet,1,60
endon

With the TaskValueSet command dont use brackets for math. As regards the dummy device I could not find this but I should have looked harder. The devices are listed in alphabetical order and I couldnt see "dummy" but then found it listed as generic - dummy. Everything then made sense and it is all working fine. I have created some wifi icons and mapped them to the signal strength so hopefully this part is now sorted.

Thanks again

regards

Ian

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests