Is there a way to send z-wave config commands by rule?

In Habmin I can send config parameters to a z-wave device. Is there a way to send this via rule command too?

For example to calibrate roller shutter I have to set parameter 29 to 1. Can this be done by a rule too?

If it isn’t exposed as a Thing or a Channel on a Thing there is nothing you can do from a Rule.

Would it not be possible to do this from a rule by using the REST API to do a HTTP PUT to the thing config URL with the proper payload for the parameter/value you wish to set.

For example:

http://localhost:8080/rest/things/<<thing uid>>/config

with a payload such as this (obviously replacing the payload with the config element and value you wish to set.

{"config_1_1":3}

Possible, I suppose, but a lot of work for something that could be done much more simply through Paper UI and/or HABmin.

I guess some configuration could be exposed as a channel. I remember the fibaro wall plug ring color was exposed in order to programmatically set it instead of via config. In this case you would have to add the channel in the zwave db.

@chris could probably say if this is a good idea.

/s

So… It could be done. We could add a channel to do this. But we need to ask if it’s really needed. In general, I think that users don’t use this (right?) and so we should keep the user world and the admin world separate.

We can of course keep adding channels, but we end up with many channels if we’re not careful and it just causes confusion (IMHO). Just because you can do something, doesn’t (IMHO again!) mean that you should do it! :wink: .

If you decide to add it as a channel, please do it AFTER you put in the code to only poll the channels that are linked to items. :wink:

I think that’s already implemented (if I remember correctly).

In the dev version, or in the snapshot version (or both)?

Probably just the dev version (I just checked, and definitely the dev version - I suspect not the snapshot but I didn’t check).

Pretty sure it’s not in the snapshot version (but I haven’t looked to know for sure). Last time I looked at the log files, I recall seeing a lot more polls than I have items.

Yep - I’m reasonably sure that will be right. These sorts of changes I’ve typically only added in the dev version unless someone specifically asks for something.

I wanted to see if there was an answer to this.

I want to be able to send z-wave configuration commands to my Fibaro dimmer 2s to change their behaviour at different times of the day. Specifically when the house is in ‘night mode’ I want the dimmers to turn on to very dim when the switch is pushed and when the house is in ‘day mode’ or ‘evening mode’ I want them to turn on to full brightness.

This can only be acheived by changing parameter 19 to the desired brightness level.

I want to do this in a rule like so;

rule "Change dimmer settings when night mode set"

 when
   Item HouseMode changed to night
 then
   //BathroomDimmerZwave.sendCommand('parameter 19', 1)
 end

The HouseMode item is a string item that changes to ‘night’ at midnight or earlier if a user so desires and this part works fine. Is there a canonical way of acheiving what I want in the then part of my rule?

Same answer as above - it’s possible to add channels if they are generally useful, but OH doesn’t provide a feature to change configuration. Another alternative is to use the REST interface.

So can I take that to mean that the REST interface is the only practical way of achieving this?

No - there are two options - either create a channel, or use the REST interface. Both are practical ways to resolve this.

I haven’t looked at the specific definition of the channel, but if it’s something that could be of use to people, then why not create a channel.

If you prefer to use the REST interface though, then that’s also fine.

Thanks for replying. Your help is very greatly appreciated.

I don’t know how to go about creating a channel and a brief hunt for further explanation was unfruitful. I did look into the REST interface further and found this post.

A little bit of modification and my code becomes;

rule "Change dimmer settings when night mode set"

 when
   Item HouseMode changed to night
 then
   sendHttpPutRequest("http://localhost:8080/rest/things/zwave:device:46feb3ec:node3/config", "application/json", "{'config_19_1':1}")
 end

which has the desired effect.

I assume the _1 at the end of config_19_1 is the number of bytes in the parameter. Is this correct?

Also, are you able to point me towards some information about creating a channel and what is involved in this? I am very keen to extend my knowledge of openHAB as much as possible and this looks interesting.

I’m also interested in a channel for this because the newer Homeseer switches and dimmers have status LED’s that are only changeable via the config parameters. They are nice switches and dimmers and the status is very useful, but it is awkward to send config parameters to change the colors and blink rate and off/on. I’ll use this REST interface for now.

1 Like

What I do for.my dimmer2s is to programtically set the dimvalue.

Dimmer.sendCommand(40) will set the dimmer.to 40.
I have a rule so when the light is turned on, it checks the time. If it is nightmode it will dim it down.

Drawback is that you go up in the night, the.motion detector will turn on the light which will be at 100% it will take 1-2 seconds before it is dimmed down.
If you trigger it again it will.already be dimmed since then sendCommand(ON) will use whatever value was used before.

Can show the rule if you like.