How to configure a Tasmota Sonoff Pow?

Hello guys,
I want to add a sonoff pow (with Tasmota firmware onboard) to my things in order to receive the power meter data and controll it. I can’t find it in the list of tasmota devices, and if I add it as a single switch device, the power meter data there are not showed. How could I do?

Hello @mosix
hmm, the tasmota plugin doesn’t support this device directly atm. It shouldn’t be too hard to add it but none of us currently have access to such a device to implement support for it.

That said, you should be able to still add it if you don’t mind using the script engine. For that, add a new MQTT client thing in nymea as well as as Generic smart meter consumer thing. Then create a new script (Main menu → magic → script button in the upper right). In the script code read the values from your Tasmota device and write them to the generic smart meter consumer. It should be very similar to this howto, except that you’d read the power meter values instead of temperature sensor values: sensor-on-mqtt-server · documentation

Hi all,

I’m also just playing around with my Tasmota based power sockets.
I managed to get them working without any problem by adding them via their internal IP.
Afterwards I created a Generic Power Socket Thing to switch them on and off.

My question now is also, if there is a way to see the power consumption of the sockets? As there is no automatically created Smart Power Meter like for the Shellys, I tried to create one manually. I managed to link the Tasmota Power Socket to the Generic Impulse based energy meter but unfortunately that led to a loss of the functionallity of the Generic Power Socket, which means I can no longer switch on or off.

Is there a way out of the box to get both generic things work at the same time –the generic power socket and and a smart meter thing?

Thanks for your help.

Well, the impulse based generic meter is not what you want here. Those are for energy meters that have a blinking LED, indicating a consumption of x Wh per light impulse.

You’d need to use the generic smart meter consumer thing. But given that power metering isn’t just a on/off signal (like controlling a light), that can’t be done via generic I/O connections.

You’ll need a internal mqtt client thing to snoop into the mqtt broker and read the energy values the tasmota devices publishes there. Then use a script to set those values into the generic smart meter consumer thing, like in the documentation link I’ve posted above. It’s not utterly complicated, but also not exactly the simplest way to set up stuff…

Can someone of you enable the Tasmota debug logs in the debug web interface, then set up such a tasmota device, keep it running for a few minutes so that it would produce a couple of energy values and then post the log here? Perhaps it’s easy enough to add the power meter stuff in the plugin from seeing the logs only…

Hi @mzanetti ,
thanks for your answer. That’s what I was expecting …
I will read the documentation and try to setup this via MQTT, although I was hoping to avoid this.
I will also enable the logs and post them here as soon as I find time.
Thanks and regards!

fwiw, the logs I’d need for development would be enough if they are done by using one of the existing tasmota things without power management. No need for the script stuff yet just to get the logs.

So here are the logs. If I missed something or you need more date, please let me know.
Thanks a lot for your time and help. :+1:

W | nymea.mqtt.server: Keep alive timeout reached for client: “be5328ef30e8466a89f4515c3e9aad21”
I | Tasmota: Publish received from Sonoff thing: “be5328ef30e8466a89f4515c3e9aad21/sonoff/LWT” Offline
I | Tasmota: Sonoff thing disconnected!
I | Thing: Adjusting state value for “signalStrength” from QVariant(uint, 4294967295) to new maximum value of QVariant(uint, 100)
I | Tasmota: Configuring Tasmota thing: “http://192.168.178.83/cm?cmnd=Backlog FullTopic 7c3cfc26b8d044f3acdb5be71b2b4902%2F%25topic%25%2F%3BMqttClient 7c3cfc26b8d044f3acdb5be71b2b4902%3BMqttHost 192.168.178.80%3BMqttPassword 51c038626fc74c52%3BMqttPort 1883%3BMqttUser 08edd06095624e2a%3BTopic sonoff”
I | Tasmota: Sonoff setup complete
I | Tasmota: Adding Tasmota Switch devices
I | Tasmota: Adding Tasmota connected devices
I | Tasmota: Connected Device 1 “None”
W | Thing: “Single switch (Sonoff Basic, RF, Touch…) CH1”: Invalid value QVariant(Invalid) for state “connected”. Type mismatch. Expected type: bool (Discarding change)
I | Tasmota: Sonoff thing connected!
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/LWT” Online
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/cmnd/POWER”
W | nymea.mqtt.server: Subscription topic filter not allowed for client “7c3cfc26b8d044f3acdb5be71b2b4902”: “cmnd/7c3cfc26b8d044f3acdb5be71b2b4902_fb/#”
W | nymea.mqtt.server: Subscription topic filter not allowed for client “7c3cfc26b8d044f3acdb5be71b2b4902”: “homeassistant/status”
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/INFO1” {“Info1”:{“Module”:“Gosund SP1 v23”,“Version”:“11.1.0(tasmota)”,“FallbackTopic”:“cmnd/7c3cfc26b8d044f3acdb5be71b2b4902_fb/”,“GroupTopic”:“7c3cfc26b8d044f3acdb5be71b2b4902/tasmotas/cmnd/”}}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/INFO2” {“Info2”:{“WebServerMode”:“Admin”,“Hostname”:“sonoff-5666”,“IPAddress”:“192.168.178.83”}}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/INFO3” {“Info3”:{“RestartReason”:“Software/System restart”,“BootCount”:31}}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/RESULT” {“POWER”:“ON”}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/POWER” ON
W | Thing: No such state type “{00000000-0000-0000-0000-000000000000}” in “Single switch (Sonoff Basic, RF, Touch…)” “(sonoff_basic)”
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/STATE” {“Time”:“2022-06-24T18:45:34”,“Uptime”:“0T00:00:10”,“UptimeSec”:10,“Heap”:28,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“b-net”,“BSSId”:“38:10:D5:A8:E7:FB”,“Channel”:6,“Mode”:“11n”,“RSSI”:90,“Signal”:-55,“LinkCount”:1,“Downtime”:“0T00:00:04”}}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/SENSOR” {“Time”:“2022-06-24T18:45:34”,“ENERGY”:{“TotalStartTime”:“2021-02-06T10:03:16”,“Total”:0.000,“Yesterday”:0.000,“Today”:0.000,“Period”: 0,“Power”:41,“ApparentPower”:42,“ReactivePower”: 9,“Factor”:0.98,“Voltage”:226,“Current”:0.184}}
W | Platform: Platform plugin does not implement deviceSerialNumber and DEVICE_SERIAL is not set. Cannot determine device serial number.
I | Tasmota: Publishing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/cmnd/POWER1” “ON”
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/STATE” {“Time”:“2022-06-24T18:46:23”,“Uptime”:“0T00:00:59”,“UptimeSec”:59,“Heap”:27,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“b-net”,“BSSId”:“38:10:D5:A8:E7:FB”,“Channel”:6,“Mode”:“11n”,“RSSI”:78,“Signal”:-61,“LinkCount”:1,“Downtime”:“0T00:00:04”}}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/RESULT” {“POWER”:“ON”}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/POWER” ON
W | Thing: No such state type “{00000000-0000-0000-0000-000000000000}” in “Single switch (Sonoff Basic, RF, Touch…)” “(sonoff_basic)”
I | Tasmota: Publishing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/cmnd/POWER1” “OFF”
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/STATE” {“Time”:“2022-06-24T18:46:26”,“Uptime”:“0T00:01:02”,“UptimeSec”:62,“Heap”:27,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“POWER”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“b-net”,“BSSId”:“38:10:D5:A8:E7:FB”,“Channel”:6,“Mode”:“11n”,“RSSI”:90,“Signal”:-55,“LinkCount”:1,“Downtime”:“0T00:00:04”}}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/RESULT” {“POWER”:“OFF”}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/POWER” OFF
W | Thing: No such state type “{00000000-0000-0000-0000-000000000000}” in “Single switch (Sonoff Basic, RF, Touch…)” “(sonoff_basic)”
I | Tasmota: Publishing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/cmnd/POWER1” “ON”
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/STATE” {“Time”:“2022-06-24T18:46:28”,“Uptime”:“0T00:01:04”,“UptimeSec”:64,“Heap”:27,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“b-net”,“BSSId”:“38:10:D5:A8:E7:FB”,“Channel”:6,“Mode”:“11n”,“RSSI”:88,“Signal”:-56,“LinkCount”:1,“Downtime”:“0T00:00:04”}}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/RESULT” {“POWER”:“ON”}
I | Tasmota: Publish received from Sonoff thing: “7c3cfc26b8d044f3acdb5be71b2b4902/sonoff/POWER” ON
W | Thing: No such state type “{00000000-0000-0000-0000-000000000000}” in “Single switch (Sonoff Basic, RF, Touch…)” “(sonoff_basic)”

1 Like

Latest experimental should support this now. Please let me know if it works properly. No need to re-setup the things. After the upgrade, the power meter should just appear if when the tasmota device starts sending power meter values.

Hi. Thanks again for your work!

As you wrote, I upgraded my system to the latest experimental built while in the background I had running a Tasmota based power socket with a light as consumer.

In Nymea the power meter appeared immediately but was showing 0 W as consuming power even the light was on and in the Tasmota GUI I could see a consumption of 6 W. So my first thought was that it was not running properly. So I started the logs and couldn’t even see any entry about my Tasmota Power Socket. For your information, I have setup 4 Tasmota Power sockets and do test with number 4 (IP .86). The other three devices are not connected right now. Here the logs show me correctly that they are missing:

I | Tasmota: Configuring Tasmota thing: “http://192.168.178.84/cm?cmnd=Backlog FullTopic be5328ef30e8466a89f4515c3e9aad21%2F%25topic%25%2F%3BMqttClient be5328ef30e8466a89f4515c3e9aad21%3BMqttHost 192.168.178.80%3BMqttPassword 28e16bac543b48bd%3BMqttPort 1883%3BMqttUser b84f42fe7ef74dfe%3BTopic sonoff”
I | Tasmota: Configuring Tasmota thing: “http://192.168.178.85/cm?cmnd=Backlog FullTopic ec8c2a48c9be4d158de4ce45ca28c528%2F%25topic%25%2F%3BMqttClient ec8c2a48c9be4d158de4ce45ca28c528%3BMqttHost 192.168.178.80%3BMqttPassword 5d23b6c261774f2c%3BMqttPort 1883%3BMqttUser d3134f981bbf4bda%3BTopic sonoff”
I | Tasmota: Configuring Tasmota thing: “http://192.168.178.83/cm?cmnd=Backlog FullTopic 7c3cfc26b8d044f3acdb5be71b2b4902%2F%25topic%25%2F%3BMqttClient 7c3cfc26b8d044f3acdb5be71b2b4902%3BMqttHost 192.168.178.80%3BMqttPassword a0cadddd66934bad%3BMqttPort 1883%3BMqttUser 2c3d7d8cbe314b50%3BTopic sonoff”

I | Tasmota: Sonoff thing setup call failed: QNetworkReply::UnknownNetworkError “Host unreachable” “”
I | Tasmota: Sonoff thing setup call failed: QNetworkReply::UnknownNetworkError “Host unreachable” “”
I | Tasmota: Sonoff thing setup call failed: QNetworkReply::UnknownNetworkError “Host unreachable” “”
W | ThingManager: Error setting up thing “Gosund 01 (Tasmota)” “{7c3cfc26-b8d0-44f3-acdb-5be71b2b4902}” Thing::ThingErrorSetupFailed “Could not connect to Tasmota device.”
W | ThingManager: Error setting up thing “Gosund 03 (Tasmota)” “{ec8c2a48-c9be-4d15-8de4-ce45ca28c528}” Thing::ThingErrorSetupFailed “Could not connect to Tasmota device.”
W | ThingManager: Error setting up thing “Gosund 02 (Tasmota)” “{be5328ef-30e8-466a-89f4-515c3e9aad21}” Thing::ThingErrorSetupFailed “Could not connect to Tasmota device.”

I | Tasmota: Configuring Tasmota thing: “http://192.168.178.83/cm?cmnd=Backlog FullTopic 7c3cfc26b8d044f3acdb5be71b2b4902%2F%25topic%25%2F%3BMqttClient 7c3cfc26b8d044f3acdb5be71b2b4902%3BMqttHost 192.168.178.80%3BMqttPassword 0c943f551fb64f16%3BMqttPort 1883%3BMqttUser 7544e7ba4e6e4672%3BTopic sonoff”
I | Tasmota: Configuring Tasmota thing: “http://192.168.178.85/cm?cmnd=Backlog FullTopic ec8c2a48c9be4d158de4ce45ca28c528%2F%25topic%25%2F%3BMqttClient ec8c2a48c9be4d158de4ce45ca28c528%3BMqttHost 192.168.178.80%3BMqttPassword 19091ec6d2784a65%3BMqttPort 1883%3BMqttUser f3d3e59139924149%3BTopic sonoff”
I | Tasmota: Configuring Tasmota thing: “http://192.168.178.84/cm?cmnd=Backlog FullTopic be5328ef30e8466a89f4515c3e9aad21%2F%25topic%25%2F%3BMqttClient be5328ef30e8466a89f4515c3e9aad21%3BMqttHost 192.168.178.80%3BMqttPassword d8c787bf63fe4d3c%3BMqttPort 1883%3BMqttUser dd91a12440864c68%3BTopic sonoff”

Suddenly after a few minutes (3 - 4 minutes I would say), the power meter started showing the correct value for my test socket.

I | Tasmota: Publish received from Sonoff thing: “381321d8087c4211be8961b5ac009465/sonoff/STATE” {“Time”:“2022-06-26T18:51:45”,“Uptime”:“0T00:15:11”,“UptimeSec”:911,“Heap”:26,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:26,“MqttCount”:1,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“b-net”,“BSSId”:“38:10:D5:A8:E7:FB”,“Channel”:6,“Mode”:“11n”,“RSSI”:86,“Signal”:-57,“LinkCount”:1,“Downtime”:“0T00:00:05”}}
I | Tasmota: Publish received from Sonoff thing: “381321d8087c4211be8961b5ac009465/sonoff/SENSOR” {“Time”:“2022-06-26T18:51:45”,“ENERGY”:{“TotalStartTime”:“2021-02-06T11:41:49”,“Total”:0.002,“Yesterday”:0.000,“Today”:0.002,“Period”: 0,“Power”: 6,“ApparentPower”:11,“ReactivePower”: 9,“Factor”:0.58,“Voltage”:239,“Current”:0.044}}

But I still cannot find any entry in the log that I turned on the power socket and I also don’t find any entry under its IP.

When I turn off the power socket the power meter also shows me the old power value for a couple of minutes (again 3 - 4 minutes) before it turns to zero.

I | Tasmota: Publish received from Sonoff thing: “381321d8087c4211be8961b5ac009465/sonoff/STATE” {“Time”:“2022-06-26T19:06:45”,“Uptime”:“0T00:30:11”,“UptimeSec”:1811,“Heap”:26,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“POWER”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“b-net”,“BSSId”:“38:10:D5:A8:E7:FB”,“Channel”:6,“Mode”:“11n”,“RSSI”:92,“Signal”:-54,“LinkCount”:1,“Downtime”:“0T00:00:05”}}
I | Tasmota: Publish received from Sonoff thing: “381321d8087c4211be8961b5ac009465/sonoff/SENSOR” {“Time”:“2022-06-26T19:06:45”,“ENERGY”:{“TotalStartTime”:“2021-02-06T11:41:49”,“Total”:0.003,“Yesterday”:0.000,“Today”:0.003,“Period”: 0,“Power”: 0,“ApparentPower”: 0,“ReactivePower”: 0,“Factor”:0.00,“Voltage”: 0,“Current”:0.000}}

I just wanted to let you know about this behaviour. Maybe you can have a closer look at those two points - the time lag of the consumption value in the power meter and the missing log entry when turning the power socket on or off.

Thanks a lot!

Hmm… This log prints anything that the tasmota device sends to nymea… Googling for tasmota update interval I found this: Peripherals - Tasmota
This says that the energy values will be sent to MQTT every 300s by default. That would match the delay of 3 minutes you’re seeing. According to the docs, this can be set to 10 seconds the lowest. I suppose it would make sense to allow configuring this interval in nymea, or maybe just auto-configure the device to send it more often.

Now, for the on/off. Can you elaborate a bit more please. Did you turn it on/off through nymea, or via the physical switch (if it has one) or via the tasmota web ui? Is the power state in nymea and the tasmota web ui in sync?

I’ve added a patch that configures the teleperiod setting to 10 secs upon connection. That should improve the behavior hopefully. Let me know if it works. It’s currently building, so should be available by tomorrow.

Hi. The patch really helped. It now reacts much faster showing the power consumption after switching on or off. Thanks for that!

Regarding the other point I mentioned, you can ignore that that. Everything is working fine now for me.

:+1:

1 Like