[Released] Tasmota Sync - Universal Sensor Driver

I can't get a simple switch to work.
I am testing it on an esp8266 module with tasmota 13.3, generic module configured with switch3 (touch sensor for testing). From the console the state changes are read, but nothing is reported on HE.


I have followed all directions and tried several times, Current States reports only Complete:Success and State Variables sensorData is empty. Pasting the status 8 output in Evaluate Sensor Data doesn't change anything. I also tried switchmode3 15 on tasmota.

What am I doing wrong?

Looks to me like you have not done a tasmotaInjectRule which is what creates the sync packets to be sent from the device back to the hub.

I did it, that's a screenshot after a reboot.

here is the output

20:23:48.867 CMD: rule3
20:23:48.872 RSL: RESULT = {"Rule3":{"State":"OFF","Once":"OFF","StopOnError":"OFF","Length":0,"Free":511,"Rules":""}}

Your rule is off! Rule3 on to fix it.

Still nothing.

I've redone tasmotaInjectRule and than retried a clean device install (Clear Attributes > Browser refresh > Initialize > TasmotaInjectRule)

It shows the length of Rule 3 is 0. Turn up the logging to the highest level and repeat the inject rule.

1 error

java.lang.StringIndexOutOfBoundsException: String index out of range: -1 on line 1133 (method tasmotaInjectRule)
dev:3082023-12-16 15:59:48.530infoTasmota Sync - Universal Multi Sensor Driver reloaded with sensor type All
dev:3082023-12-16 15:59:48.528infoSwitchCount is: 0
dev:3082023-12-16 15:59:48.512errorjava.lang.StringIndexOutOfBoundsException: String index out of range: -1 on line 1133 (method tasmotaInjectRule)
dev:3082023-12-16 15:59:48.491infoTESTMOTA - *️⃣1️⃣..tasmotaInjectRule: varString is: null
dev:3082023-12-16 15:59:48.487infoTESTMOTA - *️⃣1️⃣..tasmotaInjectRule: TriggerCount is: 0
dev:3082023-12-16 15:59:48.485infoTESTMOTA - *️⃣1️⃣..tasmotaInjectRule: sensorData is: [] null
dev:3082023-12-16 15:59:48.481infoTESTMOTA - 0️⃣⚡ Action - tasmotaInjectRule: Injecting Rule3 into Tasmota Host. To verify go to Tasmota console and type: rule 3
dev:3082023-12-16 15:59:47.380infoTESTMOTA - *️⃣1️⃣🐶 🛑 ..watchdog: Finished.
dev:3082023-12-16 15:59:47.377debugTESTMOTA - *️⃣*️⃣2️⃣🐶 ....watchdog: All normal. Not in a transaction.
dev:3082023-12-16 15:59:44.935infoTasmota Sync - Universal Multi Sensor Driver reloaded with sensor type All
dev:3082023-12-16 15:59:44.933infoSwitchCount is: 0
dev:3082023-12-16 15:59:42.578infoTESTMOTA - 0️⃣💨 statusResponse: Exiting
dev:3082023-12-16 15:59:42.576infoTESTMOTA - *️⃣1️⃣..statusResponse: Closing Transaction
dev:3082023-12-16 15:59:42.572infoTESTMOTA - *️⃣1️⃣..updateStatus: Complete:Success
dev:3082023-12-16 15:59:42.570infoTESTMOTA - 0️⃣statusResponse: STATUS 8 - SENSOR values processed.
dev:3082023-12-16 15:59:42.567debugTESTMOTA - *️⃣*️⃣2️⃣....statusResponse: ****************** Data Processed ******************
dev:3082023-12-16 15:59:42.564debugTESTMOTA - *️⃣*️⃣2️⃣....statusResponse: De-duping attribute names. Attribute is: HUMIDITY Count is: 0
dev:3082023-12-16 15:59:42.560debugTESTMOTA - *️⃣*️⃣2️⃣....statusResponse: De-duping attribute names. Attribute is: TEMPERATURE Count is: 0
dev:3082023-12-16 15:59:42.557debugTESTMOTA - *️⃣*️⃣2️⃣....statusResponse: ****************** Items Processed ******************
dev:3082023-12-16 15:59:42.554infoTESTMOTA - *️⃣1️⃣..statusResponse: STATUSSNS Time is: 2023-12-16T15:59:39
dev:3082023-12-16 15:59:42.551debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......statusResponse: Item is: TIME
dev:3082023-12-16 15:59:42.547debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......statusResponse: Item is: SWITCH3
dev:3082023-12-16 15:59:42.544debugTESTMOTA - *️⃣*️⃣2️⃣....statusResponse: ****************** Extracted Items and Sensors ******************
dev:3082023-12-16 15:59:42.540debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......statusResponse: Add item: TIME
dev:3082023-12-16 15:59:42.537debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......statusResponse: Add item: SWITCH3
dev:3082023-12-16 15:59:42.533infoTESTMOTA - *️⃣1️⃣..statusResponse: STATUSSNS is: [SWITCH3:OFF, TIME:2023-12-16T15:59:39]
dev:3082023-12-16 15:59:42.529debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......adjustBody: Adjusted Body {"STATUSSNS":{"TIME":"2023-12-16T15:59:39","SWITCH3":"OFF"}}
dev:3082023-12-16 15:59:42.526debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......adjustBody: Received body is: {"STATUSSNS":{"TIME":"2023-12-16T15:59:39","SWITCH3":"OFF"}}
dev:3082023-12-16 15:59:42.523infoTESTMOTA - *️⃣1️⃣💨 ..parse: Exit to statusResponse()
dev:3082023-12-16 15:59:42.520debugTESTMOTA - *️⃣*️⃣2️⃣....parse: TSync is: false.
dev:3082023-12-16 15:59:42.517debugTESTMOTA - *️⃣*️⃣2️⃣....parse: StatusSync is: true.
dev:3082023-12-16 15:59:42.512debugTESTMOTA - *️⃣*️⃣2️⃣....parse: body is {"StatusSNS":{"Time":"2023-12-16T15:59:39","Switch3":"OFF"}}
dev:3082023-12-16 15:59:42.503debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......parse: data is mac:083A8DD22420, ip:c0a80063, port:50, headers:SFRUUC8xLjEgMjAwIE9LDQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL2pzb24NClNlcnZlcjogVGFzbW90YS8xMy4zLjAgKEVTUDgyNjZFWCkNCkNhY2hlLUNvbnRyb2w6IG5vLWNhY2hlLCBuby1zdG9yZSwgbXVzdC1yZXZhbGlkYXRlDQpQcmFnbWE6IG5vLWNhY2hlDQpFeHBpcmVzOiAtMQ0KQWNjZXB0LVJhbmdlczogbm9uZQ0KVHJhbnNmZXItRW5jb2Rpbmc6IGNodW5rZWQNCkNvbm5lY3Rpb246IGNsb3NlDQo=, body:eyJTdGF0dXNTTlMiOnsiVGltZSI6IjIwMjMtMTItMTZUMTU6NTk6MzkiLCJTd2l0Y2gzIjoiT0ZGIn19
dev:3082023-12-16 15:59:42.499infoTESTMOTA - *️⃣1️⃣🏁 ..parse: Entering, data received.
dev:3082023-12-16 15:59:42.419infoTasmota Sync - Universal Multi Sensor Driver reloaded with sensor type All
dev:3082023-12-16 15:59:42.417infoSwitchCount is: 0
dev:3082023-12-16 15:59:42.397infoTESTMOTA - *️⃣1️⃣💨 ..callTasmota: Exiting
dev:3082023-12-16 15:59:42.393infoTESTMOTA - *️⃣1️⃣..updateStatus: Sent:STATUS 8
dev:3082023-12-16 15:59:42.389debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣📞 ......callTasmota: hubaction: GET /cm?user=null&password=null&cmnd=STATUS%208 HTTP/1.1
Accept: */*
User-Agent: Linux UPnP/1.0 Hubitat
HOST: 192.168.0.99:80

dev:3082023-12-16 15:59:42.385debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣📞 ......callTasmota: Path: /cm?user=null&password=null&cmnd=STATUS%208
dev:3082023-12-16 15:59:42.382debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......cleanURL: Returning fixed path: /cm?user=null&password=null&cmnd=STATUS%208
dev:3082023-12-16 15:59:42.378debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......cleanURL: Fixing path: /cm?user=null&password=null&cmnd=STATUS 8
dev:3082023-12-16 15:59:42.351debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣📞 ......callTasmota: Starting Watchdog
dev:3082023-12-16 15:59:42.348debugTESTMOTA - *️⃣*️⃣2️⃣📞 ....callTasmota: Opening Transaction
dev:3082023-12-16 15:59:42.345infoTESTMOTA - 0️⃣📞 callTasmota: Sending command: STATUS 8
dev:3082023-12-16 15:59:42.342infoTESTMOTA - *️⃣1️⃣..refresh: Getting sensor data.
dev:3082023-12-16 15:59:42.340infoTESTMOTA - 0️⃣⚡ Action: Refresh started....
dev:3082023-12-16 15:59:42.327infoTESTMOTA - *️⃣1️⃣..Initialize: pollFrequency value: 0
dev:3082023-12-16 15:59:42.323debugTESTMOTA - *️⃣*️⃣2️⃣⚡ ....Action: DNI: C0A80063 is correct. Not updated.
dev:3082023-12-16 15:59:42.317debugTESTMOTA - *️⃣*️⃣*️⃣3️⃣......updateDeviceNetworkID: Settings are:192.168.0.99
dev:3082023-12-16 15:59:42.308infoTESTMOTA - 0️⃣⚡ Action: Initialize/Update Device
dev:3082023-12-16 15:59:39.766infoTasmota Sync - Universal Multi Sensor Driver reloaded with sensor type All
dev:3082023-12-16 15:59:39.764infoSwitchCount is: 0
dev:3082023-12-16 15:59:37.199infoTasmota Sync - Universal Multi Sensor Driver reloaded with sensor type All
dev:3082023-12-16 15:59:37.196infoSwitchCount is: 0
dev:3082023-12-16 15:59:37.168infoTESTMOTA - *️⃣1️⃣..updateStatus: Attributes Cleared - Refresh Browser!

Thanks, I see the issue. The code is expecting at least one sensor to be attached (besides the faux switch) and bombs when that is not the case. I'll fix that but it could be a little while.

In the meantime you can trick it as follows. Install the updated code from here.

I posted this a couple of months ago for someone who wanted it to work with counters, but he never got back to me to confirm, so I didn't release it. It works in my testing but I like corroboration.

All you have to do then is add a Counter to your configuration which will appear as a sensor and then the whole thing should work. You add a counter like this.

My Status 8 now looks like this:
{"StatusSNS":{"Time":"2023-12-16T18:37:13","COUNTER":{"C1":33},"SI7021":{"Temperature":45.7,"Humidity":68,"DewPoint":35.9},"TempUnit":"F"}}

You could add a rule that increments the counter every time the sensor switch gets turned on if you wanted to add some meaning to it.

Good luck.

1 Like

Thanks to you, I'm in no hurry, just testing. Another interesting feature to have could be the "device presence" so you know if the device loses connection or power.

I ended up connecting the switch (contact sensor) with a dummy relay in tasmota. The problem now is to get the switch recognized as a contact sensor in hubitat, without having to create virtual duplicates and update them via RM (I have more than twenty contact sensors and it would be pure chaos).
I am using both universal and standard drivers with children.

Is it possible to add an option to the driver to treat a switch as a contact so that it can be better integrated into rules and dashboards?

I could see possibly adding support for that concept in the Universal driver because its not a huge stretch to see it represent an actual contact vs a switch.

But I can't say the same for the normal relay drivers drivers. Perhaps you could explain in more detail what you are trying to do and how it might be used by others.

I'm simply trying to use 2/4 channels relays modules to control garages (open/close) and irrigation valves. Than I would use the free gpios like said before for contact sensors to monitor openings and rain sensors (same concept). But if HE doesn't see a contact device the all integration it's a nightmare of workarounds.

The problem with the Universal driver is that it's based on attributes and I don't think it will work (as far as I know).

I'll DM you.

I just released an update to the Universal Sensor Driver. The update does 2 things.

  1. Corrects an error that could cause an exception in the TasmotaInjectRule
  2. Adds supports for counters as a sensor type.

Counters can be used to hold all kinds of numeric data that you can generate using Tasmota rules.

Update available via HPM.

1 Like

Hi all,
can someone help me regarding this topic?
lastMessage : {"StatusSNS":{"Time":"1970-03-22T20:38:38","OBIS":{"Total_in":61844.6357,"Total_out":57791.0262,"Power_curr":0}}}

I can, but I’m traveling at the moment. What is the question?

Hi @garyjmilne hop, you are doing good?
My question is can you please add this to your driver?
In my case, "OBIS" is a Power meter
Total_in = Power kwh
Total_out = Power Kwh
Power_curr = Power Kwh

Make these sense for you?

Yes, I can do that once i get back.

Brilliant than you! And looking forward to implemented again, thank you.

@garyjmilne just a quick update:
Power_curr = Power within W not within Kwh