I’m moving slowly forward with OpenHAB and MySensors. I’ve now got a lamp that I can control via the web UI. I use a Serial Gateway and when I toggle the slider switch on the Control page of the UI, the lamp turns on and off appropriately.
I’m now trying to add a remote switch for this. I’ve created another Arduino node with a push button switch. When booted, it appeared in the OpenHAB inbox as a light and I was able to link the ‘Status’ switch to my existing lamp.
If I press the physical button on my node, the sliders on the control screen update between on and off for both the lamp and remote switch things, but the relay does not trigger, and the lamp does not power on or off.
If I toggle either slider in the UI instead of using the physical button, then the lamp does turn on and off. And I can do this with either the remote switch or the lamp slider, and the lamp changes.
Any ideas what I may have done wrong here ? Or what I need to change to get the remote physical button to trigger the relay on the remote node instead of just updating the UI ?
Thanks!
EDIT - I see that this post has been hidden by the community. If anyone can advise what I’ve done wrong here, that would be much appreciated so that I can fix it and avoid the same problem in the future.
Where would I find my items and rules in a format suitable for posting here ? I’ve configured everything through Paper UI, so I’m not sure where to look for content.
I only have the 1 item (the lamp) and 3 things (serial gateway, lamp relay node and button node).
Here is the debug log for a working event (sliding toggle in UI):
17:29:01.996 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Lamp' received command ON
17:29:02.000 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 3 found in gateway
17:29:02.000 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 3 found in node 3
17:29:02.000 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 1 found in gateway
17:29:02.001 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 1 found in node 1
17:29:02.001 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 3;3;1;0;2;1
17:29:02.018 [INFO ] [marthome.event.ItemStateChangedEvent] - Lamp changed from OFF to ON
17:29:02.053 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;!TSP:MSG:SEND 0-0-3-3 s=3,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=fail:1
17:29:02.104 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 1;1;1;1;2;1
17:29:02.117 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=ok:1
17:29:02.130 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=2,pt=0,l=1,sg=0:1
17:29:02.131 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 1;1;1;1;2;1
17:29:02.132 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 1 found in gateway
17:29:02.132 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 1 found in node 1
17:29:02.133 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: status(V_STATUS) value to: ON
17:29:02.144 [DEBUG] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 1/1 to 2017-08-12T17:29:02.000+0100
17:29:02.206 [INFO ] [rsAbstractConnection$MySensorsWriter] - ACK received for message: 1;1;1;1;2;1
A failed event still puts entries in the logs, but not as many. This is triggered by pressing the button on a node,
17:29:52.399 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;TSP:MSG:READ 3-3-0 s=3,c=1,t=2,pt=1,l=1,sg=0:1
17:29:52.399 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 3;3;1;0;2;1
17:29:52.400 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 3 found in gateway
17:29:52.400 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 3 found in node 3
17:29:52.400 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: status(V_STATUS) value to: ON
17:29:52.401 [DEBUG] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 3/3 to 2017-08-12T17:29:52.000+0100
17:29:52.402 [INFO ] [marthome.event.ItemStateChangedEvent] - Lamp changed from OFF to ON
A gallery of configuration screenshots is at Gallery of screenshots - I can’t seem to post more than 3 links at my current user level.
The first item in the gallery shows the Lamp thing and its associated Status action. The second item is the Remote Switch thing and the third item is the Lamp item in edit mode.
Do I understand correctly that you have an Arduino with a relay that controls a lamp. That works well via Openhab but if you press a button on another Arduino the relay on that first Arduino does not work? Or is it on that same Arduino that you call a ‘remote node’ or is that too simple of a summary?
… does not trigger the relay on the firts Arduino, I presume
I do not know the mysensor binding very well, other than that it uses a wireless channel, also, I use item and sitemap files, where it is a bit more visible how things are connected, but will give it a try
I can break down the problem
Communication between Openhab and Lamp Arduino works as it should: Openhab sends a command to Lamp Arduino (lets call that downstream). Whether there is a message coming back I do not know but might not be necessary
Button Arduiino communicates upstream with OpenHab and that might be all that is necessary, but somehow the command that switches the slider/switch state does not send a command downstream again.
So, is there a difference between the command that determines the state of the Switch and the actual command that should go out from the Switch?
Somehow it seems to me that the button Arduino is just updating a status on openhab, rather than triggering a downstream command to lamp arduino. I do not have enough insight in your programming nor in the mysensor link to know what is going wrong there but Rich earlier suggestion might be what is happening.
With that I might be just stating what is obvious, but I suggest that is where you focus attention
Thanks for the feedback. That’s my understanding of what’s happening - OpenHab is getting the instruction, because the toggle is moving, but the lamp isn’t being told to change. That’s supported by the difference in the debug log instructions too.
Where I’m lost though is with regards to how to make OpenHab send that instruction to the lamp node.
Which UI should I be using to do setup through items and sitemap files ? I’d like to try and test using that and get things a bit more ‘describable’. EDIT - ah, looks like Basic UI. I’ll see if I can get something setup there.
I apologize that apparently i have not been abloe to do more than summarize your problem.
For working with items and sitemap files I do not use any of UI’s, just an editor, though I still use the paper UI to install Add ons.
Whether he Basic UI gives you a possibility I am not sure, I just use that for monitoring, but you can try
Do you have any idea why my post may have been flagged by the community? I’d like to avoid making the same mistake in the future.
Ah - I didn’t realise that I’d be able to do that with the Paper UI. What screen do you use to control your devices / things ? I’ve created a sitemap in the past, but couldn’t work out what screen to go to in the paper UI to see it.
it may have to do with your link, that was actually linking to a couple of totally unrelated pages as well
To install addons in the paper UI I just go to “AddOns” in the left most column. That opens a screen in which you can opt for actions and bindings and stuff to add.
You cannot see your sitemap in the paper UI, but you can see it in the basic and classic UI
Automatic spam detection kicked in here. It said “This new user tried to create multiple posts with links to the same domain (i.imgur.com).” - I have just approved all your posts, so they should be visible again!
No need to be careful - this only happens for new users; once you have a few posts and likes here in the community, there should be no risk anymore - so feel welcome and have fun
For now, I’m going to hack a solution and come back to this later. I’ve just modified the switch to talk directly to the relay node, and that lets me control the lamp both from my switch and the UI.
I’m now adding some code to the relay node to keep the UI up-to-date with the true state of the switch when it changes via the physical button.