ESP 8266 MQTT - dosen't work in OpenHAB - help needed


#1

Hi there
I have small question. Since I’m making my first sonoff basic mqtt switch
I followed each step of MK guide (tnx to MF for it btw). But I can’t controll it from my openhab2
I see command in mqtt fx - like he showed on video.

My broker deteils:
MQTT Broker ONLINE
MQTT Broker
mqtt:broker:MQTT_Broker
I have set the same login and password which I use for SSH login to openhabian.

My .items file:
//Sonoff Basic 1
Switch SonoffBasic1 “Lampa D” [ “Switchable” ] {mqtt=">[broker:cmnd/sonoffbasic1/POWER1:command::default],<[broker:stat/sonoffbasic1/POWER1:state:default]", autoupdate=“false”}
Switch SonoffBasic1LED {mqtt=">[broker:cmnd/sonoffbasic1/POWER2:command:
:default],<[broker:stat/sonoffbasic1/POWER2:state:default]", autoupdate=“false”}
home.rules:
//This is the rules file

//Sonoff LED Button
rule “SonoffBasic1 LED”
when
Item SonoffBasic1 changed
then
if(SonoffBasic1.state == ON)
{
sendCommand(SonoffBasic1LED, ON)
}
else if(SonoffBasic1.state == OFF)
{
sendCommand(SonoffBasic1LED, OFF)
}
end
home.sitemap:
// This is the sitemap file
sitemap home label=“Mieszkanie”
{
Frame label=“Sonoff”
{
Switch item=SonoffBasic1
}
}

Wifi name = SonoffBasic1 (changed once)
mqtt name: sonoffbasic1
I’m getting errors as follow:
2019-02-13 19:57:31.450 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘MKSonoffBasic1’ for widget org.eclipse.smarthome.model.sitemap.Switch

2019-02-13 19:57:31.451 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

2019-02-13 19:57:31.451 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘MKSonoffBasic1’ for widget org.eclipse.smarthome.model.sitemap.Switch

2019-02-13 19:57:31.452 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘MKSonoffBasic1’ for widget org.eclipse.smarthome.model.sitemap.Switch

2019-02-13 19:57:31.452 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘MKSonoffBasic1’ for widget org.eclipse.smarthome.model.sitemap.Switch
PS: I didnt set password on mosquito installation

Shall I change “broker” in items code to the address of my broker “mqtt:broker:MQTT_Broker” or it’s name?
Log after I change switch in Basic UI - just one line

2019-02-14 13:31:01.584 [ome.event.ItemCommandEvent] - Item ‘SonoffBasic1’ received command ON

and in debug mode log:
Debug LOG

I’m begginer in openHAB - please be gentle

Best regards from Poland
quarku


#2

I have switch to AFE Firmware and it works ok now.