[SOLVED] OpenHAB + Homie + Sonoff POW + MQTT values

Hi I have just loaded a Homie script onto my Sonoff POW and the device is working as it should be.

I have added an MQTT switch as an item in OpenHAB and I can control the device, I also have the devices uptime displayed. What I can’t work out is how to show the voltage and current - it is being published on MQTT. Its just showing it in OpenHAB I am struggling with!

The switch that works:

Switch Sonoff_POW_Switch "Wall Socket" { 

The uptime that is reported by Homie (again it works):

String Sonoff_POW_Uptime "Sonoff POW [%s]" {

Now I have tried several items to get it to display the voltage and current, but none seem to work:

String Sonoff_POW_Volts "Voltage [%.2f Volts]" {
String Sonoff_POW_Volts1 "Voltage [%.2f Volts]" {
String Sonoff_POW_Volts2 "Voltage [%.2f Volts]" {
String Sonoff_POW_Volts3 "Voltage [%.2f Volts]" {
String Sonoff_POW_Volts4 "Voltage [%.2f Volts]" {
String Sonoff_POW_Volts5 "Voltage [%.2f Volts]" {
String Sonoff_POW_Volts6 "Voltage [%.2f Volts]" {

For example the voltage is reported on topic: homie/sonoff-pow/voltage/volts as 241.02 when using MQTT LENS to watch the topics.

Thanks in advance!

Your transformation is messed up. The clause after the topic is a transformation to apply to the incoming message. In your first example you don’t have a transform which I think will result in an error. In the rest you using things that are not valid transforms.



default is how you tell the binding to not apply a transformation.

Perfect! Thank-you, I was trying to find a definition of how to write the correct MQTT string but was struggling to find one!

Thanks again Rich.

When in doubt, look first to the binding’s readme.