Page 1 of 1
DzVents: Make rooms available as device groups
Posted: Monday 02 April 2018 19:41
by rrozema
Domoticz has the ability to assign your devices to a room. I can not find however how to find the devices in a particular room from DzVents. Can we have the rooms available as device groups from the domotiz object? This enables us to create scripts that automatically operate on all devices in a particular room.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 5:18
by Ries
That wuld be nice.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 7:19
by dannybloe
Yes, it is already on my list. Maybe for 2.5.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 11:35
by waaren
rrozema wrote: ↑Monday 02 April 2018 19:41
Domoticz has the ability to assign your devices to a room. I can not find however how to find the devices in a particular room from DzVents. Can we have the rooms available as device groups from the domotiz object? This enables us to create scripts that automatically operate on all devices in a particular room.
@rrozema,
as workaround until this is implemented you can add all devices in a room to a domoticz group and loop through these devices with
domoticz.groups("group name").devices().forEach(function(device) -- loop over all devices in this group;
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 14:24
by rrozema
waaren wrote: ↑Monday 18 June 2018 11:35
rrozema wrote: ↑Monday 02 April 2018 19:41
Domoticz has the ability to assign your devices to a room. I can not find however how to find the devices in a particular room from DzVents. Can we have the rooms available as device groups from the domotiz object? This enables us to create scripts that automatically operate on all devices in a particular room.
@rrozema,
as workaround until this is implemented you can add all devices in a room to a domoticz group and loop through these devices with
domoticz.groups("group name").devices().forEach(function(device) -- loop over all devices in this group;
Yes thank you for the suggestion, I use many groups already. I was however trying to avoid having to maintain all these groups: I have, like many people will have done, assigned my devices into rooms to show them correctly on the floorplan. I asked for this addition to DzVents to take advantage of these room assignments.
For example: by creating a generic script that periodically goes over all rooms, looking for rooms that have lights that are on and have one or more motion sensor(s). If there has been no motion in the room the last, say 5 minutes, I can switch off the light(s) in that room automatically. I don't need to hard code any motion sensors or switches, just add the script and it works, even if a motion sensor or a a light is added or removed. All you need to do is add it to the correct room, which you would do already for showing it correctly in the floorplan.
Note to Danny: I think, once this is added, the next question will be how to identify which devices are motion sensors, lights, etc. I'm currently using json in each device's description fields to configure settings per device. Maybe you've got some good ideas for this too?
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 14:26
by dannybloe
All the type information is already on the Device object so that should not be so hard.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 14:40
by rrozema
dannybloe wrote: ↑Monday 18 June 2018 14:26
All the type information is already on the Device object so that should not be so hard.
I may be in need of some assistance then setting up device types. For all my motion sensors (most of them are cheap neo coolcam z-wave pir devices, but i also have more expensive aeotec) are detected as normal on/off switches. If I try to switch such a device manually, domoticz responds that the device does not support being switched. So domoticz knows it is a device that can't be switched, but i haven't found a way to distinguish these sensors from switches yet.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 14:45
by snellejellep
you can use a prefix in the name of the devices like lampxxx or PIRxxx that is what i use and then with a wildcard like PIR* you can cycle trough them
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 14:47
by dannybloe
Or use the description field and use that in your scripts.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 14:51
by rrozema
snellejellep wrote: ↑Monday 18 June 2018 14:45
you can use a prefix in the name of the devices like lampxxx or PIRxxx that is what i use and then with a wildcard like PIR* you can cycle trough them
Yes, that is a workaround. And i do things like that. However, dzvents exposes all sorts of attributes for each device and yet none of these can be used to identify a switch from a motion sensor? I don't think that's the way it was intended.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 14:59
by Ries
dannybloe wrote: ↑Monday 18 June 2018 7:19
Yes, it is already on my list. Maybe for 2.5.
Nice! Thank you.
I already use the group approach, but the room approach seems more appropriate.
I also encoutered the type problem. Seems to be another feature request, I see naming conventions as a workaround too.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 15:02
by snellejellep
rrozema wrote: ↑Monday 18 June 2018 14:51
snellejellep wrote: ↑Monday 18 June 2018 14:45
you can use a prefix in the name of the devices like lampxxx or PIRxxx that is what i use and then with a wildcard like PIR* you can cycle trough them
Yes, that is a workaround. And i do things like that. However, dzvents exposes all sorts of attributes for each device and yet none of these can be used to identify a switch from a motion sensor? I don't think that's the way it was intended.

cant you set the switch type to motion sensor like the image above?
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 15:05
by Ries
cant you set the switch type to motion sensor like the image above?
It doenst show like that in the dzvents device object. It is a switch there.
Also the icon type doenst always reflect (in dzvents) the icon chosen.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 15:19
by waaren
In my environment a motion sensor is identified by dzVents as motion sensor. So I expect if it is not in your environment that it is something at another level than dzVents's
....
if trigger.switchType == "Motion Sensor"then
print("XMotion triggered: " .. trigger.name)
end
2018-06-18 15:16:40.710 Status: dzVents: XMotion triggered: XMotion-1
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 18:01
by rrozema
I agree. It is probably not dzVents making these devices look all the same, that's why I said I am in need of some guidance here. To illustrate the problem, here's my device list filtered on devices that have 'motion' in their name:
As you can see my motion devices are all listed as 'Light/Switch' and SubType 'Switch'. I have yet to find how I can change these values. They automatically assigned when the device is first detected. In the properties in the Switches tab there is an option to select 'Switch Type:', which can be set to 'Motion Sensor', but that value can't be found in the properties dzVents exposes for the device:
Edit: Forum code can't make the attachments show up on the correct place. please see the attachments for the pictures.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 19:18
by waaren
rrozema wrote: ↑Monday 18 June 2018 18:01
I agree. It is probably not dzVents making these devices look all the same, that's why I said I am in need of some guidance here. To illustrate the problem, here's my device list filtered on devices that have 'motion' in their name:
As you can see my motion devices are all listed as 'Light/Switch' and SubType 'Switch'. I have yet to find how I can change these values. They automatically assigned when the device is first detected. In the properties in the Switches tab there is an option to select 'Switch Type:', which can be set to 'Motion Sensor', but that value can't be found in the properties dzVents exposes for the device:
Edit: Forum code can't make the attachments show up on the correct place. please see the attachments for the pictures.
Sorry but still don't get what your problem is with the identification of these sensors in dzVents. I see the same as you do in the devices tab but dzVents is able to identify the switchtype property correctly.
The output of this dzVents code snippet
Code: Select all
dz.devices().forEach(function(device)
if string.find(device.name,"otion") or string.find(device.name,"eging") then
print(" device ID: " .. device.idx .. " ===>>> " ..
device.name .." ===>>> type: " ..
tostring(device.switchType))
end
end)
Code: Select all
2018-06-18 19:15:11.955 Status: dzVents: device ID: 30 ===>>> Trap bewegingsmelder ===>>> type: Motion Sensor
2018-06-18 19:15:11.956 Status: dzVents: device ID: 32 ===>>> WC bewegingsmelder ===>>> type: Motion Sensor
2018-06-18 19:15:12.074 Status: dzVents: device ID: 500 ===>>> Beweging buiten ===>>> type: Motion Sensor
2018-06-18 19:15:12.077 Status: dzVents: device ID: 508 ===>>> Homewizard - Beweging buiten ===>>> type: Motion Sensor
2018-06-18 19:15:12.101 Status: dzVents: device ID: 582 ===>>> XMotion-1 ===>>> type: Motion Sensor
2018-06-18 19:15:12.102 Status: dzVents: device ID: 583 ===>>> XMotion-2 ===>>> type: Motion Sensor
2018-06-18 19:15:12.114 Status: dzVents: device ID: 657 ===>>> XMotion-3 ===>>> type: Motion Sensor
2018-06-18 19:15:12.116 Status: dzVents: device ID: 670 ===>>> Beweging kantoor ===>>> type: Motion Sensor
2018-06-18 19:15:12.146 Status: dzVents: device ID: 794 ===>>> X-Motion zolderhok lux ===>>> type: On/Off // combined Motion sensor / lux device
2018-06-18 19:15:12.147 Status: dzVents: device ID: 795 ===>>> XMotion Zolderhok ===>>> type: Motion Sensor
2018-06-18 19:15:12.148 Status: dzVents: device ID: 796 ===>>> X-Motion6 lux ===>>> type: On/Off // combined Motion sensor / lux device
2018-06-18 19:15:12.149 Status: dzVents: device ID: 797 ===>>> XMotion-6 ===>>> type: Motion Sensor
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 20:04
by rrozema
waaren wrote: ↑Monday 18 June 2018 19:18
Code: Select all
dz.devices().forEach(function(device)
if string.find(device.name,"otion") or string.find(device.name,"eging") then
print(" device ID: " .. device.idx .. " ===>>> " ..
device.name .." ===>>> type: " ..
tostring(device.switchType))
end
end)
Thank you. I don't know how I missed this. You are absolutely right, device.switchType will do the trick.
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 20:12
by Ries
How do you differentiate between lux devices that way? As well as computers or phone
Re: DzVents: Make rooms available as device groups
Posted: Monday 18 June 2018 23:30
by waaren
Ries wrote: ↑Monday 18 June 2018 20:12
How do you differentiate between lux devices that way? As well as computers or phone
Lux devices can be identified by their deviceType or deviceSubType. Please elaborate on the computers or phone. What kind of devices are they ? How are they defined ?