Page 1 of 1
high cpu when dzvents is enabled
Posted: Monday 06 August 2018 14:05
by annegerben
Version: 4.9700
Platform: rpi
Plugin/Hardware: dzvents
I'm running 4.9700 (stable) on rpi2 but when I have dzvents enabled if have high cpu load.
It's adding about 50% cpu load to the averige, when I disable dzvents the cpu usage drops immediately.
I've added a screen shot where you can see in the yellow square when I've enabled dzvents and temp disabled it.
I'm running 3 simple scripts which when I open a door a turn on the lights or send me a message.
I like dzvents, but the cpu usage is to high it's slowing down my system.
anyone an idea how to fix this issue?

- 2018-08-06 13_55_57-Domoticz.png (219.7 KiB) Viewed 2743 times
Re: high cpu when dzvents is enabled
Posted: Monday 06 August 2018 19:17
by dannybloe
Do you have any script defined? If so, can you remove them all or disabled them if you created them in using the built-in editor? Also make sure you don't have dzVents running in debug mode (setting in the GUI).
Re: high cpu when dzvents is enabled
Posted: Monday 06 August 2018 22:06
by annegerben
dannybloe wrote: ↑Monday 06 August 2018 19:17
Do you have any script defined? If so, can you remove them all or disabled them if you created them in using the built-in editor? Also make sure you don't have dzVents running in debug mode (setting in the GUI).
logging is set to "error + minimal execution"
I had three script running and have disabled them now.
cpu usage is now back to +- 12%, I'll add a screenshot tomorrow.
scripts:
- Spoiler: show
-
Code: Select all
return {
on = {
devices = {
['achterdeur sensor'] = { 'between 30 minutes before sunset and 4:00' }
}
},
execute = function(d, achterdeur)
if (achterdeur.state == 'Open' and d.devices('woonkamer').state == 'Off' and d.devices('keuken').state == 'Off' and d.devices('tafel').state == 'Off') then
d.devices('woonkamer').switchOn()
d.devices('keuken').switchOn()
d.log('achterdeur open, lampen aan omdat er nog niets brand')
elseif (achterdeur.state == 'Closed') then
d.log('achterdeur open, geen lampen aan omdat er al iets brand')
d.log('2e regel')
end
end
}
Code: Select all
return {
on = {
devices = {
['achterdeur sensor'] = { 'on mon,tue,fri' },
['voordeur sensor'] = { 'on mon,tue,fri' },
'TAG-Bezoek'
}
},
execute = function(d, deuropen)
if (d.devices('TAG-Bezoek').state == 'Off') then
if (d.devices('achterdeur sensor').state == 'Open' ) then
d.notify('achterdeur is open', 'achterdeur is open', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('achterdeur sensor').state == 'Closed' ) then
d.notify('achterdeur is open', 'achterdeur is gesloten', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('voordeur sensor').state == 'Open') then
d.notify('voordeur is open', 'voordeur is open', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('voordeur sensor').state == 'Closed' ) then
d.notify('voordeur is open', 'voordeur is gesloten', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
end
end
-- d.log('Device ' .. device.name .. ' was changed', d.LOG_INFO)
end
}
Code: Select all
return {
on = {
devices = {
['voordeur sensor'] = { 'between 30 minutes before sunset and 6:00' }
}
},
execute = function(d, voordeur)
if (voordeur.state == 'Open' and d.devices('hal').state == 'Off') then
d.devices('hal').switchOn()
d.log('voordeur open, ganglamp aan omdat er nog niets brand')
elseif (voordeur.state == 'Closed') then
d.log('voordeur open, ganglamp niet aan omdat deze al brand')
end
end
}
Re: high cpu when dzvents is enabled
Posted: Tuesday 07 August 2018 8:17
by annegerben
annegerben wrote: ↑Monday 06 August 2018 22:06
dannybloe wrote: ↑Monday 06 August 2018 19:17
Do you have any script defined? If so, can you remove them all or disabled them if you created them in using the built-in editor? Also make sure you don't have dzVents running in debug mode (setting in the GUI).
logging is set to "error + minimal execution"
I had three script running and have disabled them now.
cpu usage is now back to +- 12%, I'll add a screenshot tomorrow.
scripts:
- Spoiler: show
-
Code: Select all
return {
on = {
devices = {
['achterdeur sensor'] = { 'between 30 minutes before sunset and 4:00' }
}
},
execute = function(d, achterdeur)
if (achterdeur.state == 'Open' and d.devices('woonkamer').state == 'Off' and d.devices('keuken').state == 'Off' and d.devices('tafel').state == 'Off') then
d.devices('woonkamer').switchOn()
d.devices('keuken').switchOn()
d.log('achterdeur open, lampen aan omdat er nog niets brand')
elseif (achterdeur.state == 'Closed') then
d.log('achterdeur open, geen lampen aan omdat er al iets brand')
d.log('2e regel')
end
end
}
Code: Select all
return {
on = {
devices = {
['achterdeur sensor'] = { 'on mon,tue,fri' },
['voordeur sensor'] = { 'on mon,tue,fri' },
'TAG-Bezoek'
}
},
execute = function(d, deuropen)
if (d.devices('TAG-Bezoek').state == 'Off') then
if (d.devices('achterdeur sensor').state == 'Open' ) then
d.notify('achterdeur is open', 'achterdeur is open', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('achterdeur sensor').state == 'Closed' ) then
d.notify('achterdeur is open', 'achterdeur is gesloten', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('voordeur sensor').state == 'Open') then
d.notify('voordeur is open', 'voordeur is open', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('voordeur sensor').state == 'Closed' ) then
d.notify('voordeur is open', 'voordeur is gesloten', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
end
end
-- d.log('Device ' .. device.name .. ' was changed', d.LOG_INFO)
end
}
Code: Select all
return {
on = {
devices = {
['voordeur sensor'] = { 'between 30 minutes before sunset and 6:00' }
}
},
execute = function(d, voordeur)
if (voordeur.state == 'Open' and d.devices('hal').state == 'Off') then
d.devices('hal').switchOn()
d.log('voordeur open, ganglamp aan omdat er nog niets brand')
elseif (voordeur.state == 'Closed') then
d.log('voordeur open, ganglamp niet aan omdat deze al brand')
end
end
}
todays graph

- 2018-08-07 08_14_58-Domoticz.png (278.95 KiB) Viewed 2691 times
Re: high cpu when dzvents is enabled
Posted: Tuesday 07 August 2018 9:29
by waaren
annegerben wrote: ↑Tuesday 07 August 2018 8:17
...
logging is set to "error + minimal execution"
Can you please reactivate the scripts and set the loglevel for domoticz one level higher (= add generic info) and look at the log to see if you find anything unusual in there.
(as example: scripts or device-adapters that are triggered very often or dzVents errors)
This might help finding the root cause.
Re: high cpu when dzvents is enabled
Posted: Tuesday 07 August 2018 10:17
by annegerben
waaren wrote: ↑Tuesday 07 August 2018 9:29
annegerben wrote: ↑Tuesday 07 August 2018 8:17
...
logging is set to "error + minimal execution"
Can you please reactivate the scripts and set the loglevel for domoticz one level higher (= add generic info) and look at the log to see if you find anything unusual in there.
(as example: scripts or device-adapters that are triggered very often or dzVents errors)
This might help finding the root cause.
when I enable on of the scripts cpu load directly high again.
I've updated one of the scripts to report on a dummy switch, but no errors in the logs:
Code: Select all
2018-08-07 10:09:01.993 Status: EventSystem: Script event triggered: SolarInverter
2018-08-07 10:09:39.045 Status: User: AG initiated a switch command (563/TAG-Bezoek/On)
2018-08-07 10:09:40.051 Status: dzVents: Info: Handling events for: "TAG-Bezoek", value: "On"
2018-08-07 10:09:40.052 Status: dzVents: Info: ------ Start internal script: deurgeopend: Device: "TAG-Bezoek (TAG)", Index: 563
2018-08-07 10:09:40.052 Status: dzVents: Info: ------ Finished deurgeopend
2018-08-07 10:09:40.673 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-08-07 10:09:40.703 Status: Notification: TAG-Bezoek On
2018-08-07 10:10:12.677 Status: EventSystem: Script event triggered: SolarInverter
- Spoiler: show
Code: Select all
return {
on = {
devices = {
['achterdeur sensor'] = { 'on mon,tue,fri' },
['voordeur sensor'] = { 'on mon,tue,fri' },
'TAG-Bezoek'
}
},
execute = function(d, deuropen)
if (d.devices('TAG-Bezoek').state == 'Off') then
if (d.devices('achterdeur sensor').state == 'Open' ) then
d.notify('achterdeur is open', 'achterdeur is open', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('achterdeur sensor').state == 'Closed' ) then
d.notify('achterdeur is gesloten', 'achterdeur is gesloten', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('voordeur sensor').state == 'Open') then
d.notify('voordeur is open', 'voordeur is open', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('voordeur sensor').state == 'Closed' ) then
d.notify('voordeur is gesloten', 'voordeur is gesloten', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
end
end
if (d.devices('TAG-Bezoek').state == 'On' ) then
d.notify('TAG-Bezoek On', 'TAG-Bezoek On', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
elseif (d.devices('TAG-Bezoek').state == 'Off' ) then
d.notify('TAG-Bezoek Off', 'TAG-Bezoek Off', d.PRIORITY_HIGH, d.SOUND_DEFAULT,'ONEA2003', d.NSS_GOOGLE_CLOUD_MESSAGING)
end
-- d.log('Device ' .. device.name .. ' was changed', d.LOG_INFO)
end
}

- 2018-08-07 10_12_42-Window.png (53.55 KiB) Viewed 2673 times
Re: high cpu when dzvents is enabled
Posted: Tuesday 07 August 2018 10:29
by dannybloe
How many active devices do you have in your Domoticz instance?
Re: high cpu when dzvents is enabled
Posted: Tuesday 07 August 2018 13:06
by annegerben
dannybloe wrote: ↑Tuesday 07 August 2018 10:29
How many active devices do you have in your Domoticz instance?
I have a total of 443 devices from which 110 are set to active (used).
Re: high cpu when dzvents is enabled
Posted: Tuesday 07 August 2018 13:13
by dannybloe
Ok, that's not excessive. So, you can enable debug logging in dzVents. Then, whenever dzVents gets triggered due to an event, you should see something in Domoticz log. Apart from the events you defined in your on-sections in your three scripts, do you see more events in the log? Note that debug logging can create quite a lot of entries in the log and you may have to inspect the logging using the command-line (start domoticz exec manually from the CLI and watch the out (same as the log)). Maybe there is another device that is generating an enormous amount of events.
Re: high cpu when dzvents is enabled
Posted: Tuesday 07 August 2018 15:25
by annegerben
I don't see anything strange in the log (see attached).
- I've restarted the domoticz at about 14:29
- enabled 1 dzvents script at 15.01
- trigger a switch starting at 15.06
but with debug running the CPU is near 100%
Re: high cpu when dzvents is enabled
Posted: Tuesday 07 August 2018 15:38
by dannybloe
Don't see anything weird.
Re: high cpu when dzvents is enabled
Posted: Wednesday 08 August 2018 11:41
by annegerben
When I disabled Zwave the cpu usage goes back to normal.
This is not a solution of course ..
other thought: is a rpi 2b sufficient for dzvents?, what is the cpu load on a 3b+
Re: high cpu when dzvents is enabled
Posted: Wednesday 08 August 2018 11:46
by Egregius
My cpu load is 0.2%

But, I don't use any of the internal scripting and I run on a Intel NUC

Re: high cpu when dzvents is enabled
Posted: Wednesday 08 August 2018 13:20
by annegerben
Egregius wrote: ↑Wednesday 08 August 2018 11:46
My cpu load is 0.2%

But, I don't use any of the internal scripting and I run on a Intel NUC
hahaha, sounds like an overkill
an intel nuc is a bit more expensive then a rpi
Re: high cpu when dzvents is enabled
Posted: Wednesday 08 August 2018 13:52
by SweetPants
annegerben wrote: ↑Wednesday 08 August 2018 13:20
Egregius wrote: ↑Wednesday 08 August 2018 11:46
My cpu load is 0.2%

But, I don't use any of the internal scripting and I run on a Intel NUC
hahaha, sounds like an overkill
an intel nuc is a bit more expensive then a rpi
Yes, but since I use a NUC (more then 3 years ago now) I never had memory, cpu or disk problems anymore. And when compiling from source, it's way faster then a RPi. For me it was the best investment ever.
Re: high cpu when dzvents is enabled
Posted: Wednesday 08 August 2018 14:15
by Egregius
Might be overkill but you can run a virtualisation platform like EXSI or Proxmox on it and run multiple servers on 1 NUC.
That instantly gives also a great way to make complete system backups. Even if my NUC goes completely down I'm back up and running in one hour.
Re: high cpu when dzvents is enabled
Posted: Wednesday 08 August 2018 14:37
by annegerben
Egregius wrote: ↑Wednesday 08 August 2018 14:15
Might be overkill but you can run a virtualisation platform like EXSI or Proxmox on it and run multiple servers on 1 NUC.
That instantly gives also a great way to make complete system backups. Even if my NUC goes completely down I'm back up and running in one hour.
comparing a € 300 nuc to a € 40 pi isn't really fair.
I understand that the nuc is a nice and powerfull device and I also have a synology DS218+ which could run domoticz.
But I like to run domoticz on a dedicated device so I can keep the down time to a minimum and take the other devices offline when I want or need.
Also no down time (running it on a dedicated device) keeps the WAF high
So if spending €40 on a RPI 3b+ will solve my problem that would be acceptable.
But a solution for my current setup would be even better.
Re: high cpu when dzvents is enabled
Posted: Wednesday 08 August 2018 15:25
by Egregius
Well, the RPi 3B is lot's faster than the RPi2. No doubt about that. I have RPi2, 3 and 3B in the house and the speed difference is quite noticable.
Re: high cpu when dzvents is enabled
Posted: Thursday 09 August 2018 21:07
by waaren
annegerben wrote: ↑Wednesday 08 August 2018 11:41
When I disabled Zwave the cpu usage goes back to normal.
This is not a solution of course ..
other thought: is a rpi 2b sufficient for dzvents?, what is the cpu load on a 3b+
Just wondering could it be that the zwave sconfig is set to update the sensors and devices very frequent ? dzVents loads the device-adapters on every update so with many zwave devices and frequent zwave updates this might have impact.
Re: high cpu when dzvents is enabled
Posted: Friday 10 August 2018 8:13
by annegerben
Received a new rpi3b+ yesterday.
cpu load without dzvents is about 1%
cpu load without dzvents is about 5%
so quite a difference

- 2018-08-10 08_07_44-Window.png (69.31 KiB) Viewed 2495 times