I thought I’d successfully moved from mqtt binding 1.x to 2.x…but, I was wrong.
At this point I can publish mqtt, but I don’t receive.
.thing file:
Bridge mqtt:broker:redpi_mqtt_broker [ host="192.168.53.105", secure="AUTO", username="***", password="****" ]
{
Thing topic drivesensor "Driveway Motion Detector" {
Channels:
Type number : DrvMotNum "Drive Motion Num Channel" [ stateTopic="driveway/motion"]
Type string : DrvMotStr "Drive Motion Str Channel" [ stateTopic="driveway/stringtest"]
}
Thing topic thermostat1 "Thermostat 1" {
Channels:
Type string : temperature1 "Temperature One" [ stateTopic="tstat1/temperature"]
Type string : setpoint "Set point" [ commandTopic="tstat1/setpoint"]
Type string : humidity1 "Humidity One" [ stateTopic="tstat1/humidity"]
Type string : request "tstat request" [ stateTopic="tstat1/request"]
}
}
.items file:
Number mqtt_drive_motion "Motion sense in driveway! [%.1f]" {channel="mqtt:topic:redpi_mqtt_broker:drivesensor:DrvMotNum"}
String mqtt_test "Mqtt test [%s]" {channel="mqtt:topic:redpi_mqtt_broker:drivesensor:DrvMotStr"}
String mqtt_tstat1_temp "[%s]" {channel="mqtt:topic:redpi_mqtt_broker:thermostat1:temperature1"}
String mqtt_tstat1_humidity "[%s]" {channel="mqtt:topic:redpi_mqtt_broker:thermostat1:humidity1"}
String mqtt_tstat1_setpoint "[%s]" {channel="mqtt:topic:redpi_mqtt_broker:thermostat1:setpoint"}
String mqtt_tstat1_request "[%s]" {channel="mqtt:topic:redpi_mqtt_broker:thermostat1:request"}
This rule triggers on the White_Puck and mqtt__tstat1_setpoint (these are widgets in habpanel for example). But, when I publish “tstat1/request” with a topic of setpoint, it doesn’t
rule "update tstat1"
when
Item White_Puck_10 changed from "NULL" to "ON" or
Item White_Puck_10 changed from "OFF" to "ON" or
Item mqtt_tstat1_setpoint changed or
Item mqtt_tstat1_request changed to "setpoint"
//Time cron "0 * * ? * * *"
then
val actions = getActions("mqtt","mqtt:broker:redpi_mqtt_broker")
logInfo("tstat1", mqtt_tstat1_setpoint.state.toString)
actions.publishMQTT("tstat1/setpoint", mqtt_tstat1_setpoint.state.toString)
end
Same with the inbound drive sensor publish for DrvMotStr…
Why are you using the action, You have a channel set-up…
rule "update tstat1"
when
Item White_Puck_10 changed from "NULL" to "ON" or
Item White_Puck_10 changed from "OFF" to "ON" or
Item mqtt_tstat1_setpoint changed or
Item mqtt_tstat1_request changed to "setpoint"
//Time cron "0 * * ? * * *"
then
logInfo("tstat1", mqtt_tstat1_setpoint.state.toString)
mqtt_tstat1_setpoint.sendCommand(mqtt_tstat1_setpoint.state.toString)
end
Side note, it appears, that after restarting OH, things are working. (And, it appears, every time I save changes to the .things file containing the bridge, I need to restart OH. Is this normal? Or am I not seeing what I think I’m seeing? very possible )
Thanks, I usually catch stuff like that…, my firewall is pretty good…but, no sense pushing my luck.
Well, in addition to feeling like files let me understand what I’ve got better (and that could just be me… ), when I started using OH, I got tired of “oh, that works better in BasicUI”, and “this works better in PaperUI”, and “that doesn’t work in that UI at all”.
And, are you saying it was corrected in snapshot for in the UI, but not for file updates?
Channels do not seem to work, I am with the official binding.
I rely on config files, because they make it much easier to rebuild my environment in case of failure. I can just copy/paste the .items .thing file and I am done.
But also for me I get inconsistent error messages and the channel mapping does not seem to work. Maybe it is because I am using 2.x and 1.x of MQTT at the same time.
I think I’ll just give up for now and “never change a running system”
By snapshot - do you meen the.jar of the MQTT binding or the latest openhab snapshot release?
That’s a separate bug then. Do you have any error messages in the log that could help fix that issue?
The snapshot that is available via the repositories. No jars. It’s just that snapshots are bit broken because of the merge of Eclipse Smarthome with openHAB that is currently going on.
When I save the .thing file there is nothing out of the ordinary. It reports the update, no errors. But, then no subscribed publish from elsewhere triggers any of my rules.
If I stop/start OH (this 2.5 snapshot on a Pi) then all mqtt in and out work fine. Another note is, the mqtt broker is not running in OH or on the OH Pi. The broker is a mosquito broker on separate PI.
(probably not related, but I did see a block of eclipse related errors the first time I started OH after update to the snapshot.)