Page 1 of 1
Event not triggered
Posted: Monday 05 February 2018 19:10
by dzdm
Hi all,
I have a group LivingRoom which consists of multiple devices. These devices are controlled via MQTT and included
in domoticz. The problem is, that I want to trigger a special function after the state of the group LivingRoom has changed,
so I tried to use the following trigger:
Code: Select all
on = {
groups = {
'LivingRoom'
}
},
execute = function(dz, item, triggerInfo)
dz.log('Triggered', dz.PRIORITY_LOW)
end
This does not work though, the trigger is not executed when switching on (or off) the devices via MQTT (also the
state of the LivingRoom group (On or Off) is correctly displayed in the domoticz web ui). Everything works when
switching on or off the group directly via domoticz, in this case the event is triggered.
I'm currently using a workaround - just using the on handler for a specific device of the group, but this is
not really perfect.
Any ideas?
Thanks

Re: Event not triggered
Posted: Thursday 08 February 2018 7:39
by dannybloe
Yes, that indeed doesn't work. I wonder if that's always desirable what you suggest as some people only want to know if the group goes on or off and react upon that.
Re: Event not triggered
Posted: Saturday 11 January 2020 15:40
by JanvdW
@dannybloe, I try to trigger a script when a group goes on or off to react upon that. But that doesn't work. It works if I switch the group manually in Domoticz, but if the status changes (also in the Domoticz application!) because of all group devices change to on or off nothing happens. Ay idea how I can solve that? Or a workaround? How did you solve it @dzdm?
Re: Event not triggered
Posted: Saturday 11 January 2020 16:08
by JanvdW
Just saw that the group status in Domoticz changes, but it appears that the group log shows only the manual status events. The other status changes (based on status changes of the group members) are not listed.
Re: Event not triggered [Solved]
Posted: Sunday 12 January 2020 0:27
by waaren
JanvdW wrote: ↑Saturday 11 January 2020 16:08
Just saw that the group status in Domoticz changes, but it appears that the group log shows only the manual status events. The other status changes (based on status changes of the group members) are not listed.
Only triggering a group / scene event when a group / scene is directly updated and not when the individual group / scene devices change state was a domoticz design decision and that will not be changed.
Imagine the situation where a group state is switched. All devices in that group will change state leading to 1 or more groups / scenes changing state that all would need to trigger an event causing a waterfall of events.
If you need such a scenario you could try to use something like below.
Code: Select all
local myGroup = 'groupTest'
return
{
on =
{
groups =
{
myGroup,
},
devices =
{
'*', -- or a wildcarded list like '*_groupTest' or 23,24,25,26 or 'device1', 'device2', 'device3', etc..
},
},
logging =
{
level = domoticz.LOG_ERROR,
marker = 'groupTest',
},
execute = function(dz, item)
local myGroup = dz.groups(myGroup)
if item.isDevice then
groupDevice = myGroup.devices().find(function(dv)
return dv == item
end)
else
dz.log('Triggered by group ' .. item.name .. '; state = ' .. item.state, dz.LOG_FORCE)
return
end
if groupDevice then
dz.log('Triggered by ' .. item.name .. ' (part of ' .. myGroup.name .. ')' ..
'; State of ' .. myGroup.name .. ' is now ' .. myGroup.state, dz.LOG_FORCE)
else
dz.log('Item ' .. item.name .. ' is not in group ' .. myGroup.name, dz.LOG_FORCE)
end
end
}
Re: Event not triggered
Posted: Monday 13 January 2020 21:56
by JanvdW
All right, understood. I have implemented the alternative solution. Thanks for your response!