[RELEASE] Tasmota Sync - Native and Real-time Synchronization between Hubitat and Tasmota 11 or later

Yes, they are quite versatile devices and it's always nice to have the WebUI as a backup. I wrote the initial driver for Tasmota on SmartThings and I used to have that UI feature in it so I do see the value. PM me what you have and I'll take a look although I won't get to it for a while.

Thanks.

I'm looking at flashing another esp8266 with tasmota but there's a few things holding me back.

The device will control a relay and read a VL53L0X distance sensor.

However I would prefer the relay to stay open for a certain period of time and turn off again. Preferably being able to change the time period..

I know I can use rule machine to do this, and probably accurate enough for my application. However I'd prefer the time to be determined by the esp8266 so it's more reliable and accurate.

I know I can use the tasmota console to define how a timer for the "relay". However that is a fixed value.

Can these drivers send console commands? Or change a value on the tasmota device, that then triggers a rule in tasmota that changes the timer?

If it's much work I'll probably just stick with the fixed count down timer.

Edit: Maybe create a dummy relay in tasmota, that I change from rule machine to trigger a tasmota rule that changes the period? I've never writtem a rule on tasmota so I'd need to read up about them.

You can send custom commands with driver. I’d recommend getting it to work locally on Tasmota and then look at how it could be triggered by sending a command from Hubitat.

1 Like

I can't believe how lazy I was... As soon as I set it up there it is in the device page. Works well.

Command = Pulsetime1
Parameter = 110

So I've installed another tasmota device. Esp8266 with 5 optocouplers to mimic button presses on a 2.4gHz remote that i hacked.

Problem is hubitat isn't updating the device state unless I press refresh. I have injected rule 3.

Could it be because I have set "pulsetime1 1" which turns the relay off quickly to simulate a button press? So rule3 doesn't run when the state goes back to off so quickly?

Do these appear as switches. Like this for example.


Sounds a bit like you are configuring momentary buttons.

To see if the rule is firing just look at the console. This is what I get when switch 4 is turned on.

POWER4 = ON
02:51:46.600 RUL: POWER4#STATE performs "backlog0 Var10 1 ; RuleTimer1 1"
02:51:46.620 RSL: RESULT = {"Var10":"1"}
02:51:46.656 RSL: RESULT = {"T1":1,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
02:51:48.534 RUL: RULES#TIMER=1 performs "var15 '0','0','0','1','0','0','',''"
02:51:48.539 RSL: RESULT = {"Var15":"'0','0','0','1','0','0','',''"}
02:51:48.595 RUL: VAR15#STATE$!%VAR16% performs "backlog ; var16 '0','0','0','1','0','0','','' ; webquery http://192.168.0.200:39501/ POST {'TSync':'True','SWITCH1':'0','SWITCH2':'0','SWITCH3':'0','SWITCH4':'1','SWITCH5':'0','SWITCH6':'0','SWITCH7':'','SWITCH8':''}"
02:51:48.613 RSL: RESULT = {"Var16":"'0','0','0','1','0','0','',''"}
02:51:48.907 RSL: RESULT = {"WebQuery":"Done"}

If you look at the Hubitat Log you should see a matching entry:

[dev:4233](http://192.168.0.200/logs#)2024-08-25 08:52:05.547 PM[info](http://192.168.0.200/logs#)Sprinklers - 8 Port Tasmota - 0️⃣💨 **syncTasmota**: **Sync completed. Exiting**

[dev:4233](http://192.168.0.200/logs#)2024-08-25 08:52:05.545 PM[info](http://192.168.0.200/logs#)Sprinklers - 8 Port Tasmota - *️⃣1️⃣..updateStatus: Complete:Tasmota Sync

[dev:4233](http://192.168.0.200/logs#)2024-08-25 08:52:05.530 PM[info](http://192.168.0.200/logs#)Sprinklers - 8 Port Tasmota - *️⃣1️⃣🔄 ..syncTasmota: Tasmota Sync request processing.

[dev:4233](http://192.168.0.200/logs#)2024-08-25 08:52:05.528 PM[info](http://192.168.0.200/logs#)Sprinklers - 8 Port Tasmota - 0️⃣🔄 **syncTasmota**: **Data received: {"TSYNC":"TRUE","SWITCH1":"0","SWITCH2":"0","SWITCH3":"0","SWITCH4":"0","SWITCH5":"0","SWITCH6":"0","SWITCH7":"","SWITCH8":""}**

[dev:4233](http://192.168.0.200/logs#)2024-08-25 08:52:05.526 PM[info](http://192.168.0.200/logs#)Sprinklers - 8 Port Tasmota - *️⃣1️⃣💨 ..parse: Exit to syncTasmota()

[dev:4233](http://192.168.0.200/logs#)2024-08-25 08:52:05.523 PM[info](http://192.168.0.200/logs#)Sprinklers - 8 Port Tasmota - *️⃣1️⃣🏁 ..parse: Entering, data received.

Yes

Yes

11:56:47.251 RSL: RESULT = {"POWER1":"ON"}
11:56:47.253 RSL: POWER1 = ON
11:56:47.286 RUL: POWER1#STATE performs 'backlog0 Var7 1 ; RuleTimer1 1'
11:56:47.313 RSL: RESULT = {"Var7":"1"}
11:56:47.352 RSL: RESULT = {"T1":0,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
11:56:47.449 RSL: RESULT = {"POWER1":"OFF"}
11:56:47.452 RSL: POWER1 = OFF
11:56:47.514 RUL: POWER1#STATE performs 'backlog0 Var7 0 ; RuleTimer1 1'
11:56:47.536 RSL: RESULT = {"Var7":"0"}
11:56:47.575 RSL: RESULT = {"T1":1,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}
11:56:49.268 RUL: RULES#TIMER=1 performs 'var15 '0','','0','','0','','','''
11:56:49.274 RSL: RESULT = {"Var15":"'0','','0','','0','','',''"}
11:56:49.301 RSL: RESULT = {"Time":"2024-08-26T11:56:49","Uptime":"1T06:42:43","UptimeSec":110563,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":23,"MqttCount":0,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","POWER4":"OFF","POWER5":"OFF","Wifi":{"AP":1,"SSId":"Homebrand","BSSId":"0E:36:C9:1E:05:BD","Channel":13,"Mode":"11n","RSSI":100,"Signal":-44,"LinkCount":1,"Downtime":"0T00:00:07"}}
11:56:51.330 RSL: RESULT = {"Time":"2024-08-26T11:56:51","Uptime":"1T06:42:45","UptimeSec":110565,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":0,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","POWER4":"OFF","POWER5":"OFF","Wifi":{"AP":1,"SSId":"Homebrand","BSSId":"0E:36:C9:1E:05:BD","Channel":13,"Mode":"11n","RSSI":100,"Signal":-46,"LinkCount":1,"Downtime":"0T00:00:07"}

I don't see that in the device log no. There is no sync tasmota lines.

When I inject the rule I get the following in console.

12:42:45.109 RUL: Compressed from 884 to 365 (-59%)
12:42:45.112 RUL: Rule3 ON Power1#state DO backlog0 Var7 %value% ; RuleTimer1 1 ENDON ON Power2#state DO backlog0 Var8 %value% ; RuleTimer1 1 ENDON ON Power3#state DO backlog0 Var9 %value% ; RuleTimer1 1 ENDON ON Power4#state DO backlog0 Var10 %value% ; RuleTimer1 1 ENDON ON Power5#state DO backlog0 Var11 %value% ; RuleTimer1 1 ENDON ON Power6#state DO backlog0 Var12 %value% ; RuleTimer1 1 ENDON ON Power7#state DO backlog0 Var13 %value% ; RuleTimer1 1 ENDON ON Power8#state DO backlog0 Var14 %value% ; RuleTimer1 1 ENDON ON
12:42:45.116 RUL: Rule3 +Rules#Timer=1 DO var15 '%var7%','%var8%','%var9%','%var10%','%var11%','%var12%','%var13%','%var14%' ENDON ON var15#State$!%var16% DO backlog ; var16 %var15% ; webquery http://192.168.1.25:39501/ POST {'TSync':'True','SWITCH1':'%var7%','SWITCH2':'%var8%','SWITCH3':'%var9%','SWITCH4':'%var10%','SWITCH5':'%var11%','SWITCH6':'%var12%','SWITCH7':'%var13%','SWITCH8':'%var14%'} ENDON 
12:42:45.121 RSL: RESULT = {"Rule3":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":884,"Free":144,"Rules":"ON Power1#state DO backlog0 Var7 %value% ; RuleTimer1 1 ENDON ON Power2#state DO backlog0 Var8 %value% ; RuleTimer1 1 ENDON ON Power3#state DO backlog0 Var9 %value% ; RuleTimer1 1 ENDON ON Power4#state DO backlog0 Var10 %value% ; RuleTimer1 1 ENDON ON Power5#state DO backlog0 Var11 %value% ; RuleTimer1 1 ENDON ON Power6#state DO backlog0 Var12 %value% ; RuleTimer1 1 ENDON ON Power7#state DO backlog0 Var13 %value% ; RuleTimer1 1 ENDON ON Power8#state DO backlog0 Var14 %value% ; RuleTimer1 1 ENDON ON Rules#Timer=1 DO var15 '%var7%','%var8%','%var9%','%var10%','%var11%','%var12%','%var13%','%var14%' ENDON ON var15#State$!%var16% DO backlog ; var16 %var15% ; webquery http://192.168.1.25:39501/ POST {'TSync':'True','SWITCH1':'%var7%','SWITCH2':'%var8%','SWITCH3':'%var9%','SWITCH4':'%var10%','SWITCH5':'%var11%','SWITCH6':'%var12%','SWITCH7':'%var13%','SWITCH8':'%var14%'} ENDON "}}
12:42:50.087 RSL: RESULT = {"Var7":""}
12:42:50.329 RSL: RESULT = {"Var8":""}
12:42:50.555 RSL: RESULT = {"Var9":""}
12:42:50.804 RSL: RESULT = {"Var10":""}
12:42:51.053 RSL: RESULT = {"Var11":""}
12:42:51.303 RSL: RESULT = {"Var12":""}
12:42:51.504 RSL: RESULT = {"Var13":""}
12:42:51.755 RSL: RESULT = {"Var14":""}
12:42:52.005 RUL: Rule3 ON Power1#state DO backlog0 Var7 %value% ; RuleTimer1 1 ENDON ON Power2#state DO backlog0 Var8 %value% ; RuleTimer1 1 ENDON ON Power3#state DO backlog0 Var9 %value% ; RuleTimer1 1 ENDON ON Power4#state DO backlog0 Var10 %value% ; RuleTimer1 1 ENDON ON Power5#state DO backlog0 Var11 %value% ; RuleTimer1 1 ENDON ON Power6#state DO backlog0 Var12 %value% ; RuleTimer1 1 ENDON ON Power7#state DO backlog0 Var13 %value% ; RuleTimer1 1 ENDON ON Power8#state DO backlog0 Var14 %value% ; RuleTimer1 1 ENDON ON
12:42:52.007 RUL: Rule3 +Rules#Timer=1 DO var15 '%var7%','%var8%','%var9%','%var10%','%var11%','%var12%','%var13%','%var14%' ENDON ON var15#State$!%var16% DO backlog ; var16 %var15% ; webquery http://192.168.1.25:39501/ POST {'TSync':'True','SWITCH1':'%var7%','SWITCH2':'%var8%','SWITCH3':'%var9%','SWITCH4':'%var10%','SWITCH5':'%var11%','SWITCH6':'%var12%','SWITCH7':'%var13%','SWITCH8':'%var14%'} ENDON 
12:42:52.011 RSL: RESULT = {"Rule3":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":884,"Free":144,"Rules":"ON Power1#state DO backlog0 Var7 %value% ; RuleTimer1 1 ENDON ON Power2#state DO backlog0 Var8 %value% ; RuleTimer1 1 ENDON ON Power3#state DO backlog0 Var9 %value% ; RuleTimer1 1 ENDON ON Power4#state DO backlog0 Var10 %value% ; RuleTimer1 1 ENDON ON Power5#state DO backlog0 Var11 %value% ; RuleTimer1 1 ENDON ON Power6#state DO backlog0 Var12 %value% ; RuleTimer1 1 ENDON ON Power7#state DO backlog0 Var13 %value% ; RuleTimer1 1 ENDON ON Power8#state DO backlog0 Var14 %value% ; RuleTimer1 1 ENDON ON Rules#Timer=1 DO var15 '%var7%','%var8%','%var9%','%var10%','%var11%','%var12%','%var13%','%var14%' ENDON ON var15#State$!%var16% DO backlog ; var16 %var15% ; webquery http://192.168.1.25:39501/ POST {'TSync':'True','SWITCH1':'%var7%','SWITCH2':'%var8%','SWITCH3':'%var9%','SWITCH4':'%var10%','SWITCH5':'%var11%','SWITCH6':'%var12%','SWITCH7':'%var13%','SWITCH8':'%var14%'} ENDON "}}

Am I correct in assuming that when you click on one of the buttons via the interface it goes on and then almost immediately goes off? That is what the log is suggesting.

What is happening is that the state of the switch is going from 0 to 1 and then almost immediately back to 0. When the rule executes (1 second later) it does a comparison and see that all the switches are in the same state as they were before and then sends nothing.

So you would have to set the delay for the momentary to longer than it takes for the rule to process, which i'd say is typically around 2 seconds.

3 Likes

Ok that makes sense. I need the button to be brief so it replicates a button press I think if I make it two seconds long the remote won't function as it should. I'm getting around this at the moment by doing a rule that changes on the state of the button and then does a refresh one second later which then sets the button status back to the off position. this seems to work OK.

I'm using 4 relays at the moment on tasmota.

I'm looking at adding a switch to it.

As I have set tasmota sync up for this device as a 8x relay device. Only using the first 4x.

Now to add the switch, do I need to change from the 8 relay device? Or can I read the switch state still, seeing it's shown in tasmota Weboage in colsole. Or potentially the universal multi sensor device? Although I believe that will only provide inputs/sensor values then, so no relays? Will it break existing child devices used in rules?

I can always try.. But I don't want to break my rules in the process.

The switch\relay naming is rather fluid. Hubitat only cares about switches so whether it is a relay or a switch on Tasmota, it can only resolve to a switch on Hubitat.

Yes I see my relays appear as switches in hubitat. I can change the state in hubitat l.

But I'm confused in how can I show my switch states (they are sensors) in hubitat? Do I need to link say switch6 and relay6 in tasmota, then monitor for the state of relay6 (which isn't really operating a relay, just setup as a dummy)?

I would say the easiest way would be to create a rule in tasmota that flips the switch in Tasmota (which is just being used as a flag) based on the sensor value and then use the regular 8 relay driver to transfer the state back to Hubitat.