I have finally figured out a way for OpenHab to talk to my lighting system, now I need to have OpenHab listen to my lighting system as I want to insure that the buttons states are in sync with one another…if someone presses a wall dimmer switch I want OpenHab to show that the switch is ON.
My lighting control system “Vantage” will report button states via TCP, the same way I am talking to the system…
So if the system broadcasts
RGS 1 2 4 1/r
(fourth switch on master 1 of station 2 is ON)
I want to be able to update a switch in OpenHab as being on.
Do I write this as a rule or as something else? If the switch was called HALLWAY how would the syntax look?
When I click the switch, the lights come on and I can see a response from the Vantage lighting control system come back to OH. (FYI-The return code I mentioned in my previous post was incorrect…its not RGS, it’s SW) I see an error, stating that it could not find a mapping for the return code from Vantage. What’s strange is that it’s referencing the MAP file for the outbound connection, not the inbound connection.
As you can see in the ITEM above, the outbound mapping is done through 90.map while the inbound mapping should be done through m90.map. The m90.map file is in the same directory as 90.map yet it seems to be ignored.
Here’s a post from the log…the map file is highlighted in yellow.
I’ve no idea what is going wrong. Frankly, this is one reason why I tend to avoid Items with lots of binding configs. I usually set up separate Items, one for incoming and one for outgoing and a proxy switch. Then I use rules to keep everything in sync. It is a lot more code but it is way easier to troubleshoot problems.
// when the proxy receives a command, send it to the device
rule "HallwayProxy received command"
when
Item HallwayProxy received command
then
HallwayCommand.sendCommand(HallwayProxy.state)
end
// when the Update Item receives a command, update the Proxy
rule "HallwayUpdate received command"
when
Item HallwayUpdate received command
then
HallwayProxy.postUpdate(HallwayUpdate.state)
end
Put HallwayProxy on your sitemap and only use HallwayProxy in the rest of your rules.
Also you stated earlier “only use HallwayProxy in the rest of your rules” I’m not following you…are you stating to use that for all of the other lighting switches? Sorry just a bit lost.
Again thank you for the continued support. I apologize for taking some time to get back with you, but I was called to Rio to assist some of my broadcast collagues with a couple of technical challenges…
Back to OH…
I made the change you reccomended above to HallwayProxy.state.toString which eliminates the error message in designer - but I still am having an issue with OH processing the message that comes back from the Vantage system. For some strange reason it wants to apply the outbound mapping file and not the incomming mapping file.
When I review the log file or watch the output of the command window I see all of the inbound messaging from the Vantage system referencing the outbound map file (90.map) not the inbound map file (m90.map)
Just to make sure everything looks legit, here is my item file:
Add some logging to your rules just to see if there is somehow an interaction between the rules we are not accounting for.
It isn’t satisfactory, but try just using the one map file and put both sets of mappings in it and see if that works. That might fix the problem, though it won’t tell us why it is working wrong in the first place.
Are you sure the > and < are the right direction (I think they are but when it doesn’t work, question everything)?