[Released] Tasmota Sync - Universal Sensor Driver

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

Thanks very much @garyjmilne
Just loaded tonight, sorry for the delay. Will test over the coming days and let you know. So far, no issues, works like a charm!

1 Like

Give me a thumbs up or down when you are comfortable and I'll publish it for everyone.

Hi @garyjmilne , Thanks for the Universal Driver.
New here, just in the process of using Universal Multi-Sensor Double Relay on a Shelly Uni that has been updated with the latest version of Tasmota. Device appears correctly, with one DSB18S20 and 2 switch inputs.

Current States

  • Status : Complete:Success
  • range : 1
  • switch : off
  • switch1 : off
  • switch2 : off
  • tempUnit : C
  • temperature : 16.9

Where I am struggling with is how to access switch 1 , switch 2 within rules. Have read this thread and documents, but not yet found the way forward to use the switch 1 and 2 within the rules. Must be missing something obvious. Thanks

Sussed it, after getting some fresh air, custom, select device, then custom attribute of switch/device

The way you would do it with a normal 2 switch plug is to create child devices option in the parent driver. Those can then be controlled by rule machine using the typical dialogs.

The Universal Multi-Sensor does not have that luxury and in that instance you would be limited to using only the first switch through the standard dialogs, however you can execute a custom action in RM to turn on the second switch like this.

1 Like

Great, thanks for the quick response. Still learning, will play with this method.

I have a quantity of Xiaomi Thermometer LYWSD03MMC BLE sensors which are running custom firmware (GitHub - pvvx/ATC_MiThermometer: Custom firmware for the Xiaomi Thermometers and Telink Flasher). These have been running fine with esphome (on an ESP32) and connected to HA.

Now I am moving to using Tasmota connected to Hubitat. I'm running tasmota32-bluetooth.bin on the ESP32 device.

In the web GUI on the Tasmota devices I can see all the Xiaomi devices in a list showing all the temperature, humidity etc.

Image 07-12-2023 at 22.52

But if I do a "Status8" command from the console, I don't see the data from the BLE devices (which is confusing me since it's visible in the web GUI).

22:24:02.379 RSL: STATUS = {"Status":{"Module":1,"DeviceName":"Tasmota","FriendlyName":["Tasmota"],"Topic":"tasmota_8BDE30","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0,"StatusRetain":0}}

Then in Hubitat I'm not seeing any sensor information (using "Tasmota Sync - Universal Multi Sensor"). When I try the Tasmota Inject Rule that gives an error in the logs.

java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 0 on line 1133 (method tasmotaInjectRule)

Any thoughts appreciated.

Make sure you are doing a “status 8” and not status8.

Once you have done that send me the response you get. I don’t have any BLE Tasmota but perhaps it will be unrelated to that.

Here you go

09:28:40.300 CMD: status 8
09:28:40.308 RSL: STATUS8 = {"StatusSNS":{"Time":"2023-12-08T09:28:40"}}

That is the bare minimum response from STATUS 8. just the time. It should look something like this when there is sensor data attached:
{"StatusSNS":{"Time":"2023-12-08T16:53:34","COUNTER":{"C1":33,"C4":56},"SI7021":{"Temperature":43.5,"Humidity":71,"DewPoint":34.8},"TempUnit":"F"}}

When you paste that into Evaluate Sensor Data. click the button and then do a browser refresh the State Variables will update with the new data as shown below. Then you know you are good to go and can do the Tasmota Inject Rule.

First thing you have to get working is the reporting of the SENSOR data when you do a STATUS 8. That is the method the driver uses to get the initial data and determine what sensors are attached. I'm not familiar with their bluetooth variant but that seems like the wild card here. Good Luck.

Thanks for the advice.

I agree, my problem seems to be up-stream of your integration and a problem within Tasmota itself.