System doesn't see the dimmer on log and rule. Motion detector and timer

  • Platform information:
  • OS: Synology
  • openHAB version: 2.5

Hardware related:

  • Z-wave stick serial controller
  • Z-wave Motion sensor
  • Z-wave Dimmer

Goal
When I light up the light with the dimmer or the motion controller, stay on for 60 seconds unless I close the light manually or the motion detector still see me.

Tools
Timer, reschedule, if, loginfo, design pattern.

Problem

  • With the motion detector it works almost always but some motion detectors doesn’t want to be trigged on again after the 60 seconds.

  • When I put the light on manually, no timer is started and I don’t see any log saying the dimmer has changed state so I suspect this is why it doesn’t work. I only see the Z-wave stick had some movement.

  • My items name are long and I see people having short easy to read name, where do I do that? (“zwave_device_129fb235_node18_switch_dimmer” could just be “Shop_Dimmer”).

Rule code

var Timer StairTimer = null

rule "Stair light Motion"
when
Item zwave_device_129fb235_node20_alarm_motion changed from OFF to ON
then
	if(StairTimer === null || StairTimer.hasTerminated()) {
		logInfo('test', "  Stair motion detected; switching Stair light to on")
		zwave_device_129fb235_node18_switch_dimmer.sendCommand(100)		
	}
	else {
		StairTimer.reschedule(now.plusSeconds(60))
		logInfo('test', "  Stair timer restarted by motion detector")
	}
end

rule "Stair light Timer"
when
	Item zwave_device_129fb235_node18_switch_dimmer changed
then  
	if (zwave_device_129fb235_node18_switch_dimmer.state > (0) && StairTimer !== null) {
		StairTimer.reschedule(now.plusSeconds(60))
		logInfo('test', "  Stair timer restarted by switch > 0")	
	}
	if (zwave_device_129fb235_node18_switch_dimmer.state == (0)) {
		StairTimer = null
		logInfo('test', "  Stair timer cancelled by switch = 0")
	}
	if (zwave_device_129fb235_node18_switch_dimmer.state > (0) && StairTimer === null) {
    logInfo('test', "  Stair timer started")
		StairTimer = createTimer(now.plusSeconds(60), [|
			zwave_device_129fb235_node18_switch_dimmer.sendCommand(0)
			logInfo('test', "  Stair timer to zero, closing light")
			StairTimer = null
			logInfo('test', "  Stair timer cancelled by expiration")
    ])
	}
end

Log

19:54:33.990 [INFO ] [smarthome.event.ItemStateChangedEvent] - 
 wave_serial_zstick_129fb235_serial_sof changed from 179258 to 179259
19:54:34.541 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179259 to 179260
19:54:34.562 [INFO ] [g.eclipse.smarthome.model.script.test] -   Stair motion detected; switching Stair light to on
19:54:34.565 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_device_129fb235_node20_alarm_motion changed from OFF to ON
19:54:34.592 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'zwave_device_129fb235_node18_switch_dimmer' received command 100
19:54:34.630 [INFO ] [arthome.event.ItemStatePredictedEvent] - zwave_device_129fb235_node18_switch_dimmer predicted to become 100
19:54:34.650 [INFO ] [g.eclipse.smarthome.model.script.test] -   Stair timer started
19:54:34.651 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_device_129fb235_node18_switch_dimmer changed from 0 to 100
19:54:34.686 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_ack changed from 30677 to 30678
19:54:34.701 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179260 to 179261
19:54:35.000 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179261 to 179262
19:54:58.477 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179262 to 179263
19:54:59.013 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179263 to 179264
19:54:59.033 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_device_129fb235_node20_alarm_motion changed from ON to OFF
19:55:07.941 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179264 to 179265
19:55:07.961 [INFO ] [smarthome.event.ItemStateChangedEvent] - 
19:55:08.498 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179265 to 179266
19:55:09.509 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179266 to 179267
19:55:09.802 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179267 to 179268
19:55:09.818 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_device_129fb235_node20_sensor_luminance changed from 0 to 2
19:55:10.433 [INFO ] [smarthome.event.ItemStateChangedEvent] - zwave_serial_zstick_129fb235_serial_sof changed from 179268 to 179269

Thanks!

Robin

You probably have Simple Mode enabled, which can cause a lot of headaches, including the long Item names. When enabled, it will create Items for each Channel, when a new Thing is created, but the ability to edit the Items is removed. If you disable Simple Mode, you will find a, Items section in Paper UI under Configuration> Items, where you can edit, create, and link Items, including changing the names of the Items. However, most people use .items files for managing their Items rather than in the UI, but that is all just a personal choice. You can actually create Items in both ways, but this can be tricky to manage. I suggest disabling Simple Mode (Configuration> System> Item linking). If you do not have many devices, it shouldn’t take long to clean up your Items. If you have a lot, you may want to start fresh and remove all of your existing Items, which can be done through the Karaf console.

One of the things that can be seen in your logs is that Simple Mode has created Items for your Z-Wave controller. After disabling Simple Mode, you should definitely remove these Items, since they will add unnecessary load to your system, spam your log files, and really they do not provide much useful information unless troubleshooting a Z-Wave network issue.

What brand/model of dimmer? Some do not support reporting their state when manually adjusted. If it does, check the associations (use Habmin for configuring Z-Wave devices), where there should be one to the controller.

Your rules have a few issues, but to start off, what brand/model is your Z-Wave motion sensor? I’m not aware of any that do not have an internal timer that will change the state of the device in OH to OFF. Why did you chose to not use this functionality? Is it possible to turn on the light without being detected by the motion sensor?

One last thing… you have used a quote rather than a code fence around your log, which makes it difficult to read. You can see the difference between it and your rule.

I switched to the advanced mode and now I see the Items tab in the paper UI. However, I cannot edit anything as fields are greyed. Close to the long name I an just copy it to clipboard. I had a look on Habmin and I don’t see where I can edit it.

One of the things that can be seen in your logs is that Simple Mode has created Items for your Z-Wave controller. After disabling Simple Mode, you should definitely remove these Items, since they will add unnecessary load to your system, spam your log files, and really they do not provide much useful information unless troubleshooting a Z-Wave network issue.

You means I could just go in my thing “Z-wave controller” and remove some channels? There is bunch of channel I don’t know what they do:

Start Frames
Frames acknowledged
Frames Rejected
Frames Cancelled
OOF Bytes Received
Received Checksum Errors.

What brand/model of dimmer?

Leviton VRMX1 and DZ6HD

Your rules have a few issues, but to start off, what brand/model is your Z-Wave motion sensor? I’m not aware of any that do not have an internal timer that will change the state of the device in OH to OFF. Why did you chose to not use this functionality?

Because I am a beginner:) Because I want the timer to start even when I turn on the light in any way beside the motion detector. This is why I tried to put the timer on the detection of dimmer changing state and not the motion controller.

Any Items created while using Simple Mode will need to be deleted in order to edit them. Simple Mode has finally been removed from OH.

No, you can’t remove Channels from Things. Things> Channels> Links> Items. Remove the Links to those Channels from the Items. It will save a lot of processing and spam in your log.

I don’t know about the DZ6HD, but the VRMX1 definitely reports its state… I have many of them. Make sure the controller is set in the associations. You may need to removed the association, save, then add it again and save.