Working with zwave nodes that don't have association groups

Hi all,
I have a TKB TZ67 that doesn’t seem to have association groups, meaning I get no feedback of it’s state unless I update it from openhab. There’s a Fibaro dimmer module controlling main light and the second switch is associated with the TZ67 plugged into a lamp, so I can always see what state the main light is on, but not the lamp…

I’m presuming this is something that people have run into before… Is there any nice ways around this?
I was thinking that maybe I can create an item for the second switch of the fibaro dimmer (how would I do this, it seems the old way would be zwave=5:1:etc, zwave=5:2:etc, but that’s not supported anymore?) that is not really doing anything apart from getting the state of the switch, then updating the TZ67 state from that just so I can do rules for it.

If that’s the case it’s fine because it’ll be hidden, so the only way to turn it on/off is either the switch or mobile app, meaning it won’t loose it’s state i.e., if someone pressed the button on the hardware. I didn’t know about association groups when I bought it, seems like a silly thing that it can’t communicate back to the server!

Cheers
Christian

You can simply enable polling on the device by adding “refresh_interval=20” to sample the state every 20 seconds.

Cool that works a treat. Thanks!
So is this is the best method, or would explicitly setting it from the control switch be a better idea? Obviously then I wouldn’t have to refresh every 20 seconds then. So that would mean I have to setup a dummy item that was only receiving the second switch’s state. Just for learning purposes it’d be good to know if that’s possible. Then I guess you’d need a rule to set the state of the plugged in dimmer…

Cheers
Christian

This is the only way to know the status of this switch - you might be able to do as you suggest, but of course that won’t work if you manually switch the TZ67 (I guess it has a button on the front?).

Chris

Yeah it’s got a button on the front that my kid likes to press repeatedly :smile: But it’s going to be hidden behind some shelves so shouldn’t be a problem.

I’ve tried setting up some dummy items for the switch with (zwave=5:1, zwave=5:2) but the endpoint doesn’t seem to work and I’m pretty sure I’ve read that you can’t use endpoints anymore.

It’s not a big deal, just trying to get to grips with everything, get a small setup working as I like and probably wait for OH2 before rolling it out all over the house. So knowing as much as I can before that point is my aim.

No - you can use endpoints if the device supports them. What you might have read is that you shouldn’t use endpoint 0 in a binding config string?

With further tinkering I’ve worked it all out. So for any other total novices I’m posting my findings.
The dimmer I was using didn’t have any extra endpoints, so the way to do it is enabling scenes in the zwave device and capturing the scene into an item (I presume you can just write this into a rule actually instead of having an item per scene, but I haven’t figured that yet).

Here is my Fibaro Dimmer items that respond to the number of clicks on each switch:

/* Scenes */
Switch  nursery_scene_s1_1			"Switch 1 Click 1"	{ zwave="5:command=SCENE_ACTIVATION,scene=16,state=0" }
Switch  nursery_scene_s1_2			"Switch 1 Click 2"	{ zwave="5:command=SCENE_ACTIVATION,scene=14,state=0" }
Switch  nursery_scene_s1_3			"Switch 1 Click 3"	{ zwave="5:command=SCENE_ACTIVATION,scene=15,state=0" }
Switch  nursery_scene_s1_hold		"Switch 1 Hold"		{ zwave="5:command=SCENE_ACTIVATION,scene=12,state=0" }
Switch  nursery_scene_s1_release	"Switch 1 Release"	{ zwave="5:command=SCENE_ACTIVATION,scene=13,state=0" }

Switch  nursery_scene_s2_1			"Switch 2 Click 1"	{ zwave="5:command=SCENE_ACTIVATION,scene=26,state=0" }
Switch  nursery_scene_s2_2			"Switch 2 Click 2"	{ zwave="5:command=SCENE_ACTIVATION,scene=24,state=0" }
Switch  nursery_scene_s2_3			"Switch 2 Click 3"	{ zwave="5:command=SCENE_ACTIVATION,scene=25,state=0" }
Switch  nursery_scene_s2_hold		"Switch 2 Hold"		{ zwave="5:command=SCENE_ACTIVATION,scene=22,state=0" }
Switch  nursery_scene_s2_release	"Switch 2 Release"	{ zwave="5:command=SCENE_ACTIVATION,scene=23,state=0" }

And a quick rule to make sure it’s working:

rule "scenetest2-2"
when
	Item nursery_scene_s2_2 changed
then
	logInfo("Switch2", "Switch 2 was clicked Twice")
end

Hope that helps others learning the ropes.
Christian

Sorry a further question related to this and I think I’m done.
I feel it would be beneficial to just have 1 item for the dimmer and trigger different rules depending on the scene activated, rather than an item per action of the node. I’ve been trying to get a rule to return the command it’s been sent so I can intercept it and do whatever based on it’s value, but can’t work it out.

Here is the feedback of clicking the S2 button a single time. What is the syntax to simply return the scene value of the item?

Thanks
Christian

20:10:17.019 [DEBUG] [ApplicationCommandMessageClass:56 ] - NODE 5: Incoming command class SCENE_ACTIVATION
20:10:17.019 [DEBUG] [z.i.p.c.ZWaveBasicCommandClass:62 ] - Received Scene Activation for Node ID = 5
20:10:17.020 [DEBUG] [z.i.p.c.ZWaveBasicCommandClass:66 ] - Scene Activation Set
20:10:17.020 [DEBUG] [z.i.p.c.ZWaveBasicCommandClass:93 ] - Scene activation node from node 5: Scene 26, Time 255
20:10:17.020 [DEBUG] [b.z.i.protocol.ZWaveController:595 ] - Notifying event listeners: ZWaveCommandClassValueEvent
20:10:17.021 [DEBUG] [.z.internal.ZWaveActiveBinding:433 ] - ZwaveIncomingEvent
20:10:17.021 [DEBUG] [.z.internal.ZWaveActiveBinding:450 ] - NODE 5: Got a value event from Z-Wave network, endpoint = 0, command class = SCENE_ACTIVATION, value = 26

Sorry to bring this up again, first let me answer my own question in case it helps anyone starting out. This is the items you need to setup to return a scene value:

//Switch 1 Items
Switch	nursery_scene_s1_1			"Switch 1 Click 1"	{ zwave="5:command=SCENE_ACTIVATION,scene=16,state=0" }
Switch	nursery_scene_s1_2			"Switch 1 Click 2"	{ zwave="5:command=SCENE_ACTIVATION,scene=14,state=0" }
Switch	nursery_scene_s1_3			"Switch 1 Click 3"	{ zwave="5:command=SCENE_ACTIVATION,scene=15,state=0" }
Switch	nursery_scene_s1_hold		"Switch 1 Hold"		{ zwave="5:command=SCENE_ACTIVATION,scene=12,state=0" }
Switch	nursery_scene_s1_release	"Switch 1 Release"	{ zwave="5:command=SCENE_ACTIVATION,scene=13,state=0" }


//Switch 2 Items
Switch	nursery_scene_s2_1			"Switch 2 Click 1"	{ zwave="5:command=SCENE_ACTIVATION,scene=26,state=0" }
Switch	nursery_scene_s2_2			"Switch 2 Click 2"	{ zwave="5:command=SCENE_ACTIVATION,scene=24,state=0" }
Switch	nursery_scene_s2_3			"Switch 2 Click 3"	{ zwave="5:command=SCENE_ACTIVATION,scene=25,state=0" }
Switch	nursery_scene_s2_hold		"Switch 2 Hold"		{ zwave="5:command=SCENE_ACTIVATION,scene=22,state=0" }
Switch	nursery_scene_s2_release	"Switch 2 Release"	{ zwave="5:command=SCENE_ACTIVATION,scene=23,state=0" }

I’d also like to ask how I can force a refresh/poll of a node, which is the real crux of the topic. I don’t like the idea of having to poll a node every x seconds to work out state and can almost guarantee that the node will only ever be updated from this switch as it’s behind a cupboard.

I know I can just set the state to the value I’m setting the node too, but what I’d like to do for my own sanity (and further education/future proofing) is to force a refresh/poll of the node. I’ve seen the ‘pollNode’ function, but not sure how to get it to work.

var Number lightVal
var Boolean runRule = false

rule "nursery_goodnight"
when
	Item nursery_scene_s2_3 received update
then
	lightVal = 50
	runRule = true
	while(lightVal > 0 && runRule){
		lightVal = lightVal - 5
		sendCommand(nursery_light_main, lightVal)
		sendCommand(nursery_light_lamp, lightVal)
		//Need to update state of lamp as it has no association group
		//pollNode(zController, node)
		Thread::sleep(60000)
	}
end

Any help is much appreciated.
Thanks
Christian

I don’t know what you’re doing with the scenes I just saw your most recent post. To answer your question, below should refresh the item with the current value every 60 seconds.

{ zwave=“5:command=SCENE_ACTIVATION,scene=16,state=0,refresh_interval=60” }

To add very frequent polling you’ll have to add below to your config file. The higher you set the number the lower you can go with polling.

zwave:pollingQueue=2

Playing around with those two I was able to poll switches once per second. Eventually It brought down the entire zwave network and I think I damaged the binding. Simply changing the values back didn’t fix it and I basically had to do a restore of the entire openhab folder from the nightly backups to get zwave working properly again. All errors mostly revolved around node 9 which is a thermostat so I’m wondering if the battery powered devices can’t handle the excessive polling (although, I was only polling it at 60 seconds).

On the successful end, I’ve been able to setup polling of 5 switches down to 10 seconds and 1 down to 5 seconds with all others polling at 60 seconds without issues for an extended period of time. This ran fine for a couple months without issue. I’ve since changed all devices to 60 seconds as I don’t need the poling to be that frequent. Also, more polling = more disk space over time…

Thanks for your reply.
I know I can poll the device with refresh_interval, but what I really want is to force a poll of the device.

As I know I’ll only ever need to know it’s state if a command is issued from another device, this makes the most sense as I might only have to do it once a day, not 1440 times a day :smile:

Any ideas?
Thanks
Christian

I think I get what you’re saying. I don’t know how to do that but I’m not sure I would do it even if I did.

My best guess, and correct me if i’m wrong, is you’d want to poll on demand before or during a rule execution. That’s the only use case that I can think of at the moment. In this case the device status is at worse 60 seconds old or what ever interval you choose. Also you’re rule isn’t waiting for the device to answer back regarding it’s current state before proceeding. As I said, not sure of what your end game is so this is my best guess.

Also, from my experience, other people mileage may vary, unless you have full two-way communication you don’t want multiple non-openhab devices controlling your devices. If you have one-way or partial 2-way communication(it sounds like you have partial 2-way) then you want openhab to be the only thing controlling it so you always know the device state or you poll it as frequently as you can with out locking it up so you always know it’s state. If you have a partial 2-way device and it’s difficult/impossible to prevent direct/multiple access to it, like a light switch that only talks back when spoken to, then you’re best bet is to poll it on an interval. This way when your rule executes the value is in memory and you’re not waiting for the device to answer back. Goes for any automation system and of course the devices your’e using plays a role…

Well I have the Fibaro dimmer in a wall switch with two switches. Switch1 obviously connects directly to the circuit and it’s lights. Switch2 is paired with association group to a plug in dimmer that doesn’t have it’s own association back to the controller (pain in the ASS!).

So If I hold switch 2 to dim it up and down, my plug in dimmer works fine and dims correctly, however OpenHab is now out of sync with what state it is. On release I’d want it to then poll the device to find out what value it settled on.

I could (and have in the past) taken the association group out and controlled the plug in dimmer directly through a rule. But the latency isn’t as good as just directly controlling it from the Fibaro Dimmer.

Polling every 60 seconds is fine and will achieve what I want, I just think it’s a waste of resources as I only need to poll it say 5 seconds after I’ve stopped messing with the switch to just know what state it’s at.

Okay, I’m following you now. Yea, I would do something like that. I don’t think that it’s possible though. Actually, I’m pretty sure it’s not. By design only the binding interacts directly with the devices not rules or anything else. I’d love to be wrong because I like the idea of what you’re trying to do. Hopefully some one will chime in if i’m wrong, i’m pretty sure i’m correct though, but i’d love to be wrong.

You’re going to have to poll that device. I don’t think you have any options short of obtaining a device that support association groups. For what you just described 60 seconds should suffice. If you want to base a rule off the level of the device and time is a factor then bump it down to 10 or 20.

How much resources are burned when polling anyway? What are you running openhab on? My setup is a VM running on server grade hardware and SSDs. Even with high polling intervals and numerous rules firing once per minute plus some every few seconds the system is basically sleeping. It’s the second lowest utilized vm on the entire hyper visor, the OS backup job uses more resources. I’ve never stopped to consider the performance impact but I suspect it’s not that high.

The zwave network itself can handle it just be careful of how many messages are in the queue at once (zwave:pollingQueue=2). You’ll know very quickly when you’re flooding it and from my experience it takes a stupid amount of polling to get there.

Ok thanks for all the input.
I’ve noticed that the new zwave plus stuff HAS to include all functions. So the new gen5 version of my plug dimmer supports association groups.

I might get a new one for this room that needs it the most and get rid of the old ones I have. Philips hue is going to take their place for most things, but this lamp is a vintage ceramic children’s lamp that takes Pygmy bulbs (like in a fridge or oven) so still needs a zwave dimmer.

Luckily I haven’t invested heavily yet, so I’ll just make sure to only get zwave+ devices from now on out.

Thanks again
Christian