[SOLVED] Sonoff POW openhab2 integration

OK, so what do I Need to do…
I Need to make sure, in sonoff it is set to “sonoffpow” like this:


But leaving the userID to Default like this:

The Things Need to be like this?

Bridge mqtt:broker:mosquitto "Mosquitto" [ host="192.168.178.42", port=1883, secure=false, username="openhabian", password="", clientID="openhab2" ]
{   
    Thing topic sonoffpow "Sonoff POW" @ "Photovoltaik" {
    Channels:
        Type string : reachable "Reachable"              [ stateTopic="tele/sonoffpow/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="stat/sonoffpow/POWER", commandTopic="cmnd/sonoff-pow/POWER" ]
        Type number : powerload "Power load"             [ stateTopic="tele/sonoffpow/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="tele/sonoffpow/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
        Type number : current   "Line current"           [ stateTopic="tele/sonoffpow/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
        Type number : total     "Total energy today"     [ stateTopic="tele/sonoffpow/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
        Type number : totalyest "Total energy yesterday" [ stateTopic="tele/sonoffpow/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
        Type number : rssi      "WiFi Signal Strength"   [ stateTopic="tele/sonoffpow/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
    } 
}

And the Items like this:

//-> Sonoff
Group  FF_Sonoff_POW           "Sonoff POW"                        <sonoff_pow>    (Sonoff_POW)
String FF_Sonoff_POW_Reachable "Reachable: [%s]"                   <contactable>   (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:reachable" }
Switch FF_Sonoff_POW_Power     "Power []"                          <sonoff_pow>    (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:power" }
Number FF_Sonoff_POW_Load      "Power load [%.1f W]"               <voltage>       (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:powerload" }
Number FF_Sonoff_POW_Voltage   "Line voltage [%.1f V]"             <voltage>       (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:voltage" }
Number FF_Sonoff_POW_Current   "Line current [%.3f A]"             <current>       (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:current" }
Number FF_Sonoff_POW_Today     "Total energy today [%.3f kWh]"     <total_energy>  (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:total" }
Number FF_Sonoff_POW_Yesterday "Total energy yesterday [%.3f kWh]" <total_energy>  (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:totalyest" }
Number FF_Sonoff_POW_RSSI      "WiFi Signal Strength [%d %%]"      <wifi>          (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:rssi" }

Correct?

Correct, however keep in mind the MQTT topic is used in the thing config (stateTopic and commandTopic) . You use the same string as the thing name, because of that that your channel definition for the items contains this string as well.

Just to make sure, I understand your last post correct:
The Thing Topic (in my case “sonoffpow”) must be equal to stateTopic (in my case tele/sonoffpow/xxx) and the commandTompic (in my case cmnd/sonoffpow/xxx).
Correct?

:+1: Correct.

OK, thank you so much for your Explanation.
I will adjust this Points this evening and will post here if it works!
:smiley:

Hey - as promised - here my feedack.
IT WORKS!
Thank you again.
Now I need to figure out how to make the sidemap…and how to get any value into openhab. Only swiching on/OFF works:

Great!
Concerning the missing values, as long as the device does not have any values openHAB will also show zeros. Which would be the correct display since the device is reporting those zeros!

Got it - this works also.
Is there a possibility to update the values more often than every 5 minutes in openhab? Like ever minute?

This 5 minute setting is from Tasmota! Change it there.

Got it - telemetry period under configure logging

Need to ask since I just got my hands onto a Sonoff POW2 as well…
Does Sonoff devices require to flash Tasmota firmware to work with openhab (through mqtt)?

This Sonoff stuff is really killing me. There are tons of theads about it, but all seems to flash their devices as an start. So a really lack if info my be - Is it needed?

I think someone started work on an integration with Sonoff’s cloud service. That would be the only way integration can work without flashing it to Tasmota or one of the other alternative firmwares. Most users don’t want to have to go through a cloud service hosted in China to control a light.

Dont seem to be anything ready for openhab/Sonoff devices…
I have read alot about this flash of Sonoff devices… I really dont get. Seems like one have to have somekind of USB adaptor to flash… Hmprf!!

There used to support over the air flashing but it’s a constant car and missed game with Itead.

If you can’t or won’t reflash then, there are other better options to purchase like Shelly’s or Zwave, or one if the many supported wifi options.

The advantage of sonoffs is they are cheap and they can be flashed to get local control. But there are other cheap options (maybe not as cheap) that do provide local control. If the need to flash them is too much (note there are lots of people who resell them preflashed on eBay) code one if the other options. Though it’s worth noting that flashing the is really easy, even if you do need to spend a couple bucks on a programmer.

I think the OTA update will work, when you have it flashed with Tasmota :slight_smile:

atm I cant flash it, cause I havn´t got the need USB device to do it.
I do run z-wave. But this Sonoff POW2 is actually the thing I need to monitor the power used for my washing machine and dryer, dishwasher etc… I cant find any suitable devices in z-wave, Zigbee which is build the same. The sonoff Pow2 is constructed and fit perfectly. Outlets, powerplugs etc cant fit where I need them.
I did see someone mention people at ebay sell the Sonoff devices with tasmota firmware… This might come in hand, if I cant figure how to flash them myself.

I dont mind spending a few extra bucks. I´m used to spend money (and sometimes quite a few depending on who you ask :smiley: ).

You used to and maybe still can change the Sonoff firmware over the air in the first place before you have Tasmota foraged l flashed. That’s how I installed Tasmota on all of my Sonoffs. But I saw at one point that Itead broke that. I don’t know if it’s possible again or not.

I find it easiest to use a female-female Dupont cable with pogo pins.

Then it’s just a matter of touching the pins to the pads on the Sonoff, running the program, and waiting for it to finish.

There is a german shop that sells sonoff devices flashed with Tasmota. Search for creationx

I dont think so. I can only find threads about the “hard way”.

I´ll probably go for the FTDI FT232RL USB device… Seems more suitable to me.

Thanks… Unfortunatly the POW R2 with Tasmota is out of stock.

Regarding the wireless flashing (OTA as in overt the air). It WAS possible to do the initial flashing that way on an older firmware (don’t remember which number, my device from more then a year ago had already the newer firmware). Having done the initial flashing to Tasmota ( using the flash device) upgrading wireless is working.

Just to mention: When upgrading, it’s essential to flash the minimal version as a first step, because the standard firmware is using more than 50% of flash. I’m pretty sure this is also true for flashing from stock firmware.

Please ensure that the hardware is already listed as compatible.