waaren wrote: Sunday 19 January 2020 23:22
value is not an attribute of a kWh device.
Available attributes for this type device are counterToday, usage, WhToday, WhTotal and WhActual
thanks, i use usage and now i get the value.
but where i can find for every type of dummy devices whats the correct attribute that i can use inside dzvents?
if i'm not wrong i not find inside the wiki.
come back to my script, now i introduce the some log before if i verify the energy usage and the state of my device that are the checking part of my "iF"
it seams that the condition are true, but the script do not enter inside the "if"
Code: Select all
dz.log('AUTOCONSUMO = ' ..autoconsumo.usage , dz.LOG_DEBUG)
dz.log('state of calorifero_mans = ' ..calorifero_mans.state)
local function manageSwitches()
if autoconsumo.usage >= 200 and calorifero_mans.state == "On" then --and calorifero1p.state == "On"
dz.log('AUTOCONSUMO = ' ..autoconsumo.usage , dz.LOG_DEBUG)
dz.log('INSIDE IF', dz.LOG_DEBUG)
and if i look at the log:
Code: Select all
2020-01-20 09:54:00.475 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: Processing device-adapter for PDC automation: Switch device adapter
2020-01-20 09:54:00.475 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: AUTOCONSUMO = 2242
2020-01-20 09:54:00.475 Status: dzVents: Info: OTTIMIZZAZIONE INVERNO: state of calorifero_mans = On
2020-01-20 09:54:00.475 Status: dzVents: Info: OTTIMIZZAZIONE INVERNO: ------ Finished OTTIMIZZAZIONE INVERNO
it show correct extraction of parameter "autoconsumo" and device state is On
but the script do no enter inside "if" otherwise i expect to read inside log the line: 'INSIDE IF'
here complete script and log
Code: Select all
-- script for winter opttimization
return {
-- active = function(domoticz)
--return domoticz.devices('OTTIMIZZA_INVERNO').state == 'On' -- Change this to your control switch name or id
--end,
on = {
timer = { 'every 1 minutes at 9:00-15:30 ' }, --from 1 october to 1 april on 1/10-31/12,1/1-1/4
},
logging = {
level = domoticz.LOG_DEBUG,
marker = "OTTIMIZZAZIONE INVERNO"
},
execute = function(dz, item)
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local calorifero1p = dz.devices("Calorifero_Bagno_PT")
local calorifero_mans = dz.devices("Calorifero_Bagno_Mansarda")
local vcm_1p = dz.devices("VCM_Piano_Terra")
local vcm_mans = dz.devices("VCM_Mansarda")
local PDC = dz.devices("PDC")
local autoconsumo = dz.devices("Autoconsumo")
local SCRIPT_PDC_VALVOLE = dz.devices("SCRIPT_PDC_VALVOLE")
local PDC_automation = dz.devices("PDC automation")
dz.log('AUTOCONSUMO = ' ..autoconsumo.usage , dz.LOG_DEBUG)
dz.log('state of calorifero_mans = ' ..calorifero_mans.state)
local function manageSwitches()
if autoconsumo.usage >= 200 and calorifero_mans.state == "On" then --and calorifero1p.state == "On"
dz.log('AUTOCONSUMO = ' ..autoconsumo.usage , dz.LOG_DEBUG)
dz.log('INSIDE IF', dz.LOG_DEBUG)
calorifero1p.swichOff()
calorifero_mans.swichOff()
dz.log('SWITCH OFF MANS', dz.LOG_DEBUG)
vcm_1p.swichOff()
vcm_mans.swichOff()
--TURN ON PDC ( per vedere se c'è energia per accendere la pompa)
--PDC.switchOn().afterSec(10)
SCRIPT_PDC_VALVOLE.switchOn()
PDC_automation.switchOn()
end
end
end
}
Code: Select all
2020-01-20 09:54:00.458 Status: dzVents: Info: OTTIMIZZAZIONE INVERNO: ------ Start internal script: OTTIMIZZAZIONE INVERNO:, trigger: every 1 minutes at 9:00-15:30
2020-01-20 09:54:00.461 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: Processing device-adapter for Calorifero_Bagno_PT: Switch device adapter
2020-01-20 09:54:00.464 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: Processing device-adapter for Calorifero_Bagno_Mansarda: Switch device adapter
2020-01-20 09:54:00.466 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: Processing device-adapter for VCM_Piano_Terra: Switch device adapter
2020-01-20 09:54:00.468 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: Processing device-adapter for VCM_Mansarda: Switch device adapter
2020-01-20 09:54:00.471 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: Processing device-adapter for PDC: Switch device adapter
2020-01-20 09:54:00.473 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: Processing device-adapter for Autoconsumo: kWh device adapter
2020-01-20 09:54:00.475 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: Processing device-adapter for PDC automation: Switch device adapter
2020-01-20 09:54:00.475 Status: dzVents: Debug: OTTIMIZZAZIONE INVERNO: AUTOCONSUMO = 2242
2020-01-20 09:54:00.475 Status: dzVents: Info: OTTIMIZZAZIONE INVERNO: state of calorifero_mans = On
2020-01-20 09:54:00.475 Status: dzVents: Info: OTTIMIZZAZIONE INVERNO: ------ Finished OTTIMIZZAZIONE INVERNO