[SOLVED] Question about rebuilding my OH2

I am using HomeBuilder to setup my OH2 this time around so I get everything laid out how I want it and coded correctly. I am to the point where I think I need to add my MQTT code to make the connections to my Things work. At the end of the line below, it has {channel=""}. I’m assuming this is where I put the code for the MQTT connection?

Switch          MF_Office_Light            "Light"            <light>              (MF_Office, gLight)            ["Lighting", "Switchable"]   {channel=""}

I know I have asked this type of question before and I have been reading more about this. I just want to make sure I’m heading in the right direction.

Thanks

John Frankforther

This is where you put the name of the channel provided by the MQTT thing

I think this is where I ended up failing the last several times I got to this point. Maybe if I show what data I am using maybe I can be pointed in the right direction. Here is the information I’m getting from the Office_Light module:

00:00:00 Project sonoff Office_Light Version 6.4.1(sensors)-2_4_2
00:00:11 WIF: Connected
00:00:11 DNS: Initialized
00:00:11 HTP: Web server active on Office_Light-7724.local with IP address XXX.XXX.XXX.XXX
21:57:38 MQT: Attempting connection...
21:57:38 MQT: Connected
21:57:38 MQT: tele/Office_Light/LWT = Online (retained)
21:57:38 MQT: cmnd/Office_Light/POWER = 
21:57:38 MQT: tele/Office_Light/INFO1 = {"Module":"Generic","Version":"6.4.1(sensors)","FallbackTopic":"cmnd/OL01_fb/","GroupTopic":"sonoffs"}
21:57:38 MQT: tele/Office_Light/INFO2 = {"WebServerMode":"Admin","Hostname":"Office_Light-7724","IPAddress":"XXX.XXX.XXX.XXX"}
21:57:38 MQT: stat/Office_Light/RESULT = {"POWER":"OFF"}
21:57:38 MQT: stat/Office_Light/POWER = OFF
22:03:08 MQT: stat/Office_Light/RESULT = {"POWER":"ON"}
22:03:08 MQT: stat/Office_Light/POWER = ON
22:03:10 MQT: stat/Office_Light/RESULT = {"POWER":"OFF"}
22:03:10 MQT: stat/Office_Light/POWER = OFF

When I go to set up the channel in the Paper UI

I add the channel as an On/Off Switch
Channel ID is OL01
Under channel Configuration
MQTT state topic is: stat/Office_Light/POWER
The MQTT command topic is cmnd/Office_Light/POWER,

At this point I don’t know what to put in the Incoming value transformation and the Outgoing value format. If I leave them blank, the relay turns on and off when I click the switch on the Basic UI screen with no errors in the Log file.

Also in the Items file, I did not enter anything for the channel="" statement. I am unsure if this is the correct way to make this work even though it does work.
Thoughts??

John Frankforther

Nothing is needed in these

You can copy the channel name from the paperUI:

image

Click on the two little squares to copy the channel to the clipboard
And then paste is in you item config:

Switch               LargeBedroom_RadiatorValve            "Large Bedroom Radiator [%s]"                  <radiator>    (LargeBedroom, Radiators, MQTTv2)                                                                                      { channel="mqtt:topic:LargeBedroomRadiatorValve:OnOff" }

Thank you Vince!! My errors were coming from the text I was putting in the two places in the channel setup in the Paper UI. I guess I was making it harder that it actually was to set up. As I move on to the temperature and humidity sensor, I’m guessing I can do the same thing?

John Frankforther

Yep, you got it!!

Please mark the thread as solved, thanks