Jump to content

Tasmota Rules for Publishing to MQTT


jkosharek

Recommended Posts

@Goose66 I am toying with an ESP8266 board running Tasmota and sending data to the MQTT node for battery voltage on a backup generator and wanted to also know when the generator is running by monitoring a 12v contactor coil voltage. Tasmota doesn't seem to be able to send sensor values to MQTT on a value change so I am looking at doing a publish with Tasmota Rules. 

Here is an example that I have working:

Rule1 on tele-DS18B20#Temperature do var1 %value% endon on DS18B20#Temperature>%var1% do backlog var1 %value%; publish Stat/GenMonitor/Temp {"Time":"%TIME%","DS18B20":{"Id":"DS18B20-1","Temperature":%value%},"TempUnit":"F"}; var2 %value%; endon on DS18B20#Temperature<%var2% do backlog var2 %value%; publish Stat/GenMonitor/Temp {"Time":"%TIME%","DS18B20":{"Id":"DS18B20-1","Temperature":%value%},"TempUnit":"F"}; var1 %value%; endon

That produces this, just don't understand the %time% output:
{"Time":"1288","DS18B20":{"Id":"DS18B20-1","Temperature":79.59},"TempUnit":"F"}

 

The one for the analog input doesn't seem to work at all, I have tried A0, ADC0, Analog:

Rule2 on tele-ADC0#Range do var3 %value% endon on ADC0#Range>%var3% do backlog var3 %value%; publish Stat/GenMonitor/Batt {"Time":"%TIME","ANALOG":{"Range":%value%}}; var4 %value%; endon on ADC0#Range<%var4% do backlog var4 %value%; publish Stat/GenMonitor/Batt {"Time":"%TIME","ANALOG":{"Range":%value%}}; var3 %value%; endon

 

 

Do you know of a better way to get more of a real time status from Tasmota to MQTT and in to IoX?

Link to comment

I ended up settling on these rules, I would rather have them only send data on a change but this is giving me real time data from the sensors. 

 

Rule1 on tele-DS18B20#Temperature do publish Stat/GenMonitor/Temp {"Time":"%TIMESTAMP%","DS18B20":{"Id":"DS18B20-1","Temperature":%value%},"TempUnit":"F"} endon

Rule2 on ANALOG#RANGE do publish Stat/GenMonitor/Batt {"Time":"%TIMESTAMP%","ANALOG": {"Range": %value%} } endon

 

Link to comment

Two things:

1. This sub-forum is specifically for the Tasmota Node Server. The Tasmota Node Server supports a specific list of devices running Tasmota (primarily from Martin Jerry) that fall into several broad categories: Switch, Plug-in Module, Dimmer, Fan Controller, and Humidity Switch. I hope to add new device support for devices falling into these categories and new categories as we go, but this node server is not intended to support generic Tasmota devices with custom states or properties. For that, I suggest trying the generic MQTT node server that is available in the Node Server Store.

2. For Tasmota community support - particularly rules - I suggest the "Tasmota" server on Discord. There is a specific channel for discussions regarding Rules.

Edited by Goose66
  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...