I’m setting up a new HA system and currently have 2 dimmers working through openHAB on a raspberry pi 3 with the Aeon Z-wave stick. I don’t have any rule / scenes setup yet.
I purchased an Aeon Minimote and would like to be able to use it to control the lights. Prior to setting up OpenHAB on the Raspberry Pi, I was able to bind the minimote to the switches directly, but this isn’t quite what I’d like to be able to do.
I’d like the OpenHAB system to be able to receive a button press command from the minimote and then do something based on that. Ideally, I’d like button 1 to toggle on/off one of the switches and button 2 to toggle on/off the other switch. I’d reserve the other two buttons for other items later.
Do I pair the minimote with the Z-stick in this scenario? If so, do I have to pair each button individually? Would I need to create an item for the minimote?
What type of rule would I create to turn the lights on and off?
I’ve done some google searching for this, but haven’t found the answers to these basic questions. Most of the issues I’ve read on were problems that seemed far more sophisticated than what I’m trying to do.
Thanks again for the pointers here. I think I’ve done most of this correctly, but my extremely basic setup doesn’t seem to be working.
It seems to appear that my rules aren’t being run, although I’m not entirely sure.
I’ve been able to see in the events.log file an entry when I push the minimotes buttons. I get a “DEN_REMOTE_S state updated to ON” when I push or long push any of the buttons.
I tried to tie a rule to this, but didn’t get any responses. Then I tried to create a simple rule to see if I could get a rule to do anything. It didn’t seem like the rule was running.
I changed my rule file to only include the following rule:
rule "See if rules are running"
Time cron "0 * * * * ?"
logInfo(“timer”,“the timer cron was hit”)
In my openhab.log, I get the following message indicating it is refreshing the script, but the rule never runs.
2016-05-18 03:02:26.782 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model ‘home.script’
Sorry about the confusion here. I had the rules in the script directory. I moved the file into the rules directory (I didn’t have one and had to create one) and renamed it home.rules and the cron based rule started working.
It still isn’t recognizing the Item based rule, but I’m working on it.
Each time you press a remote button, it flips the associated scene button to ON. But without a rule to turn those switches back off, you’ll only ever get that one event for each button. (It’s difficult to turn a switch ON that’s already on!)
That’s why I have that “turn off any bedroom remote scene button” rule. The idea is when any of the scene switches get turned on by the remote, I want to immediately turn them back off again so they’re ready for the next time I hit a remote button.
Finally, you’ll need another rule to actually do actual useful “stuff” that triggers off the same button getting turned on. So in addition to that giant ‘turn everything off’ rule, I have another rule for turning on my bedroom lamp:
rule "Bedroom lamp on scene"
// only process on a switch on state
Item BEDROOM_REMOTE_1_S3 received update ON or
Item BEDROOM_REMOTE_2_S3 received update ON
logInfo("openhab","Bedroom lamp on scene activated.")
I have two aeon remotes, bedroom remote 1 and bedroom remote 2, so when you tap button 2 on either one, it turns the lamp on. Separately (and concurrently), the ‘turn everything off’ rule flips that button’s switch back to off.
[You could combine the turn off the button rule with the do useful stuff rule, but I like to separate them out so there’s no chance the turn everything off function gets bombed by a bad rule elsewhere. I find it a lot more tidy that way, plus no forgetting to do it in your main rule that way!]
I added rules to turn them back off, but those rules were also only activated when button was pressed and the “changed to ON” condition was met. Given it was already set to “ON”, that rule wasn’t running either.
I went to the web page, navigated to the place where the remote buttons were set and manually turned them off (I’m sure there were other ways of doing this). It then started to work (well, part of it). I saw my rule being activated with a minimote button press, along with the rule to change the button back to OFF.
I guess I could have just restarted openHAB, but either way, it seems to be registering the button presses in the rules now.
I still don’t have the light turning on or off yet. While the rule is being activated and the log command in the rule is sending text to the log file, the sendCommand(Den_Light, ON) isn’t turning the light on. My rule is almost identical to the one you have, except I only have one “when” condition due to only having one minimote (for now).
The light is a GE 12724 dimmer and is setup with the z-wave command=SWITCH_MULTILEVEL definition in the items file. It turns on just fine directly through the web interface, but not through the rule. I’ve read I can set it to a percentage (sendCommand(DenLight,100) or sendCommand(DenLight,80)), but those wont ramp this switch to that value - it will just set it there directly. (I haven’t tried these yet).
Right now, I just want On/Off control of the light. I would have assumed sendCommand(Den_Light,ON) and sendCommand(Den_Light,OFF) would work.
Me too. The only suggestion I can offer is to try using Den_Light.sendCommand(ON) instead of the sendCommand actions. The sendCommand method on the Item tends to work a little better. I honestly don’t think it will help much in this case but it is a really easy thing to try.
Thanks. I was about to try the Den_Light.sendCommand(ON), but was able to get it working without that.
I just recently got it working. I changed the sendCommand to sendCommand(Den_Light,100) to turn it on to 100%. That was able to turn the light on. Once I had that working, I put the command back to sendCommand(Den_Light,ON). Surprisingly enough, that also worked. While I don’t have revision control on the files, I’m pretty sure those are the only changes I made to get it to work.
I don’t have any good reason why it didn’t work yesterday.
So, thank you again for all the help. I know have the minimote working such that a button press will turn lights on and a long button press will turn them off. I have that on 2 dimmers now.
There are times where restarting openHAB (/etc/init.d/openhab restart) and other times when cycling the power on the raspberry pi seems to help things back to a normal state.
Is there a better way of syncing things up after you make item/rule/config changes?
If you use persistence with restoreOnStartup all of your Items should get initialized to whatever state they were when OH was stopped or the configs were reloaded. As for fixing problems with a restart, that points to perhaps a hardware problem or an OS problem. I’ve not read of others reporting a similar issue.
By default, OH will scan all your items, rules, etc. every ten seconds for changes. So you should never need to restart OH in order to get it to see new rules or items; just hang out for a bit and you should see OH load the new whatever in the OpenHAB.log file. (If that’s not true, that’s an issue you should not ignore and should take the time to fix now before you go much further.)
Secondly, restarting zwave is not a pain free operation. There is a lot of radio traffic when the zwave binding starts up where it goes out and queries each device on the network, blah blah blah etc. Point is during that startup phase zwave can get laggy even though it doesn’t appear as though anything is going on. Point is I expect weird laggy-ness on zwave (I have a big network) for up to five minutes when restarting OpenHAB. So I really avoid doing it whenever possible unless I have a damn good reason to do so.
Finally, I have some of those GE dimmers. You would do well to add polling to them. They do not send status updates when operated locally (big reason why I’m not a fan of them), so periodic polling is the only way to keep OH in sync with the device’s status when operated locally. (And even then it’s only on a delayed basis.)
Looks like I might need to learn some patience (that might be the hardest part of all this home automation!). Thanks for the info on the Z-wave devices and OH.
I’m starting out pretty small here, primarily to learn about openHAB, various protocols, hardware, etc. I’m just starting with 2 switches and will slowly expand.
It’s been a learning curve compared to the X-10 automation I worked on in the early 2000’s.
By the way, what dimmers do you like the best? I’m reading various posts on them - all of which have pros and cons.
Ahh, well if you’re coming from x10 then you’re in for a treat - zwave works much better! I had a decent amount of x10 stuff but eventually blackballed it because while it worked, its reliability was never great for me even despite moving to different houses. But the cheap guy in me said that I had to use it until it broke, and unfortunately what x10 didn’t have in reliability it made up for with robustness.
And don’t get me wrong, the GE dimmers work just fine I just don’t think they’re a great value for the money considering they’re just zwave and don’t do instant status. I.e. I’m not ripping then out, but I’m not buying any more, either.
The dimmer I really like is the HomeSeer HS-WD100+ (which appears to be an OEMed DragonTech dimmer). It does instant status so if you push the button on the wall it updates OH instantly, it’s z wave+ so if your controller is zw+ then you get faster message speed and range, and it also supports double and triple taps for scene activation. (scene activation I need to get with @chris to get working, needs another message type added to the zwave binding, just haven’t gotten around to it yet.)