Sonoff POW / Sonoff-MQTT-OTA-Arduino

Anyone has a Sonoff POW script that the washing machine sent notification to your phone as a reminder to hang up laundry?

1 Like

Anyone able to help me with the other sensors of the sonoff POW?

Here is the result of the following code in HA:

sensor:

  - platform: mqtt    
    name: "Fridge Draw"
    state_topic: "home/sonoff/server_room/1/power"
    qos: 0
    unit_of_measurement: "W"
    value_template: "{{ value_json.Power }}"

  - platform: mqtt    
    name: "Fridge Voltage"
    state_topic: "home/sonoff/server_room/1/power"
    qos: 0
    unit_of_measurement: "V"
    value_template: "{{ value_json.Voltage }}"

  - platform: mqtt    
    name: "Fridge Today"
    state_topic: "home/sonoff/server_room/1/power"
    qos: 0
    unit_of_measurement: "kWh"
    value_template: "{{ value_json.Today }}"

  - platform: mqtt    
    name: "Fridge Current"
    state_topic: "home/sonoff/server_room/1/power"
    qos: 0
    unit_of_measurement: "A"
    value_template: "{{ value_json.Current }}"

  - platform: mqtt    
    name: "Fridge Yesterday"
    state_topic: "home/sonoff/server_room/1/power"
    qos: 0
    unit_of_measurement: "kWh"
    value_template: "{{ value_json.Yesterday }}"

1 Like

I’m using only the sensors listed in the Tasmota wiki

sensor:
  - platform: mqtt
    name: "Energy"
    state_topic: "tele/pow1/ENERGY"
    value_template: "{{ value_json.Today }}"
    unit_of_measurement: "kWh"

Take note I’m using the Tasmota version of the firmware by Theo Arendst which is still developed.

1 Like

is it measuring the energy consumption (kwh)?

I guess I’ll try that Tasmota firmware because I feel I can definitely get more data out of it, ideally I’d love to have the total kWh usage for the day that you’re telling me it provides :slight_smile:

From Tasmota wiki

The Sonoff Pow can provide Energy, Power, Voltage and Current information in different ways.

Message   | Unit | Description
----------|------|-----------------------------------------------------
Yesterday | kWh  | Total Energy usage between 00:00 and 24:00 yesterday
Today     | kWh  | Total Energy usage today from 00:00 until now
Period    | Wh   | Energy usage between previous message and now
Power     | W    | Current power load
Factor    |      | The ratio of the real power flowing to the load to
          |      |   the apparent power in the circuit 
Voltage   | V    | Current line voltage
Current   | A    | Current line current

Sorry to bump this thread but how is it working lately?
Just want to confirm - to set the update period just send once TelePeriod = 300 and it is stored in flash? Afterwards POW will report the measurments and they are easily picked up via the following config? Any bugs or problems?

  - platform: mqtt
    name: "Energy"
    state_topic: "tele/pow1/ENERGY"
    value_template: "{{ value_json.Today }}"
    unit_of_measurement: "kWh"
  - platform: mqtt
    name: "Power"
    state_topic: "tele/pow1/ENERGY"
    value_template: "{{ value_json.Power }}"
    unit_of_measurement: "W"
  - platform: mqtt
    name: "Voltage"
    state_topic: "tele/pow1/ENERGY"
    value_template: "{{ value_json.Voltage }}"
    unit_of_measurement: "V"

I too am curious about how well this is working. It seems to me that the Sonoff products are underappreciated at their price point. Why are they getting so little attention by the community? I can’t image paying double for a zwave device for the same (or maybe even less) functionality.

Am I missing something?

Any way to keep the state across restarts? Problem is that for the switch it publishes to the following topic every update.

state_topic: "stat/convec/POWER"

But also publishes state every 5 minutes via

tele/convec/STATE {"Time":"2017-12-12T08:34:50","Uptime":37,"Vcc":3.178,"POWER":"ON","Wifi":{"AP":1,"SSId":"","RSSI":68,"APMac":""}}

So wonder if there is a way to combine those

Bump. Anyone getting this to work? I can make the switch part work but not the power monitoring. I am using the tasmota firmware and instructions. Power monitoring works on the sonoff web interface but I can’t get it to translate to home assistant.

My works with this in sensors:

 - platform: mqtt
   state_topic: "tele/sonoff_pow1/ENERGY"
   name: "Wash"
   value_template: "{{ value_json.Power }}"
   unit_of_measurement: "W"

Thanks. I tried this and it still is not working. Here are my config files. Switch part works, power sensor does not. The POW project name in the tasmota firmware is “sonoff1”. I am using hass.io w/ the mosquitto add-on for my MQTT broker. Feels like I am just one small setting away from making this work. Appreciate the help!

mqtt:
broker: localhost
port: 1883
client_id: home-assistant-1
keepalive: 60
protocol: 3.1
birth_message:
topic: “tele/hass1/LWT”
payload: “Online”
qos: 1
retain: true
will_message:
topic: “tele/hass1/LWT”
payload: “Offline”
qos: 1
retain: true

switch:

  • platform: mqtt
    name: “Washer”
    command_topic: “cmnd/sonoff1/power”
    state_topic: “stat/sonoff1/POWER”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

sensor:

  • platform: mqtt
    state_topic: “tele/sonoff1/ENERGY”
    name: “Wash”
    value_template: “{{ value_json.Power }}”
    unit_of_measurement: “W”
1 Like

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"
1 Like

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"
2 Likes

@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 }}"

Untitled-1

If I turn on the power it provides measurements, yes.