Ok, show mqtt settings in tasmota.
Tasmota changed the message format to be inline with other sensors. See this github post for details
TL;DR
- platform: mqtt
name: "Voltage"
state_topic: "tele/sonoffpow/SENSOR"
value_template: "{{ value_json['ENERGY'].Voltage}}"
unit_of_measurement: "V"
Well it seems like everyone has managed to make it work. I added the correct settings and I see the sensors showing up on Homeassistant home page. However, it seems like my problem is different. My Sonoff POW looks like does not get the data:
15:44:52 MQT: tele/MissSilvia/SENSOR = {“Time”:“2018-02-13T15:44:52”,“ENERGY”:{“Total”:0.000,“Yesterday”:0.000,“Today”:0.000,“Period”:0,“Power”:0,“Factor”:0.00,“Voltage”:0,“Current”:0.000}}
This is what I get from the console of my Tasmota flashed device.
Has anyone experienced such issue?
did you change it to a pow device in the web GUI of the tasmota page. I had no power settings until I did this.
It was done before I asked the question. This is why I asked, because it does not work.
@Evo: My Sonoff Pow provides the same messages like yours. This is my working configuration:
- platform: mqtt
name: "sonoff-1663 energy today"
state_topic: "tele/sonoff-1663/SENSOR"
value_template: '{{ value_json.ENERGY.Today }}'
unit_of_measurement: "kWh"
- platform: mqtt
name: "sonoff-1663 energy yesterday"
state_topic: "tele/sonoff-1663/SENSOR"
value_template: '{{ value_json.ENERGY.Yesterday }}'
unit_of_measurement: "kWh"
- platform: mqtt
name: "sonoff-1663 energy total"
state_topic: "tele/sonoff-1663/SENSOR"
value_template: '{{ value_json.ENERGY.Total }}'
unit_of_measurement: "kWh"
- platform: mqtt
name: "sonoff-1663 power"
state_topic: "tele/sonoff-1663/SENSOR"
value_template: '{{ value_json.ENERGY.Power }}'
unit_of_measurement: "W"
- platform: mqtt
name: "sonoff-1663 voltage"
state_topic: "tele/sonoff-1663/SENSOR"
value_template: '{{ value_json.ENERGY.Voltage }}'
unit_of_measurement: "V"
- platform: mqtt
name: "sonoff-1663 current"
state_topic: "tele/sonoff-1663/SENSOR"
value_template: '{{ value_json.ENERGY.Current }}'
unit_of_measurement: "A"
@syssi Does yours give you data, mine does not. Here is my config:
104 sensor:
105 - platform: yr
106 name: "NMI"
107
108 - platform: mqtt
109 name: "Coffee Draw"
110 state_topic: "tele/MissSilvia/SENSOR"
111 qos: 0
112 unit_of_measurement: "W"
113 value_template: "{{ value_json['ENERGY'].Power }}"
114
115 - platform: mqtt
116 name: "Coffee Voltage"
117 state_topic: "tele/MissSilvia/SENSOR"
118 qos: 0
119 unit_of_measurement: "V"
120 value_template: "{{ value_json['ENERGY'].Voltage }}"
121
122 - platform: mqtt
123 name: "Coffee Today"
124 state_topic: "tele/MissSilvia/SENSOR"
125 qos: 0
126 unit_of_measurement: "kWh"
127 value_template: "{{ value_json['ENERGY'].Today }}"
128
129 - platform: mqtt
130 name: "Coffee Current"
131 state_topic: "tele/MissSilvia/SENSOR"
132 qos: 0
133 unit_of_measurement: "A"
134 value_template: "{{ value_json['ENERGY'].Current }}"
135
136 - platform: mqtt
137 name: "Coffee Yesterday"
138 state_topic: "tele/MissSilvia/SENSOR"
139 qos: 0
140 unit_of_measurement: "kWh"
141 value_template: "{{ value_json['ENERGY'].Yesterday }}"
I nearly made the same mistake, its “{{ value_json.ENERGY.Current }}” not “{{ value_json[‘ENERGY’].Current }}”
@NewToThis
I switched the json string and it is still giving me the same result. I think my issues come from the device itself not from homeassistant
Correct. The device reports always zeros in your case.
Could u maybe help me getting my sonoff running. Its connected and mqtt has messages but state and cmd just won’t work … I use standard way like indicated on tosmota site .I’ve sonoff basic .one works fine as a fan switch but my three others same model newer firmware just show unavailable… What do u need to debug?
Please post your configuration and use a mqtt client to capture some mqtt messages of the devices.
Config:
- platform: mqtt
name: "On/Off Sonoff"
state_topic: "kitchen/socket_kitchen_left/RESULT"
value_template: '{{ value_json["POWER"] }}'
command_topic: "kitchen/socket_kitchen_left/POWER"
availability_topic: "kitchen/socket_kitchen_left/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: true
MQTT Messages:
hass@home-assistant:~$ mosquitto_sub -t kitchen/#
online
{"POWER":"ON"}
ON
{"POWER":"OFF"}
OFF
{"Time":"2018.04.09 08:52:09","Uptime":"0 12:11:26","Vcc":3.153,"POWER":"OFF","Wifi":{"AP":1,"SSId":"EmEvTh","RSSI":100,"APMac":"38:D5:47:20:67:88"}}
{"OtaUrl":"http://domus1:80/api/arduino/sonoff.ino.bin"}
{"Upgrade":"Version 5.12.0 from http://domus1:80/api/arduino/sonoff.ino.bin"}
Failed HTTP error: connection refused
online
{"Module":"Sonoff Basic","Version":"5.12.0","FallbackTopic":"DVES_746D36","GroupTopic":"sonoffs"}
{"WebServerMode":"Admin","Hostname":"socket_kitchen_left-3382","IPAddress":"192.168.1.49"}
{"RestartReason":"Software/System restart"}
{"POWER":"OFF"}
OFF
{"Time":"2018.04.09 08:53:10","Uptime":"0 00:00:16","Vcc":3.154,"POWER":"OFF","Wifi":{"AP":1,"SSId":"EmEvTh","RSSI":100,"APMac":"38:D5:47:20:67:88"}}
{"POWER":"ON"}
ON
{"POWER":"OFF"}
OFF
{"Time":"2018.04.09 08:58:10","Uptime":"0 00:05:16","Vcc":3.155,"POWER":"OFF","Wifi":{"AP":1,"SSId":"EmEvTh","RSSI":100,"APMac":"38:D5:47:20:67:88"}}
``
![Bildschirmfoto-46|690x387](upload://w579cTQ9kNaXIIfwu4M9YboebYq.png)
Could you provide the output of:
mosquitto_sub -v -t '#'
Your dump isn’t complete.
The payload has to match exactly, so “Online” should be “online”
Strange…then docs are wrong …thanks a lot it works now. Just need to add 2 other sonoff.they don’t wanna connect to the WiFi…
Got it running .thanks for hint. Dice are wrong then on tasmota wiki.anyway one sonoff is broken now I ordered new ones. WiFi issue solved by assigning ststic IP address from router side. Running stable for more than 12 hours now
Hi, how did you group the switch with the sensor’s readings please? Mine are showing at the top of the overview page
Just add them to a group