Page 1 of 1
Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 15:22
by PeterRozenveld
I keep getting an error in line 21:
" Local kmptt = .... "
Does a Dummy (Watts) have different value names ?
And is it possible to use the IF and THEN statement several times in a row ?
Code: Select all
return
{
on =
{
devices =
{
'Kookplaat_F1_(Rechts)',
'Kookplaat_F3_(Links_Flexzone)',
'Tot_Fornuis'
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'Regulating Afz_350',
},
execute = function(dz, devices)
local kpmtt = domoticz.devices('Tot_Fornuis') -- Tot_Fornuis is a dummy. But .usage or .actualWatt doesn´t work !
if kpmtt >= 100 and kmptt < 350 then
domoticz.openURL('192.168.2.171/light/0?turn=on&brightness=45')
end
end
}
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 15:41
by waltervl
Check the device type and see what are the available Dzvents properties for that device (dummy or not does not matter):
https://wiki.domoticz.com/DzVents:_next ... ic_devices
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 15:57
by PeterRozenveld
I tried the following
local kpmtt = domoticz.devices(‘Tot Stove’).Energy
local kpmtt = domoticz.devices(‘To-Stove’).Usage
local kpmtt = domoticz.devices(‘To-Stove’).actualWatt
none of them work....
And the translation in Domoticz from Dummy Hardware to Dutch is quite confusing !
Code: Select all
2025-01-20 15:55:44.526 Error: dzVents: Error: (3.1.8) Regulating Afz_350: An error occurred when calling event handler 12_Afzuigkap_Regulated_100-350
2025-01-20 15:55:44.526 Error: dzVents: Error: (3.1.8) Regulating Afz_350: ...nts/generated_scripts/12_Afzuigkap_Regulated_100-350.lua:21: attempt to index a nil value (global 'domoticz')
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 16:01
by waltervl
Can you post a screenshot of the device widget (it shows the device type) or from the Dummy list tell what you have selected:
https://wiki.domoticz.com/Dummy_for_virtual_Switches
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 16:54
by boum
first fix the basic error between
and
Code: Select all
local kpmtt = domoticz.devices('Tot_Fornuis') -- Tot_Fornuis is a dummy. But .usage or .actualWatt doesn´t work !
use either domoticz or dz everywhere but not a mix
then follow the advice and find the type of the device to determine which property to query
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 17:25
by PeterRozenveld
Ok thx!
Done
It's : Usage, Electricity and the property? is .POWER
but that seems not to work either.
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 18:10
by waltervl
That is the description. The dzvents options are:
Electric usage
.actualWatt: Number. Current Watt usage.
.WhActual: Number. Current Watt usage. (please use actualWatt)
.updateEnergy(energy): Function. In Watt.
But also make sure you do not mixup domoticz and dz references....
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 18:18
by habahabahaba
Code: Select all
execute = function(domoticz, item)
local kpmtt = domoticz.devices(113) --idx of Electric counter
if kpmtt.actualWatt >= 100 and kpmtt.actualWatt < 350 then
domoticz.log('Current electricity usage:', domoticz.LOG_INFO)
domoticz.log(kpmtt.actualWatt .. ' Watt', domoticz.LOG_INFO)
end
end
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 19:21
by PeterRozenveld
sorry doesn´t seem to work.
Re: Something stupid , a dummy problem "actualWatt"
Posted: Monday 20 January 2025 20:22
by waltervl
PeterRozenveld wrote: ↑Monday 20 January 2025 19:21
sorry doesn´t seem to work.
This is not the whole script. Please use common dzvents sense here
And telling it does not work does also not help. Tell exactly what is not working...
Re: Something stupid , a dummy problem "actualWatt"
Posted: Tuesday 21 January 2025 6:21
by habahabahaba
Show the full script and the log
Re: Something stupid , a dummy problem "actualWatt"
Posted: Tuesday 21 January 2025 13:31
by PeterRozenveld
I will be absent until Friday