getting temperature value from ESP8266 to vera controller

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
asuz
Normal user
Posts: 175
Joined: 31 Oct 2018, 18:22

getting temperature value from ESP8266 to vera controller

#1 Post by asuz » 20 Nov 2018, 20:17

Is there anybody able to get temperature values from ESP8266 to vera controller. Thanks Dan (https://dan.bemowski.info/2017/07/04/us ... -and-vera/) to make it work with 8266 relay's with vera controller but I need to get temperature values from vera controller.

dbemowsk
Normal user
Posts: 46
Joined: 06 Aug 2017, 22:27

Re: getting temperature value from ESP8266 to vera controller

#2 Post by dbemowsk » 22 Nov 2018, 16:55

I had emailed this workaround solution to this user. Just posting it here for others to take advantage of.

I may have a workaround for you that should get you what you need. It relies on a feature of the ESP Easy firmware called "Rules" which is basically a small scripting engine for the firmware. This is not on by default in the firmware, so you must specifically turn it on for whatever device you want values from. To do this, type in the IP address of your Sonoff in the address bar of your web browser and then go to the Tools tab. In the System section click Advanced. Scroll down and check the Rules checkbox and then click Submit at the bottom. With that done, you should now see a Rules tab between Devices and Tools.

Now we'll set up what we need on the Vera side. For this we are going to use a virtual sensor. Go to Apps > Install apps in the left menu of UI7. Look for "Additional temperature device" which should just have the generic Plugin icon, and install that. Once installed it should create a device for the plugin. If you look in your devices you should see an additional temperature device. Click the > button next to the device and click on Advanced. In the top of the advanced section you will want to note the Device #xxx where xxx is the device number.

Now we will go back to the Sonoff. I am assuming that you set up your DS18b20 under the Devices tab. If you did not, you will need to set it up under one of the task numbers, most likely 2 and give it a name like DS18b20. So assuming that you have it set up with that name, the next thing you want to do is go to your Rules tab and paste this in the Rules box making the noted changes:
--------------------------------------------------------------
on System#Boot do
timerSet,1,10
endon

On Rules#Timer=1 do
SendToHTTP <your vera IP>,3480,/data_request?id=variableset&DeviceNum=<your vera device number>&serviceId=urn:upnp-micasaverde-com:serviceId:iDoorContact:1&Variable=CurrentTemperature&Value=[DS18b20#Temperature]
timerSet,1,60
endon
--------------------------------------------------------------
If you named your temp sensor something other than DS18b20, chang it in the rules script above to [<your sensor name>#Temperature]. Once you have all that done, click on the Tools tab and click reboot. Give the Sonoff a minute to reboot and send a value to your Vera device. You should now be able to open your additional temperature device and click on Advanced and go to the Variables tab. You should now see CurrentTemperature set to the temp of your sensor. That value should be updated from your Sonoff device once every 60 seconds. You should be able to change the line "timerSet,1,60" to how ever many seconds you want the updated temp. You should now be able to use that value for what you want. One thing to note though, the temp will not show next to the device in your devices list. With this information you may be able to find a way to do that with another virtual sensor or something.

Cheers

Dan

ssin21
New user
Posts: 1
Joined: 27 May 2020, 00:13

Re: getting temperature value from ESP8266 to vera controller

#3 Post by ssin21 » 27 May 2020, 00:31

Hi,
I know its been a long time since anybody replied to this post.

First of all I owe you a huge thank you for without the information you posted here I would never have been able to achieve what I wanted : taking advantage of Sonoff TH16 with temperature sensor hooked on GPIO14.
So following your post everything works fine up until you re-reach your Vera dashboard and you have to click on the device's advanced tab to check your temperature.

To enable temperature showing on the dashboard I did the following :
- click on the ">" of the device from the dashboard.
- click on advanced
- click on New Service and add the following :
New service : urn:upnp-org:serviceId:TemperatureSensor1
New Variable : CurrentTemperature
Value : whatever you want, it will get updated.

- back on espeasy interface change the rule you previously created :
change "serviceId=urn:upnp-micasaverde-com:serviceId:iDoorContact:1" to "urn:upnp-org:serviceId:TemperatureSensor1"

- wait 60 secs or reboot your esp device.

- now get back to your vera dashboard and you should see your temperature being shown in the dashboard.

The icing on the cake is that now you can have your google assitant read the temperature for you :
- on your vera go to "Apps > Install apps" and install "Auto Virtual Thermostat"
- once AVT is installed click details and add a device (don't remember if it will automatically add on by default)
- once the device is added you can click on it and assign it a new name and a room
- click on settings and you can now add your newly created temperature sensor, it doesn't matter if you don't add cooling or heating or any other device. Click "back" on the top green bar.
- go back to the dashboard and you should see the newly created AVT device showing the temperature that it is reading from your virtual sensor which gets its value from the ESP device.

- now open your Google Home App (on tablet or smartphone) and you should see your AVT showing the temperature (if you linked the vera service to your google assistant). It will work with any google assistant (Google Home devices and app)

I don't claim it to be the fastest / cleanest / most subtle way to do it. I'm just reporting what works for me and hopefully save some time for people looking having trouble doing just what I did because information regarding sensor value reporting from ESP devices to Vera is seriously lacking on the net.

d.pancer
Normal user
Posts: 27
Joined: 30 Jan 2021, 21:42

Re: getting temperature value from ESP8266 to vera controller

#4 Post by d.pancer » 30 Jan 2021, 21:54

Hi,

i'm hoping to get some help with this. The temp value is not showing up on the dashboard. It does show up in the advanced section as a second "CurrentTemperature" Value. I noticed that from the sonoff rules section if i would change "CurrentTemperature" to "CurrentTemperature3", it would add this new variable to list as well.

I also noticed that the Virtual Sensors plugin already comes with the "CurrentTemperature" variable pre written opnce you create a new virtual sensor. Manually adding it in also does not solve this problem. So it looks like the temp value is being sent as a new variable and does not write into the original "CurrentTemperature" variable slot that is used for the dashboard. Any ideas?

This is what i have set in my rules section:

on System#Boot do
timerSet,1,10
endon

On Rules#Timer=1 do
SendToHTTP 192.168.0.8,3480,/data_request?id=variableset&DeviceNum=3673&serviceId=urn:upnp-org:serviceId:TemperatureSensor1:1&Variable=CurrentTemperature&Value=[Stemphum#Temperature]
timerSet,1,5
endon


I am using the S7021 sensor with temp/humidity. I have tried the same thing for humidity (using serviceId:HumiditySensor1) and the same issue is happening.
Attachments
Capture.JPG
Capture.JPG (34.97 KiB) Viewed 3493 times

d.pancer
Normal user
Posts: 27
Joined: 30 Jan 2021, 21:42

Re: getting temperature value from ESP8266 to vera controller

#5 Post by d.pancer » 01 Feb 2021, 20:55

oay, problems solved!

I had and :1 in the code from the example with the door contact sensor

urn:upnp-org:serviceId:TemperatureSensor1:1&Variable=CurrentTemperature&Value

The correct version is:

urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value

User avatar
Ath
Normal user
Posts: 3480
Joined: 10 Jun 2018, 12:06
Location: NL

Re: getting temperature value from ESP8266 to vera controller

#6 Post by Ath » 01 Feb 2021, 22:26

Great you found the issue. And thanks for reporting it back. :)
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests