Page 1 of 1
Why does this dzVents script not work
Posted: Monday 01 June 2020 19:31
by RvdM
Hi all,
After migrating to the newest version of Domoticz my climatControl scripts (written in dzVents) stopped working.
Based on the temperature and humidity in our home certain user variables are regularly set.
Based on several time scripts the mechanical fan should switch to a lower or higher RPM (DIMMER 0-10V Z-WAVE)
Tried to get this working again but somehow I can't. Even the log line doesn't work.
Code: Select all
return {
active = true,
on = {
['timer'] = {'at 19:28'}
},
logging = {
level = domoticz.LOG_DEBUG,
},
execute = function(dz)
fan = dz.devices('Mechanische Ventilatie')
target = domoticz.variables('climatControlBaselinePostCooking').value
domoticz.log('Mechanische ventilatie snelheid wordt aangepast (Post-Cooking) - Level: ' .. target )
fan.switchSelector(target)
end
}
Logging:
- Spoiler: show
- 2020-06-01 19:28:00.086 Status: dzVents: Info: ------ Start internal script: climatControlPostCooking:, trigger: "at 19:28"
2020-06-01 19:28:00.090 Status: dzVents: Debug: Processing device-adapter for Mechanische Ventilatie: Switch device adapter
2020-06-01 19:28:00.090 Status: dzVents: Info: ------ Finished climatControlPostCooking
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 19:50
by besix
I don't know dzVents, but it can help
Code: Select all
return {
active = true,
on = {
['timer'] = {'at 19:28'}
},
logging = {
level = domoticz.LOG_DEBUG,
},
execute = function(dz)
fan = dz.devices('Mechanische Ventilatie')
target = dz.variables('climatControlBaselinePostCooking').value
dz.log('Mechanische ventilatie snelheid wordt aangepast (Post-Cooking) - Level: ' .. target )
fan.switchSelector(target)
end
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 20:06
by waaren
RvdM wrote: ↑Monday 01 June 2020 19:31
Tried to get this working again but somehow I can't. Even the log line doesn't work.
You cannot mix dz (first parm of the execute function) and domoticz in the body of the script. Either they are both dz or both domoticz.
What are the possible values of the variable climatControlBaselinePostCooking ?
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 21:15
by RvdM
waaren wrote: ↑Monday 01 June 2020 20:06
RvdM wrote: ↑Monday 01 June 2020 19:31
Tried to get this working again but somehow I can't. Even the log line doesn't work.
You cannot mix dz (first parm of the execute function) and domoticz in the body of the script. Either they are both dz or both domoticz.
What are the possible values of the variable climatControlBaselinePostCooking ?
Ah yes. With that the printing works. However still not the adjustment of the fan.
User variable is a integer.
Code: Select all
return {
active = true,
on = {
['timer'] = {'at 21:14'}
},
logging = {
level = domoticz.LOG_DEBUG,
},
execute = function(dz)
fan = dz.devices('Mechanische Ventilatie')
target = dz.variables('climatControlBaselinePostCooking').value
dz.log('Mechanische ventilatie snelheid wordt aangepast (Post-Cooking) - Level: ' .. target )
fan.switchSelector(target)
end
}
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 21:43
by besix
User variable is a integer.
But for the selector
must be 0ff, 10, 20 ..... 60
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 21:48
by RvdM
Shouldnt that be fine with an integer?
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 21:52
by besix
Code example for selector
Code: Select all
if (dz.devices('Kominek').state == 'On' and dz.variables('kominek').value == 0) then
dz.devices('Kominek Wentylator').switchOn()
dz.devices('Kominek przepustnica').switchSelector(60)
dz.log('Rozpalanie')
The position of the selector 60 is the name of the level.
Level 1 is Off, 2 is 10, 3 is 20 etc.
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 22:21
by waaren
RvdM wrote: ↑Monday 01 June 2020 21:48
Shouldnt that be fine with an integer?
Yes, it should. Can you show whats in the log ?
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 22:27
by waaren
besix wrote: ↑Monday 01 June 2020 21:52
The position of the selector 60 is the name of the level.
Sorry but no.
60 is the level in this example. The name can be any string.
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 22:42
by RvdM
waaren wrote: ↑Monday 01 June 2020 22:21
RvdM wrote: ↑Monday 01 June 2020 21:48
Shouldnt that be fine with an integer?
Yes, it should. Can you show whats in the log ?
Code: Select all
2020-06-01 22:29:00.464 Status: dzVents: Info: ------ Start internal script: climatControlPostCooking:, trigger: "at 22:29"
2020-06-01 22:29:00.468 Status: dzVents: Debug: Processing device-adapter for Mechanische Ventilatie: Switch device adapter
2020-06-01 22:29:00.468 Status: dzVents: Info: Mechanische ventilatie snelheid wordt aangepast (Post-Cooking) - Level: 50
2020-06-01 22:29:00.468 Status: dzVents: Info: ------ Finished climatControlPostCooking
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 22:45
by waaren
RvdM wrote: ↑Monday 01 June 2020 22:42
[
Code: Select all
2020-06-01 22:29:00.464 Status: dzVents: Info: ------ Start internal script: climatControlPostCooking:, trigger: "at 22:29"
2020-06-01 22:29:00.468 Status: dzVents: Debug: Processing device-adapter for Mechanische Ventilatie: Switch device adapter
2020-06-01 22:29:00.468 Status: dzVents: Info: Mechanische ventilatie snelheid wordt aangepast (Post-Cooking) - Level: 50
2020-06-01 22:29:00.468 Status: dzVents: Info: ------ Finished climatControlPostCooking
I assume based on this that the device is not set at level 50 ?
Can you show a printscreen of the levels of the device?
What is the type / subtype (as seen on the device tab?
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 22:53
by RvdM
See attached, and no its not set to 50
Re: Why does this dzVents script not work [Solved]
Posted: Monday 01 June 2020 22:58
by besix
selector please no dimmer
or
Code: Select all
return {
active = true,
on = {
['timer'] = {'at 19:28'}
},
logging = {
level = domoticz.LOG_DEBUG,
},
execute = function(dz)
fan = dz.devices('Mechanische Ventilatie')
target = dz.variables('climatControlBaselinePostCooking').value
dz.log('Mechanische ventilatie snelheid wordt aangepast (Post-Cooking) - Level: ' .. target )
fan.dimTo(target)
end
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 23:13
by waaren
RvdM wrote: ↑Monday 01 June 2020 22:53
See attached, and no its not set to 50
switchSelector is to be used for selector type devices. For dimmers you should use the dimTo() method
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 23:16
by RvdM
That indeed was the probleem. No sure why it worked in older versions of Domoticz because this script was from a post 2020 release
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 23:23
by RvdM
Just started up the old machine and the code looks like this
Code: Select all
return {
active = true,
on = {
['timer'] = {'at 18:30'}
},
execute = function(domoticz)
domoticz.log('Ventilatie op post-kookstand')
domoticz.devices('Mechanische Ventilatie').switchSelector(domoticz.variables('climatControlBaselinePostCooking').value)
end
}
Re: Why does this dzVents script not work
Posted: Monday 01 June 2020 23:37
by waaren
RvdM wrote: ↑Monday 01 June 2020 23:23
Just started up the old machine.
Could well be that this switchSelector() method worked in your old version. It was never intended to work on a dimmer device and since the change in the switchSelector code in dzVents 2.4.22 it no longer work for dimmers.