What do these errors mean and how to fix?

what I don’t understand is why you are using a different logic for your command and status topics:

command: diana/cord1/cmnd/POWER (order: name/item/type/POWER)
status: stat/diana/cord1/POWER (order: type/name/item/POWER)

maybe this is how Sonoff works… not sure cause I don’t have one

I would use the same order (if possible) to avoid confusion in my topics (both inbound and outbound)

name/item/type

example: diana/cord1/cmnd/POWER for commands and diana/cord1/stat/POWER for status
I need to read the Sonoff stuff to be sure :slight_smile:

so, clearly, your command topic is: diana/cord1/cmnd/POWER

so in your item config, you should use:

... mqtt=">[mosquitto:diana/cord1/cmnd/POWER:command:*:default] ...

for the outbound part

Tasmota Wiki

Sonoff responds to the following MQTT commands using MQTT Topic for cmnd/sonoff/<command> and MQTT Message/Payload for <parameter>:

The relay can be controlled with cmnd/sonoff/power on, cmnd/sonoff/power off or cmnd/sonoff/power toggle. Sonoff will send a MQTT status message like stat/sonoff/POWER ON.

where as his “sonoff” is his topic.
So my topic is cord1

forget the wiki defaults :slight_smile:
I believe that you can customize the topics in your Sonoff device
did you change the defaults by any chance on the Sonoff? (I would)

changes

Sonoff Basic Module

Cord1

 MQTT parameters 

Host (domus1)

192.168.1.200


Port (1883)

1883


Client Id (DVES_970D9F)

Cord1


User (DVES_USER)

openhabian


Password

•••••••••


Topic = %topic% (sonoff)

cord1

Full Topic (%prefix%/%topic%/)

diana/cord1

Save

looking at the example from the master thread:

try to use:

Switch		cord1		"Cord-1"		<poweroutlet>		(Cords, Lights, Power)
			{mqtt=">[mosquitto:cmnd/diana/cord1/power:command:*:default],
				   <[mosquitto:stat/diana/cord1/power:state:default]"}

topic structure:

for outbound commands: cmnd/%prefix%/%topic%/power
for status reports: stat/%prefix%/%topic%/power

just switched it to that

making progress I think. rebooting.

1 Like

not sure if the last part of the topic should be power (with small letters) or POWER with capital letters…
try both :stuck_out_tongue:

New openhab.log

2017-08-29 00:23:06.432 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://192.168.1.200:8443
2017-08-29 00:23:20.703 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'weather.items'
2017-08-29 00:23:21.129 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'diana.items'
2017-08-29 00:23:30.688 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'diana.sitemap'
2017-08-29 00:23:34.510 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2017-08-29 00:23:34.560 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mosquitto'
2017-08-29 00:23:35.913 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-08-29 00:23:36.285 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2017-08-29 00:23:37.653 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-08-29 00:23:38.185 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2017-08-29 00:23:38.496 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2017-08-29 00:23:56.935 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Stopped HABmin servlet
2017-08-29 00:23:57.069 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2017-08-29 00:24:02.764 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-08-29 00:24:03.147 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin

looks nice & clean :sunny:

Well… somethings different. when I toggle through Habpanel,

2017-08-29 00:28:41.131 [ItemCommandEvent          ] - Item 'cord1' received command ON
2017-08-29 00:28:41.238 [ItemStateChangedEvent     ] - cord1 changed from NULL to ON
2017-08-29 00:28:41.238 [GroupItemStateChangedEvent] - Power changed from NULL to ON through cord1
2017-08-29 00:28:43.502 [ItemCommandEvent          ] - Item 'cord1' received command ON
2017-08-29 00:28:46.469 [ItemCommandEvent          ] - Item 'cord1' received command ON

but the icon reverts back to the off state.
going to try a lowercase :power"

post your current item config

maybe the command part is not working (the mqtt message is not being delivered) and your status part is working, so OH2 reads that the Sonoff is off and it changes the switch state to OFF

what is the real state of the Sonoff module? (on or off)

just changed it a bit. testing.

scroll down a bit.

Group Home "Diana"   <house>

Group Attic "Attic" <attic> (Home)
    Number Attic_Temperature "Attic Temp" <temperature> (Attic, Temperature)
    Number Attic_Humidity "Attic Humidity" <humidity> (Attic, Humidity)

Group LaundryRoom "Laundry Room" <washingmachine> (Home)
    Switch LaundryRoom_Light "Laundry Room" <light> (LaundryRoom, Lights)
    Contact LaundryRoom_Door "Laundry Room Door" <door> (LaundryRoom, Doors)

Group Kitchen "Kitchen" <kitchen> (Home)
    Switch Kitchen_Light "Kitchen" <light> (Kitchen, Lights)
    Switch Island_Light "Kitchen Island" <light> (Kitchen, Lights)
    Switch Dinette_Light "Dinette" <light> (Kitchen, Lights)
    Contact Kitchen_Window "Kitchen Window" <window> (Kitchen, Windows)
    Contact Kitchen_Door "Kitchen Door" <door> (Kitchen, Doors)
    Number Kitchen_Temperature "Kitchen Temp" <temperature> (Kitchen, Temperature)

Group Dining "Dining"  (Home)
    Switch Dining_Light "Diningroom" <light> (Dining, Lights)
    Number Dining_Temperature "Diningroom Temp" <temperature> (Dining, Temperature)

Group Living "Livingroom" <sofa> (Home)
    Switch Living_Light "Livingroom" <light> (Living, Lights)
    Switch Living_Fan "Livingroom Fan" <fan_ceiling> (Living, Fans)
    Switch Livingroom_Power "Power outlets" <poweroutlet> (Living, Power)
    Number Living_Temperature "Temperature" <temperature> (Living, Temperature)

Group Entrance "Entrance" <frontdoor> (Home)
    Switch Entrance_Light "Entrance" <light> (Entrance, Lights)
    Contact Entrance_Door "Front Door" <door> (Entrance, Doors)
    Switch Entrance_Power "Power outlets" <poweroutlet> (Entrance, Power)
    Number Entrance_Temperature "Entrance Temp" <temperature> (Entrance, Temperature)

Group Hallway "Hallway" <corridor> (Home)
    Switch Hallway_Light "Hallway" <light> (Hallway, Lights)

Group MasterBedroom "Master Bedroom" <bedroom_red> (Home)
    Switch MasterBedroom_Light "Master Bedroom" <light> (MasterBedroom, Lights)
    Contact MasterBedroom_Door "Master Bedroom Door" <door> (MasterBedroom, Doors)
    Switch MasterBedroom_Fan "Master Bedroom Fan" <fan_ceiling> (MasterBedroom, Fans)
    Number MasterBedroom_Temperature "Master Bedroom Temp" <temperature> (MasterBedroom, Temperature)

Group Bedroom "Bedroom" <bedroom> (Home)
    Switch Bedroom_Light "Front Bedroom" <light> (Bedroom, Lights)
    Contact Bedroom_Window "Bedroom 1 Window" <window> (Bedroom, Windows)
    Switch Bedroom_Fan "Bedroom 1 Fan" <fan_ceiling> (Bedroom, Fans)
    Number Bedroom_Temperature "Bedroom 1 Temp" <temperature> (Bedroom, Temperature)

Group Bedroom2 "Bedroom 2"  (Home)
    Switch Bedroom2_Light "Bedroom 2" <light> (KidRoom1, Lights)
    Contact Bedroom2_Window "Bedroom 2 Window" <window> (KidRoom1, Windows)
    Switch Bedroom2_Fan "Bedroom 2 Fan" <fan_ceiling> (KidRoom1, Fans)
    Number Bedroom2_Temperature "Bedroom 2 Temp" <temperature> (KidRoom1, Temperature)

Group Bedroom3 "Bedroom 3"  (Home)
    Switch Bedroom3_Light "Bedroom 3" <light> (KidRoom2, Lights)
    Contact Bedroom3_Window "Bedroom 3 Window" <window> (KidRoom2, Windows)
    Switch Bedroom3_Fan "Bedroom 3 Fan" <fan_ceiling> (KidRoom2, Fans)
    Number Bedroom3_Temperature "Bedroom 3 Temp" <temperature> (KidRoom2, Temperature)

Group Bathroom "Bathroom" <bath> (Home)
    Switch Bathroom_Light "Bathroom" <light> (Bathroom, Lights)
    Contact Bathroom_Window "Bathroom Window" <window> (Bathroom, Windows)
    Number Bathroom_Humidity "Bathroom Humidity" <humidity> (Bathroom, Humidity)

Group MasterBathroom "Master Bathroom"  (Home)
    Switch MasterBathroom_Light "Master Bathroom" <light> (MasterBathroom, Lights)
    Contact MasterBathroom_Window "Master Bathroom Window" <window> (MasterBathroom, Windows)
    Number MasterBathroom_Temperature "Master Bathroom Temp" <temperature> (MasterBathroom, Temperature)
    Number MasterBathroom_Humidity "Master Bathroom Humidity" <humidity> (MasterBathroom, Humidity)

Group Cords "Cords" <poweroutlet> (Lights, Home)
    Switch cord1 "Cord-1" <poweroutlet> (Cords, Lights, Power)
     { mqtt=">[mosquitto:cmnd/diana/cord1/power:command:1:on], >[mosquitto:cmnd/diana/cord1/power:command:0:off],
             <[mosquitto:stat/diana/cord1/power:state:default]" }
    Switch Cord2_Light "Cord-2" <poweroutlet> (Cords, Lights, Power)
     { mqtt=">[mosquitto:cmd/Cord2_Light/POWER:command:*:default],
             <[mosquitto:stat/Cord2_Light/POWER:state:default]" }

Group Porch "Porch" <group> (Home)
    Switch Porch_Light "Porch" <light> (Porch, Lights)

Group Garage "Garage" <garage> (Home)
    Switch Garage_Light "Garage" <light> (Garage, Lights)
    Contact Garage_Door "Garage Door" <Garage> (Garage, Doors)
    Number Garage_Temperature "Garage Temp" <temperature> (Garage, Temperature)

Group Outdoor_Floods "Outdoor" <garden> (Home)
    Switch GarageFront_Light "Garage Front" <light> (Outdoor, Lights)
    Switch YardFL_Light "Yard" <light> (Outdoor, Lights)
    Switch PatioFL1_Light "Light" <light> (Outdoor, Lights)
    Switch PatioFL2_Light "Light" <light> (Outdoor, Lights)


Group:Number:AVG Temperature "Temperature" <temperature> (Home)
Group:Number:AVG Humidity "Humidity" <humidity> (Home)
//Group:Switch:OR(ON, OFF) Lights "Lights" <light> (Home)
Group:Contact:OR(OPEN, CLOSED) Windows "Windows" <window> (Home)
//Group:Switch:OR(ON, OFF) Fans "Fans" <fan_ceiling> (Home)
Group:Contact:OR(OPEN, CLOSED) Doors "Doors" <door> (Home)
Group:Switch:OR(ON, OFF) Power "Power outlets" <poweroutlet> (Home)



//Group HomeCinema "Home Cinema" <television> (Home)
//    Switch HomeCinema_Light "Light" <light> (HomeCinema, Lights)

//Group KidsRoom "Kids Room"  (Home)
  //  Switch KidsRoom_Light "Light" <light> (KidsRoom, Lights)
  //  Contact KidsRoom_Window "Window" <window> (KidsRoom, Windows)
  //  Switch KidsRoom_Fan "Fan" <fan_ceiling> (KidsRoom, Fans)
  //  Number KidsRoom_Temperature "Temperature" <temperature> (KidsRoom, Temperature)

//Group Lounge "Lounge" <sofa> (Home)
//    Switch Lounge_Light "Light" <light> (Lounge, Lights)
//    Switch Lounge_Fan "Fan" <fan_ceiling> (Lounge, Fans)
//    Number Lounge_Temperature "Temperature" <temperature> (Lounge, Temperature)

//Group Office "Office" <office> (Home)
//    Switch Office_Light "Light" <light> (Office, Lights)
//    Contact Office_Window "Window" <window> (Office, Windows)
//    Switch Office_Fan "Fan" <fan_ceiling> (Office, Fans)
//    Number Office_Temperature "Temperature" <temperature> (Office, Temperature)

//Group SecondBedroom "Second Bedroom" <bedroom_orange> (Home)
//    Switch SecondBedroom_Light "Light" <light> (SecondBedroom, Lights)
//    Contact SecondBedroom_Window "Window" <window> (SecondBedroom, Windows)
//    Switch SecondBedroom_Fan "Fan" <fan_ceiling> (SecondBedroom, Fans)

1 Like

open up a subscription to all topics using a shell command to check if the mqtt messages reach the broker at the correct topics when you toggle the switch from your OH2 sitemap:

mosquitto_sub -u openhabian -P Dxxxxxx -t '#'

(or use a tool like MQTT.fx etc to monitor the payload traffic to the broker)

looks ok
in theory, you don’t need to separate the on/off commands
cmnd/diana/cord1/power:command:*:default should cover both on and off

mosquitto_sub -u openhabian -P Dxxxxxx -t diana/cord1/cmnd/power

[00:36:33] openhabian@DianaHAB:~$ mosquitto_sub -u openhabian -P Dxxxx -t diana/cord1/cmnd/POWER
^C
[00:38:20] openhabian@DianaHAB:~$ mosquitto_sub -u openhabian -P Dxxxxx -t diana/cord1/cmnd/power
^C
[00:39:14] openhabian@DianaHAB:~$ mosquitto_sub -u openhabian -P Dxxxxxx -t diana/cord1/cmnd/power/"#"
^C
[00:39:57] openhabian@DianaHAB:~$ mosquitto_sub -u openhabian -P Dxxxxxxx -t cmnd/diana/cord1/cmnd/power/"#"

``
not receiving from Habpanel

I really wish that I had a Sonoff to be able to help more :slight_smile:
I am not 100% clear on the correct structure of the topics… you need to play around with config options to find the correct method

by the way: if you want to use a trigger and a transformation, it should be the other way around (I think):

the trigger should be ON and the transformation should be 1

{ mqtt=">[mosquitto:cmnd/diana/cord1/power:command:ON:1], >[mosquitto:cmnd/diana/cord1/power:command:OFF:0],

(ON and OFF triggers with capital letters)

keep the subscription command open at the top level topic (#) (means all) at the shell and then toggle the switch from your UI and check what shows up in the shell while leaving the subscription connected continuously