[Released] Tasmota Sync - Universal Sensor Driver

I have updated the driver to handle two temperature sensors. Works in my mock up. You can find the updated version [here] but should also be visible in HPM. (Hubitat-Tasmota/Universal_Multi_Sensor.groovy at main · GaryMilne/Hubitat-Tasmota · GitHub)

No Joy! I copied the driver and did a manual install (it was not showing up as an update in HPM). The code shows a version of

Version 0.99.1 - Added support to handle ANALOG CTENERGY JSON inputs

  • Version 0.99.2 - Added support to handle two TEMPERATURE sensors. Reporting as temperature and temperature1.

Created a new virtual device with type Tasmota Sync - Universal Multi Sensor.
Filled out the IP info, did a status 8 and a rule inject but am only getting a single temp showing.

Here is the log
dev:5912022-07-15 05:13:10.806 pm infoTemperature Monitors - :zero::dash: statusResponse: Exiting

dev:5912022-07-15 05:13:10.802 pm infoTemperature Monitors - :zero:statusResponse: STATUS 8 - SENSOR values processed.

dev:5912022-07-15 05:13:10.800 pm infoTemperature Monitors - :stop_sign: statusResponse: Error: Unable to match sensor data field 'ID' with a known Hubitat attribute. Is it missing from the attributes section and\or the sensor2AttributeMap?

dev:5912022-07-15 05:13:10.796 pm infoTemperature Monitors - :zero:statusResponse: Data is: ID Value: 011937B1E1FD

dev:5912022-07-15 05:13:10.792 pm infoTemperature Monitors - :zero:statusResponse: Data is: TEMPERATURE Value: 86.8

dev:5912022-07-15 05:13:10.772 pm infoTemperature Monitors - :stop_sign: statusResponse: Error: Unable to match sensor data field 'ID' with a known Hubitat attribute. Is it missing from the attributes section and\or the sensor2AttributeMap?

dev:5912022-07-15 05:13:10.769 pm infoTemperature Monitors - :zero:statusResponse: Data is: ID Value: 011937D1CBA3

dev:5912022-07-15 05:13:10.762 pm infoTemperature Monitors - :zero:statusResponse: Data is: TEMPERATURE Value: -9.7

dev:5912022-07-15 05:13:10.754 pm infoTemperature Monitors - :zero:statusResponse: Raw data is: {"STATUSSNS":{"TIME":"2022-07-15T17:13:09","DS18B20-1":{"ID":"011937B1E1FD","TEMPERATURE":86.8},"DS18B20-2":{"ID":"011937D1CBA3","TEMPERATURE":-9.7},"TEMPUNIT":"F"}}.

dev:5912022-07-15 05:13:10.592 pm debugType All

dev:5912022-07-15 05:13:10.526 pm infoTemperature Monitors - :zero::telephone_receiver: callTasmota: Sending command: STATUS 8

dev:5912022-07-15 05:13:10.521 pm infoTemperature Monitors - :zero::zap: Action: Refresh started....

dev:5912022-07-15 05:13:10.497 pm infoTemperature Monitors - :zero::zap: Action: Initialize/Update Device

Thanks for your help with this.

Please send the updates sent from Tasmota, should begin {'Tsync.....

16:40:18.852 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T16:40:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.6},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.5},"TempUnit":"F"}
16:40:18.866 RUL: TELE-DS18B20-2#TEMPERATURE performs "backlog0 var9 -9.5 ; RuleTimer1 1"
16:40:18.878 MQT: stat/TempSensors/RESULT = {"Var9":"-9.5"}
16:40:18.901 MQT: stat/TempSensors/RESULT = {"T1":1,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
16:40:20.862 RUL: RULES#TIMER=1 performs "var15 '-9.5'"
16:40:20.869 MQT: stat/TempSensors/RESULT = {"Var15":"'-9.5'"}
16:45:18.846 MQT: tele/TempSensors/STATE = {"Time":"2022-07-15T16:45:18","Uptime":"21T20:26:21","UptimeSec":1887981,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":46,"Signal":-77,"LinkCount":15,"Downtime":"0T00:00:44"}}
16:45:18.857 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T16:45:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.0},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.5},"TempUnit":"F"}
16:45:18.870 RUL: TELE-DS18B20-2#TEMPERATURE performs "backlog0 var9 -9.5 ; RuleTimer1 1"
16:45:18.881 MQT: stat/TempSensors/RESULT = {"Var9":"-9.5"}
16:45:18.903 MQT: stat/TempSensors/RESULT = {"T1":1,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
16:45:20.813 RUL: RULES#TIMER=1 performs "var15 '-9.5'"
16:45:20.820 MQT: stat/TempSensors/RESULT = {"Var15":"'-9.5'"}
16:50:18.811 MQT: tele/TempSensors/STATE = {"Time":"2022-07-15T16:50:18","Uptime":"21T20:31:21","UptimeSec":1888281,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":44,"Signal":-78,"LinkCount":15,"Downtime":"0T00:00:44"}}
16:50:18.823 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T16:50:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.2},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.5},"TempUnit":"F"}
16:50:18.837 RUL: TELE-DS18B20-2#TEMPERATURE performs "backlog0 var9 -9.5 ; RuleTimer1 1"
16:50:18.849 MQT: stat/TempSensors/RESULT = {"Var9":"-9.5"}
16:50:18.870 MQT: stat/TempSensors/RESULT = {"T1":1,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
16:50:20.834 RUL: RULES#TIMER=1 performs "var15 '-9.5'"
16:50:20.841 MQT: stat/TempSensors/RESULT = {"Var15":"'-9.5'"}
16:55:18.830 MQT: tele/TempSensors/STATE = {"Time":"2022-07-15T16:55:18","Uptime":"21T20:36:21","UptimeSec":1888581,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":46,"Signal":-77,"LinkCount":15,"Downtime":"0T00:00:44"}}
16:55:18.842 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T16:55:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.6},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.6},"TempUnit":"F"}
16:55:18.855 RUL: TELE-DS18B20-2#TEMPERATURE performs "backlog0 var9 -9.6 ; RuleTimer1 1"
16:55:18.868 MQT: stat/TempSensors/RESULT = {"Var9":"-9.6"}
16:55:18.891 MQT: stat/TempSensors/RESULT = {"T1":1,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
16:55:20.858 RUL: RULES#TIMER=1 performs "var15 '-9.6'"
16:55:20.865 MQT: stat/TempSensors/RESULT = {"Var15":"'-9.6'"}
16:55:20.914 RUL: VAR15#STATE$!%VAR16% performs "backlog ; var16 '-9.6' ; webquery http://192.168.86.207:39501/ POST {'TSync':'True','temperature':'-9.6'}"
16:55:20.948 MQT: stat/TempSensors/RESULT = {"Var16":"'-9.6'"}
16:55:21.339 MQT: stat/TempSensors/RESULT = {"WebQuery":"Done"}
16:59:22.820 MQT: stat/TempSensors/STATUS8 = {"StatusSNS":{"Time":"2022-07-15T16:59:22","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.2},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.6},"TempUnit":"F"}}
16:59:51.664 CMD: status 8
16:59:51.673 MQT: stat/TempSensors/STATUS8 = {"StatusSNS":{"Time":"2022-07-15T16:59:51","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.3},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.6},"TempUnit":"F"}}
17:00:18.853 MQT: tele/TempSensors/STATE = {"Time":"2022-07-15T17:00:18","Uptime":"21T20:41:21","UptimeSec":1888881,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":46,"Signal":-77,"LinkCount":15,"Downtime":"0T00:00:44"}}
17:00:18.865 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T17:00:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.3},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.6},"TempUnit":"F"}
17:00:18.882 RUL: TELE-DS18B20-2#TEMPERATURE performs "backlog0 var9 -9.6 ; RuleTimer1 1"
17:00:18.897 MQT: stat/TempSensors/RESULT = {"Var9":"-9.6"}
17:00:18.925 MQT: stat/TempSensors/RESULT = {"T1":1,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
17:00:20.812 RUL: RULES#TIMER=1 performs "var15 '-9.6'"
17:00:20.823 MQT: stat/TempSensors/RESULT = {"Var15":"'-9.6'"}
17:00:20.961 MQT: stat/TempSensors/STATUS8 = {"StatusSNS":{"Time":"2022-07-15T17:00:20","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.3},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.6},"TempUnit":"F"}}
17:00:32.887 RUL: Stored uncompressed, would compress from 450 to 254 (-44%)
17:00:32.892 MQT: stat/TempSensors/RESULT = {"Rule3":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":450,"Free":61,"Rules":"ON Tele-HX711#ABSRAW DO backlog0 var12 %value% ; RuleTimer1 1 ENDON ON Tele-HX711#WEIGHT DO backlog0 var13 %value% ; RuleTimer1 1 ENDON ON Tele-HX711#WEIGHTRAW DO backlog0 var14 %value% ; RuleTimer1 1 ENDON ON Rules#Timer=1 DO var15 '%var12%','%var13%','%var14%' ENDON ON var15#State$!%var16% DO backlog ; var16 %var15% ; webquery http://192.168.86.207:39501/ POST {'TSync':'True','ABSRAW':'%var12%','WEIGHT':'%var13%','WEIGHTRAW':'%var14%'} ENDON "}}
17:00:38.097 MQT: stat/TempSensors/RESULT = {"Rule3":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":450,"Free":61,"Rules":"ON Tele-HX711#ABSRAW DO backlog0 var12 %value% ; RuleTimer1 1 ENDON ON Tele-HX711#WEIGHT DO backlog0 var13 %value% ; RuleTimer1 1 ENDON ON Tele-HX711#WEIGHTRAW DO backlog0 var14 %value% ; RuleTimer1 1 ENDON ON Rules#Timer=1 DO var15 '%var12%','%var13%','%var14%' ENDON ON var15#State$!%var16% DO backlog ; var16 %var15% ; webquery http://192.168.86.207:39501/ POST {'TSync':'True','ABSRAW':'%var12%','WEIGHT':'%var13%','WEIGHTRAW':'%var14%'} ENDON "}}
17:00:43.519 MQT: stat/TempSensors/RESULT = {"Time":"2022-07-15T17:00:43","Uptime":"21T20:41:46","UptimeSec":1888906,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":46,"Signal":-77,"LinkCount":15,"Downtime":"0T00:00:44"}}
17:00:48.845 MQT: stat/TempSensors/STATUS8 = {"StatusSNS":{"Time":"2022-07-15T17:00:48","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.4},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.6},"TempUnit":"F"}}
17:05:18.805 MQT: tele/TempSensors/STATE = {"Time":"2022-07-15T17:05:18","Uptime":"21T20:46:21","UptimeSec":1889181,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":48,"Signal":-76,"LinkCount":15,"Downtime":"0T00:00:44"}}
17:05:18.819 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T17:05:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.9},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.6},"TempUnit":"F"}
17:10:18.827 MQT: tele/TempSensors/STATE = {"Time":"2022-07-15T17:10:18","Uptime":"21T20:51:21","UptimeSec":1889481,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":46,"Signal":-77,"LinkCount":15,"Downtime":"0T00:00:44"}}
17:10:18.841 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T17:10:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.6},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.7},"TempUnit":"F"}
17:11:16.968 MQT: stat/TempSensors/STATUS8 = {"StatusSNS":{"Time":"2022-07-15T17:11:16","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.6},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.7},"TempUnit":"F"}}
17:12:53.250 MQT: stat/TempSensors/STATUS8 = {"StatusSNS":{"Time":"2022-07-15T17:12:53","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.8},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.7},"TempUnit":"F"}}
17:13:09.989 MQT: stat/TempSensors/STATUS8 = {"StatusSNS":{"Time":"2022-07-15T17:13:09","DS18B20-1":{"Id":"011937B1E1FD","Temperature":86.8},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.7},"TempUnit":"F"}}
17:15:18.845 MQT: tele/TempSensors/STATE = {"Time":"2022-07-15T17:15:18","Uptime":"21T20:56:21","UptimeSec":1889781,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":42,"Signal":-79,"LinkCount":15,"Downtime":"0T00:00:44"}}
17:15:18.860 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T17:15:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":87.0},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.7},"TempUnit":"F"}
17:20:18.818 MQT: tele/TempSensors/STATE = {"Time":"2022-07-15T17:20:18","Uptime":"21T21:01:21","UptimeSec":1890081,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":24,"Wifi":{"AP":1,"SSId":"ValleyHome","BSSId":"70:3A:CB:5C:58:88","Channel":6,"Mode":"11n","RSSI":44,"Signal":-78,"LinkCount":15,"Downtime":"0T00:00:44"}}
17:20:18.830 MQT: tele/TempSensors/SENSOR = {"Time":"2022-07-15T17:20:18","DS18B20-1":{"Id":"011937B1E1FD","Temperature":87.5},"DS18B20-2":{"Id":"011937D1CBA3","Temperature":-9.7},"TempUnit":"F"}

I'm going to PM you and we'll take it off the main thread.

Tasmota Sync - Universal Multi Sensor Driver [Release]
This is the initial release of the Tasmota Sync - Universal Multi Sensor Driver.
It differs from the earlier versions in several ways.

  1. It detects the sensors and datatypes that you have installed.
  2. It can handle multiple sensors on the same Tasmota device.
  3. It can handle multiple instances of the same type of sensor on the Tasmota device.
  4. The "with Relays" version can handle up to two attached power relays in tandem with the sensors.

There are a couple of changes in behavior that should be compatible with existing rules you may have defined but I want to point them out as I think this will be how I address switches\relays in future.

In Tasmota switches are defined as Switch 1 - 8. In Hubitat the first switch is "switch" and it is at the programmers discretion what subsequent switches are named but most commonly the sequence goes switch, switch1, switch2 etc. or switch, switch2, switch3 etc.

What I have elected to do in this driver (and in future releases of other Tasmota Sync drivers) is to link switch and switch1 attributes and provide both an "on" and "switch1On" (and off) commands. Executing either of these commands will send a "POWER1 ON" and if successful turn on BOTH the switch and switch1 attributes. This allows the numbering of switches to be consistent between Tasmota and Hubitat. It also allows the use of the Hubitat "switch" attribute to be accessed via the switch capability, whereas switch1 - switch8 must be referenced via custom attributes.

These drivers can be found on HPM but they are added as new drivers and will not update any existing Tasmota Sync sensor drivers.

Handles this device no problem and its pretty loaded.

You can also find the drivers here. Variants are:
Universal Multi Sensor, Universal Multi Sensor Single Relay, Universal Multi Sensor Double Relay.

Documentation is here: https://github.com/GaryMilne/Hubitat-Tasmota/blob/main/Tasmota%20Sync%20Sensor%20Documentation.pdf

Please be sure you read the docs before posting questions.

2 Likes

Hi @garyjmilne - as mentioned in the other thread, the new universal sensor driver works great - thank you very much for your efforts on it.

I don't know how many guys are doing this type of thing - using Tasmota on a Wemos D1 or ESP32 to pick up multiple sensors and relays, but I have found it very useful around our property. So I thought I would just document how I got the temperature sensors to work in rules & dashboards - to save anyone else the reading and time I have taken.

My one ESP32 has 3 x DS18B20's picking up various temperatures on a water heater. The water heater is primarily solar heated with electrical backup if required - so I have a DS18B20 at the inlet & outlet of the water heater as well as at the solar panel on the roof. I set up a single rule that updates 3 x global variables every 5 minutes with the temperatures from the ESP32. The global variables are set with temperature 'connectors' - this creates a single parent device with the 3 temperatures which can be named as you please. From there it is very easy to have a multi-tile display, plus use the individual temperatures in rules as required.

Hope this assists others in the future.

Anyone interested in the Tasmota Sync drivers should also take a look at this companion app I wrote to distribute commands to multiple Tasmota devices at the same time. Makes a lot of things easier.

2 Likes

Just a further refinement for anyone interested. I added a fourth DS18B20 probe which works fine. But I noticed after some time that the ESP's onboard CPU temperature reading was somehow being reported in HE in place of one of the four DS18B20 probes. Running the 'Status 8' command in Tasmota and then pasting the info in 'Evaluate Sensor Data' in HE would sort it out for a day or so, but the problem would return.
So finally I researched it and it is possible to de-activate the ESP's onboard temperature. Per this page, you can use the ' SetSensor127 0' command to do this. The onboard temperature sensor only measures the CPU temperature - not the environment the MCU is in, so not much point. Since I made this change, no 'cross-reporting' of the probes in HE.

1 Like

Hi @garyjmilne - I noticed the drivers for the multi sensors are still the same version as a few months ago.

The ability to create child devices with the other driver updates is great - thank you very much! It also simplifies things in HE quite a bit for me. Just wondering if there were any plans to do the same 'child device' changes for the multi-sensor drivers?

I can't say there was a plan but now that someone has asked it is on my radar. I'm coming to the end of a big dev project so I can't say it's imminent, but I think sometime in May is highly likely.

Interesting find. You are the first person to comment on this thread in 7 months. Does not seem to be many HE people using Tasmota sensors.

FYI I did update the driver this AM to handle a bug in the reporting of sensor switches (switch3 and switch4) which were reporting status of 0 and 1 instead of off and on.

2 Likes

Hi @garyjmilne - sorry me again. Hope I am not the only guy using all your hard work on the sensor driver! :laughing: ...and asking you lots of questions...

I have just added a flow meter which uses a hall sensor and then reports pulses. I have used this sensor previously in Arduino code, from which you can determine flow rates and cumulative flows - in this case for a solar water heating setup.

Would it be a mission to add the counter functionality into the sensor driver? I have looked through the groovy file as I have some coding experience from a few years ago. But I haven't really got a clue where to start for this type of driver.

Hey @garyjmilne - sorry, just noticed the 'flow' sensory type. I guess this is where the sensor has some kind of processor to make the calculation. My unit is a 'dumb' one which just provides pulses which you then use for calculation - Water Flow Sensor YF-B6 - Seeed Studio.

How do you know when Tasmota has received a pulse? If Tasmota has a trigger for these pulses then you could increment a Tasmota counter. The driver could possibly be persuaded to retrieve the counter, but it's not going to know what to do with it other than make that counter visible in HE.

Sorry, didn't see your reply @garyjmilne
The pulses are produced constantly (by the hundred) when water flows - see snapshot of reading today below. I have a rule in Tasmota which resets the counter to 0 at midnight.

So all I am looking to do is get the integer from Tasmota into HE at a regular intervals. I will then manipulate it with some variable math to provide the flow rate in liters per second.

I have tried getting the number using an HTTP GET request, but no joy yet. I am using your driver already to get the temperatures shown above into HE.

I was not familiar with the Counter. But it looks like the solution is to add it as a sensor type and then it will detect any of the counters.

Judging by the number in your counter you would not want changes in the counter value to trigger a sync with the Hub because that would be a crazy amount of traffic. It would sync every time a temp change was noticed but if you want it exactly at midnight you would need to add that to your timer.

Give me a few days and I'll try it out. Is there a command I can use to increment the counter without having anything attached?

Agree on the counter changing not triggering a sync. Could the sync just happen at each Teleperiod?

Regarding a Tasmota command to increment the counter, it is Counter +1 (Word search for 'counter' on the Tasmota Command Page)

Ryan, try this code.

Been a while since I looked at this. The default behavior for sensors was to only transmit updates at TelePeriod so your should be O.K.

If it work's O.K. for you I will go ahead and publish it.

This is the sensor only version, no relays.

1 Like