The problem is with all the sensors. Please note that the sensors are added via the Deconz app.
So the device is not recognized as Class Sensor.
Have a look at the Device parameters in: Homey Developer Tools
My doorsensor looks like:
Deconz or not, he showed a contact sensor, which is okay.
.
@timvdhoorn
Do the capabilities match if you look up the contact sensor at developer?
.
And,
Just in case, does the contact sensor has an alarm = false
status when the door is closed? In other words, does it switch?
And,
Iâm still curious if the script works, or not, with a virtual contact sensor. Youâll need Virtual Devices app for this.
When this code does not result in displaying a device, then for me, there is no active device with the Class âsensorâ or am I wrong? Thats why Iâm advising to have a look at the device parameters in Homey Developer Tools
I donât say youâre wrong , but I tried to show you the sensor seems to present it self correctly as a contact sensor, Tim posted a screenshot. Itâs in my previous post:
Sure, nothing wrong with that, but Contact alarm is just a Capability title, doesnât say anything about the Class where the code is looking for
Anyway, let wait for Timâs findings
The device type âsensorâ could be a problem. Perhaps it has another type, but the alarm_contact capability.
A complete screenshot from the device (developer page) would be nice.
Okay, after changing the script from âsensorâ to âhomealarmâ the sensor will show up when running the script
Now⌠How can I make the script look at class âsensorâ and class âhomealarmâ?
EDIT: I think like this?
if(device.class == 'homealarm' || 'sensor')
think it would be like
if (device.class == 'homealarm' || device.class == 'sensor')
Looks like both work.
(I really need to learn JS⌠)
Great that it works now, good for learning how to detect where things go wrong
Thank you all for the help!
Oh that ringed a bell!
Itâs indeed a wrong device type in the app: