- Platform information:
- openHABian
- openHAB 2.4
I am trying to setup a connection between two openHABs (home and office) with the aim to be able to remotely control the thermostat in my office from an item on my home sitemap. But I am running into problems that I’ve been trying to solve since days now. I hope someone can help me!
My setup so far:
- I’ve installed the new MQTT binding on both openHABs, plus on the one at home, I’ve installed the Embedded MQTT Broker.
- On both openHABs, I’ve added an MQTT Broker, both connecting to the Embedded Broker at home.
- On both openHABs, I’ve added a Generic MQTT Thing, using the previously added MQTT Broker as their bridges.
- On the Generic MQTT Things, I’ve added a channel, with the state of the one being the command of the other. Looks like that:
Thing mqtt:topic:084b7bfa:officeWallthermostat "MQTT New Office Wall Thermostat"
(mqtt:broker:084b7bfa) @ "Office"
{
Channels:
Type number : set_temp "Set Temperature"
[
stateTopic = "generic/test/wallthermostat/setTemp/state",
commandTopic = "generic/test/wallthermostat/setTemp/command"
]
}
On the other openHAB, state and command are reversed like this:
stateTopic = "generic/test/wallthermostat/setTemp/command",
commandTopic = "generic/test/wallthermostat/setTemp/state"
(Note that I played around with both PaperUI as well as configuration files, but the results are identical.)
Ob both ends, I then created an Item from these channels.
Now what works is that I can change the temperature on one side and the other Item follows almost instantly, and that works in both directions (tested in PaperUI > Control). If the state changes on one end, the new value gets send as a command to the other end. Seems perfect. Not sure, if this is the intended way to do it, though? But I couldn’t get it to work unless I reversed the topics.
As my next step, I’ve tried to connect the Item on the office OpenHAB with the real world thermostat Thing by adding the thermostat’s channel to the Item like so:
Number OfficeThermostat_SetTemperature "Office Set Temperature" (gOfficeThermostat) [ "TargetTemperature" ] {channel="max:wallthermostat:XEQ1633453:XKF0042762:set_temp", "channel="mqtt:topic:ca454cfb:set_temp"}
The problem I’m now having is that it does not update in all directions. I’ve played with the follow profile, but there’s always one direction that stops working:
- Leaving all at profile default: when updating the thermostat, the local openHAB item gets updated, but not the remote one
- Setting the MQ channel link to follow: changing the remote item updates neither the local item nor the thermostat itself
- Setting the thermostat channel link to follow: changes at the thermostat are not reflected in the items
- Setting both channel links to follow: changes at the thermostat as well as changes at the remote item do not propagate
The closest I can get is with both channel links set to default. Then everything works expect that changes a the thermostat are reflected in the local item, but do not propagate over MQ to the remote item. Any ideas?
One problem I have is that I’not sure what the follow profile actually does. The docs state:
The term “follow” in this case means that any state that is sent to an Item will be forwarded from this Item to any linked Channel with the
follow
Profile. It takes state updates on an Item and sends them as a command onto the Channel.
From that, I understand and would expect that when I link the MQTT items with profile follow, I change of state in one would send the new value as a command to the other, but that doesn’t seem to happen. With log level debug, I see:
2019-01-31 16:21:21.622 [DEBUG] [nal.handler.AbstractMQTTThingHandler] - Successfully published value 24.0 to topic generic/test/office/setTemperature/state
So the value is published as a new state, but not as a command. That’s why I finally reversed the state and the command topics between the two MQTT channels to make it work.
However, I admit I don’t understand what this says:
In the direction from the ThingHandler towards the Item, this Profile ignores state updates.
What does “in the direction from the ThingHandler” mean? Are these state updates from the physical device (like when I change the temperature at the thermostat itself)?
Btw, I also wondner why I get these log lines:
2019-01-31 16:19:00.342 [TRACE] [.MqttChannelStateDescriptionProvider] - Providing state description for channel max:bridge:NEQ1633453:free_mem
What is providing a state description to what (and what is a state description)? But that’s probably something different.
I would appreciate if someone could tell me if my approach is completely wrong? And give me some hint how to proceed?
Thanks for reading until here!