These warnings are from Z-Wave related logs (they are fine, don’t worry :))
Check for MQTT related logs
Did you put your new items in your sitemap? Do they show now the Temp & Humidity values as they come in from the sonoff?
no ther is not temp & humidity on the sitemap from the sonoff my
sitemap code
Frame label="Thermostat" {
Text item=Thermostat_Danfoss_Stue2 label="Thermostat Stue ved Dør [%s °C]" icon="temperature"
Text item=Thermostat_Danfoss_Kokken label="Thermostat Køkken [%s °C]" icon="temperature"
Text item=Thermostat_Danfoss_Nicolai label="Thermostat Nicolai [%s °C]" icon="temperature"
Text item=Thermostat_Danfoss_Annebell label="Thermostat Annebell [%s °C]" icon="temperature"
Text item=Thermostat_Danfoss_Sovevaerelse label="Thermostat Soveværelse [%s °C]" icon="temperature"
Text item=Temprature_Multisensor_Sovevaerelse label="Temperatur Soveværelse [%s °C]" icon="temperature"
Text item=Temperature_Vaerksted label="Værksted temperature [%s °C]" icon="temperature"
Text item=Humidity_Vaerksted label="Værksted Humidity [%.1f %%]" icon="climate"
and pic from sitemap
Ok…
Since sonoff is publishing correctly the messages to your Mosquitto MQTT Broker, you need to focus on the Mosquitto to openHAB connection and item configuration.
Troubleshoot first the main connection between MQTT and OH2.
You will need to use the openHAB console for this.
To enter into the console, from an ssh shell (prompt: pi@openHABianPi:~$
) in your rPi type:
sudo ssh openhab@localhost -p 8101
Enter the password: habopen
Set log levels:
log:set TRACE org.openhab.binding.mqtt
log:set TRACE org.openhab.io.transport.mqtt
restart the MQTT Binding:
bundle:restart org.openhab.binding.mqtt
Check logs for connection messages of the following kind:
==> openhab.log <==
2017-02-12 22:53:15.437 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STOPPING - org.openhab.binding.mqtt
2017-02-12 22:53:15.439 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent UNREGISTERING - {org.osgi.service.event.EventHandler}={event.topics=openhab/*, component.name=org.openhab.binding.mqtt.MqttItemBinding, component.id=201, service.id=343, service.bundleid=195, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 22:53:15.441 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent UNREGISTERING - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/*, service.pid=org.openhab.mqtt-eventbus, component.name=org.openhab.binding.mqtt.eventbus, component.id=202, service.id=341, service.bundleid=195, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 22:53:15.444 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent UNREGISTERING - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqtt.MqttBindingProvider}={component.name=org.openhab.binding.mqtt.genericbindingprovider, component.id=203, service.id=342, service.bundleid=195, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 22:53:15.445 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been stopped.
2017-02-12 22:53:15.445 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STOPPED - org.openhab.binding.mqtt
2017-02-12 22:53:15.446 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STARTING - org.openhab.binding.mqtt
2017-02-12 22:53:15.447 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been started.
2017-02-12 22:53:15.447 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STARTED - org.openhab.binding.mqtt
2017-02-12 22:53:15.454 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/*, service.pid=org.openhab.mqtt-eventbus, component.name=org.openhab.binding.mqtt.eventbus, component.id=205, service.id=345, service.bundleid=195, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 22:53:15.457 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqtt.MqttBindingProvider}={component.name=org.openhab.binding.mqtt.genericbindingprovider, component.id=206, service.id=346, service.bundleid=195, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 22:53:15.458 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={event.topics=openhab/*, component.name=org.openhab.binding.mqtt.MqttItemBinding, component.id=204, service.id=348, service.bundleid=195, service.scope=bundle} - org.openhab.binding.mqtt
like this
2017-02-12 21:57:03.229 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STOPPING - org.openhab.binding.mqtt
2017-02-12 21:57:03.246 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent UNREGISTERING - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/*, service.pid=org.openhab.mqtt-eventbus, component.name=org.openhab.binding.mqtt.eventbus, component.id=253, service.id=417, service.bundleid=266, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 21:57:03.280 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent UNREGISTERING - {org.osgi.service.event.EventHandler}={event.topics=openhab/*, component.name=org.openhab.binding.mqtt.MqttItemBinding, component.id=254, service.id=420, service.bundleid=266, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 21:57:03.302 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent UNREGISTERING - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqtt.MqttBindingProvider}={component.name=org.openhab.binding.mqtt.genericbindingprovider, component.id=255, service.id=418, service.bundleid=266, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 21:57:03.333 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been stopped.
2017-02-12 21:57:03.335 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STOPPED - org.openhab.binding.mqtt
2017-02-12 21:57:03.340 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STARTING - org.openhab.binding.mqtt
2017-02-12 21:57:03.342 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been started.
2017-02-12 21:57:03.345 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STARTED - org.openhab.binding.mqtt
2017-02-12 21:57:03.404 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/*, service.pid=org.openhab.mqtt-eventbus, component.name=org.openhab.binding.mqtt.eventbus, component.id=258, service.id=423, service.bundleid=266, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 21:57:03.410 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - MQTT: Activating event bus binding.
2017-02-12 21:57:03.415 [TRACE] [ng.mqtt.internal.MqttEventBusBinding] - No mqtt-eventbus properties configured.
2017-02-12 21:57:03.433 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqtt.MqttBindingProvider}={component.name=org.openhab.binding.mqtt.genericbindingprovider, component.id=260, service.id=424, service.bundleid=266, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 21:57:03.440 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={event.topics=openhab/*, component.name=org.openhab.binding.mqtt.MqttItemBinding, component.id=259, service.id=425, service.bundleid=266, service.scope=bundle} - org.openhab.binding.mqtt
2017-02-12 21:57:03.458 [TRACE] [.internal.MqttGenericBindingProvider] - Starting to load MQTT config for item Temperature_Vaerksted
2017-02-12 21:57:03.459 [DEBUG] [binding.mqtt.internal.MqttItemConfig] - Loaded MQTT config for item 'Temperature_Vaerksted' : 1 subscribers, 0 publishers
2017-02-12 21:57:03.460 [TRACE] [.internal.MqttGenericBindingProvider] - Starting to load MQTT config for item Humidity_Vaerksted
2017-02-12 21:57:03.461 [DEBUG] [binding.mqtt.internal.MqttItemConfig] - Loaded MQTT config for item 'Humidity_Vaerksted' : 1 subscribers, 0 publishers
2017-02-12 21:57:03.462 [TRACE] [.internal.MqttGenericBindingProvider] - Starting to load MQTT config for item Varme_Vaerksted
2017-02-12 21:57:03.463 [DEBUG] [binding.mqtt.internal.MqttItemConfig] - Loaded MQTT config for item 'Varme_Vaerksted' : 2 subscribers, 0 publishers
looks good
now from the openHAB console, check the State of the 2 items:
smarthome:items list Temperature_Vaerksted
smarthome:items list Humidity_Vaerksted
What is the output?
State=NULL means that the items haven’t received any updates with values from their binding
You need to focus now on your items configuration… something is not working there…
Strange… from the configs that I have seen so far, it should have worked…
Manually publish a value to the MQTT topic that your item is bound to:
With item definition:
Number Temperature_Vaerksted "Temperatur værksted [%s %%]" <temperature> { mqtt="<[mybroker:/Sonoffth1/Temp_Vaerksted/Temperature:state:default]" }
Push a message to MQTT:
mosquitto_pub -u openhab -P habopen -t /Sonoffth1/Temp_Vaerksted/Temperature -m 99
and check again the status of the item (if it became 99) smarthome:items list Temperature_Vaerksted
when i use
mosquitto_pub -u openhab -P habopen -t /Sonoffth1/Temp_Vaerksted/Temperature -m 99
it stil stat=NULL
argggg
Question: Have you installed the Add-on: MQTT Action?
If yes: Uninstall it, restart OH2 and check again
yes i have and now uninstalled and oh2 reboot but still state=NULL
if i publish this /Sonoffth1/Temp_Vaerksted/Temperature 96.00 from mqttfx
i get this /Sonoffth1/Temp_Vaerksted/Temperature 96.00 (null)
and the sonoff is publish this /Sonoffth1/Temp_Vaerksted/Temperature 10.40
but still state=NULL
Change the following in your /etc/openhab2/services/mqtt.cfg
mybroker.url=tcp://127.0.0.1:1883
mybroker.clientId=OH2
I replicated your setup in one of my test systems and all work fine…
item:
Number Temperature_Test "Temperature Test [%s %%]" <temperature> {mqtt="<[mybroker:/Sonoffth1/Temp_Test/Temperature:state:default]"}
sitemap:
sitemap mqtt label="MQTT Test" {
Frame {
Text item=Temperature_Test label="Test temperature [%s °C]" icon="temperature"
}
}
mqtt.cfg:
mybroker.url=tcp://127.0.0.1:1883
mybroker.clientId=rPi3
mybroker.user=openhab
mybroker.pwd=habopen
mybroker.qos=0
mybroker.retain=false
mybroker.async=true
All work fine and when I send:
mosquitto_pub -u openhab -P habopen -t /Sonoffth1/Temp_Test/Temperature -m 95
I get:
==> openhab.log <==
2017-02-13 00:12:58.389 [TRACE] [t.mqtt.internal.MqttBrokerConnection] - Received message on topic '/Sonoffth1/Temp_Test/Temperature' : 95
==> events.log <==
2017-02-13 00:12:58.438 [ItemStateChangedEvent ] - Temperature_Test changed from NULL to 95
Try also:
delete the file /var/lib/openhab2/config/org/openhab/mqtt.config
and restart OH2
Happy happy me it is working you are my herro tanks again
what was wrong? (maybe stale configs stored in the /var/lib/openhab2/config/org/openhab/mqtt.config
file?)
I deletet the mqqt.config file and it is working
Yeah… unfortunately this happens sometimes…
This is because when you edit /etc/openhab2/services/mqtt.cfg
file you may put some settings there that are kept in openHAB (and stored in /var/lib/openhab2/config/org/openhab/mqtt.config
)
When you change the mqtt.cfg file and create new settings, the old ones are not removed from mqtt.config and this can cause problems…
Anyway… good luck with your next steps in developing your openHAB 2 environment
I think that you know some more about MQTT now, so you could also help others when they get stuck (this is how the community grows
I think this is a major bug.
Is this documented already?