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

I should have been more clear. In both cases, your driver was sending the FANSPEED command to Tasmota. However, when I adjusted the fan speed in HomeKit, here's what I believe was happening:

  • Homekit sends a new fan speed command to HomeBridge
  • HomeBridge then sent two commands to MakerAPI:
    • The first command caused a call to the cycleSpeed() function in your driver
    • The second command caused a call to the setSpeed() function in your driver

I believe it is an error in the HomeBridge plugin. It should only have sent the second command. To make things work well, I added a return at the start of your cycleSpeed() function, since I don't use that functionality. (And because it's much easier to fix in your driver, than trying to alter the HomeBridge plugin.)

@garyjmilne BTW, I installed the iFan04 up in the fan canopy yesterday. I really love how it works. So responsive.

1 Like

@garyjmilne, I’m noticing a lot of info logging - is there a way this could be disabled from the device driver?

This is happening with this driver: Single Relay\Switch\Plug with optional power monitoring, version 1.2.4:

https://raw.githubusercontent.com/GaryMilne/Hubitat-Tasmota/main/Single_Relay_Switch_Plug.groovy

I have to say, it’s quite impressive how well the driver works! Thanks!

Im away and don’t have access at the moment but if I recall you can set the log level to -1 to disable all logs.
FYI this log must be from a hub link device as it does not translate the HTML tags. You can turn off the HTML log enhancements in the settings.

1 Like

Thanks! The value seems to save. Could it be added to the list of options at some point?

1 Like

I could not really recommend turning off all the logging. I felt that leaving the -1 setting without publishing it was a reasonable middle ground.

1 Like

Works for me. I have a lot of devices, so try to disable as much logging as possible, enabling it when needed. :slight_smile:

1 Like

@garyjmilne I just sent another PR. I saw in your notes that you didn't like how a previous implementation of Tasmota on Hubitat used child devices. I think I've found a case where it would be appropriate though:

Your current fan driver used the 'switch' attribute of the device to control the fan's light. However, this causes anomalous behavior with other "UIs" (such as HomeKit or Alexa), because they are expecting that the 'switch' attribute controls power to the fan itself.

The actual Sonoff iFan04 devices behave as if they were two independent smart devices: a fan controller and a smart switch.

So I made the light switch part be a child device. The parent device only controls the fan speed/power. This correctly exposes it as a separate fan and light to HomeKit and Alexa.

Let me know what you think. Thanks again for the great drivers!

1 Like

Hi @garyjmilne !
I installed Tasmota Sync for a few Tasmota devices and it works great !

i have a small issue on the response / logs / alert triggers: whenever Sync fires, it gets twice the answers from a S31 wifi smart plug with energy meter.

i was searching everywhere for a reason i was always getting 2 notifications when the power became 4Watts or lower

if i look in the events for tasmota sync, i see one "Sent:STATUS 8" and everything after that is received or logged twice, thus firing twice the notifications

i tried adding values on the "deduplication" line in the driver, but i only manage to block all results :confused:

did I configure something wrong ?

Thanks !

Let's review how it works.

Hubitat sends a "Power On" command for example.
Tasmota responds to this command almost immediately (6/1000ths of a sec) in this example.
image
This response goes back to Hubitat where the driver detects it and says Great, the power was successfully turned on so I will log it and update the interface.

About a second later the rule runs because a change has been detected (from Off to On)

and it figures out all the current values and send them in a line like this.

webquery http://192.168.0.200:39501/ POST {'TSync':'True','SWITCH1':'1','POWER':'569','VOLTAGE':'117','CURRENT':'4.85','APPARENTPOWER':'570','TODAY':'0.0','TOTAL':'769.2','YESTERDAY':'6.1','FACTOR':'1.00','REACTIVEPOWER':'0'}"

Now the logic in the driver goes like this.
If it gets a 'TSync' within X interval of initiating a change then assume the 'TSync' has been caused by the selected change and ignore it. X is the "Debounce Interval" which is settable in the driver.

I don't know what you are referring to when you mention "deduplication" line.

This is how it normally looks.


You will see the interval between the "TSYNC" events is 1 minute. This is controlled by the "TelePeriod" value in Tasmota. In this case the TelePeriod is 60.

So first, check the Hubitat log and see what the incoming "TSYNC" commands look like. See if the spacing matches your TelePeriod or not.

If you are still seeing double entries then I would suspect that you have more than one rule that is fired. Check the contents of your rules.

Lastly, if things still are not right send me a copy of the Tasmota console so I can see better as to what is happening.

1 Like

Just got back home from my trip. I should be able to take a proper look at this in the next week or so. Need to get my mojo back to start coding again.

2 Likes

Thanks a lot for taking the time and for your detailed reply! it is really appreciated!

the deduplication lines i am refering to are lines 99 and 100 in my driver version ( is there a version somewhere that i can see? )

//These are the types of fields that the driver will attempt to de-dupe. For example 3 temperature sensors would end up as temperature, temperature1, temperature2.
@Field static final deDupeList = ["TEMPERATURE","HUMIDITY"]

also, the image i linked shows the "events" for the TasmotaSync, and you can clearly see there that all values are doubled

here i did a "refresh" you can see that there is 2 "totalStartTime"
it seems like it fires 2 threads
2023-03-07 20-00-12

Refresh give these logs, which seem normal... I don't see duplicates here

and lastly, here is an example, these are events from the TasmotaSync showing it triggers 2 notifications separated by 1 millisecond:

You have the Universal Multi Sensor driver installed. You need the Single Relay\Switch\Plug with optional power monitoring.

1 Like

damn,
i am sorry to have wasted your time, but i did not know these subtilities
i'll try that right now
Thanks

it did work
i now have only 1 notification and nothing is duplicated in the events now.

Thanks a lot !!

1 Like

Hi ,
I am a new habitat user. I installed Tasmota Sync for a few Tasmota devices and it works great!

I have an issue with my power strip. The "Gym Power bar" device can only turn on the first plug on my Dashboard. I have tried the "switch" and "attribute" templates (screen shot). I thought I could create a Virtual switch and use a rule machine to control the other plugs on my power strip. But other plugs are not available to rule machine. At present I can only turn on or off from the devices menu in Hubitat (screenshot). The tasmota power bar plug names are also not captured (screen shot). The am using the below groovy for my power strip. Any help is appreciated. Thank you for your time.

https://raw.githubusercontent.com/GaryMilne/Hubitat-Tasmota/main/Single_Relay_Switch_Plug.groovy


Welcome to Hubitat. Are you using the 8 Relay version of the driver?

I think you are in luck. Someone submitted a modification to my driver that allows for the creation of child devices that you can address directly. So you would simply be able to place a switch on the dashboard for each of the 5 devices.

I’m testing it out this week and if all looks good I’ll make it available by the end of the week,

There are other options but this is by far the best, if it works OK.

P.S. How easy was it to put Tasmota on there?

I've been using the child device update of your driver and had to make some changes to get it to work. I have 5 way socket strips so started from the 8 way child device variant.

Rather than add another editor to the driver, I'll just list the edits I had to make here. My apologies if this a nuisance.

  1. On line 256 the end of the loop should be switchCount and not a hard codes value.
  2. On lines 703 to 706 a cut and paste problem has left every line using POWER4 rather than 4, 5, 6, 7, 8.
  3. On lines 786 to 801 the code has to call updateChild("1",off) edited for the child number and off or on state for each line appropriately, in addition to the existing update

        if ( switch1?.toInteger() == 0 ) {sendEvent(name: "switch", value: "off", descriptionText: "Switch was turned off.") ; updateChild("1","off")}

There is one other problem, if child1 is operated from the child device, the state is not updated.

Typing this on my phone, probably looks awful.

Thanks for all the work that has been put into this.

2 Likes