Fibaro Wall plug inconsistant values
Posted: Monday 20 November 2017 15:25
I've got a fibaro wall plug FGWPE-102 that can monitor electricity usage.
The plug exposes a number of devices in domoticz, one of which shows the current power usage (W)(type/subtype = usage/electricity) and the other that shows power usage & energy consumed (kWh) (type/subtype = energy/kwh).
I'm using the power usage reported to monitor when a washing machine starts and to send a noficication when the washer is finished. I've found a script on this site that I adapted to dzVentss like this.
Problem is that the values for power usage reported by the two 'devices' is not always consistent (especially at lower values).
What would be the preferred way of monitoring the state of the machine, use the power usage only device or the device that also reports energy consumption.
Besides that I find it so strange that a single plug can report two different values for the same parameter.
The plug exposes a number of devices in domoticz, one of which shows the current power usage (W)(type/subtype = usage/electricity) and the other that shows power usage & energy consumed (kWh) (type/subtype = energy/kwh).
I'm using the power usage reported to monitor when a washing machine starts and to send a noficication when the washer is finished. I've found a script on this site that I adapted to dzVentss like this.
Code: Select all
-- Check the wiki at
-- http://www.domoticz.com/wiki/%27dzVents%27:_next_generation_LUA_scripting
return {
-- 'active' controls if this entire script is considered or not
active = true, -- set to false to disable this script
-- trigger
on = {
timer = {
-- timer triggers.. if one matches with the current time then the script is executed
'every minute'
}
},
-- actual event code
-- in case of a timer event or security event, device == nil
execute = function(domoticz, device)
local title = "Wasmachine"
local powermeter_device = 'kWh Meter Wasmachine' --Name of Z-Wave plug that contains actual consumption of washingmachine (in Watts)
local usage_device = 'Usage Wasmachine' --Name of Z-Wave plug that contains actual consumption of washingmachine (in Watts)
local status_uservar = 'wasmachine_status'
local counter_uservar = 'wasmachine_counter' --Name of the uservariable that will contain the counter that is needed
local idle_minutes = 10 --The amount of minutes the consumption has to stay below the 'consumption_lower' value
local consumption_upper = 20 --If usage is higher than this value (Watts), the washingmachine has started
local consumption_lower = 5.0 --If usage is lower than this value (Watts), the washingmachine is idle for a moment/done washing
local myPowermeterDevice = domoticz.devices(powermeter_device)
local myUsageDevice = domoticz.devices(usage_device)
local myStatusVar = domoticz.variables(status_uservar)
local myCounterVar = domoticz.variables(counter_uservar)
--Actual start of the script
domoticz.log('Checking ' .. title.. ' status:')
domoticz.log(title .. ': Powermeter device used : ' .. myPowermeterDevice.name)
domoticz.log(title .. ': Last update : ' .. myPowermeterDevice.lastUpdate.getISO())
domoticz.log(title .. ': Usage : ' .. myPowermeterDevice.usage.. 'W')
domoticz.log(title .. ': WhActual : ' .. myPowermeterDevice.WhActual.. 'W')
--domoticz.log('-------------------------')
--myWasherPowermeter.dump()
domoticz.log('-------------------------')
domoticz.log(title .. ': Usage device used : ' .. myUsageDevice.name)
domoticz.log(title .. ': Last update : ' .. myUsageDevice.lastUpdate.getISO())
domoticz.log(title .. ': WhActual : ' .. myUsageDevice.WhActual .. 'W')
--domoticz.log('-------------------------')
--myWasherUsage.dump()
if (myPowermeterDevice.WhActual ~= myUsageDevice.WhActual) then
domoticz.log('-------------------------')
domoticz.log(title .. ': USAGE FROM USAGE METER & POWER METER ARE NOT THE SAME!!!')
end
domoticz.log('-------------------------')
domoticz.log(title .. ': Status : ' .. myStatusVar.value)
domoticz.log(title .. ': Counter : ' .. myCounterVar.value)
local washer_usage = myUsageDevice.WhActual
--Status is set to off and actual power used is below lower limit: Washing machine is off
if (myStatusVar.value == 0) and (washer_usage <= consumption_lower) then
domoticz.log('Current power usage (' ..washer_usage.. 'W) remains below lower boundary (' ..consumption_lower.. 'W), ' .. title .. ' is off')
end
--Status is set to off but actual power used is above upper limit: Washing machine has started
if (myStatusVar.value == 0) and (washer_usage > consumption_upper) then
myStatusVar.set(1)
domoticz.log('Current power usage (' ..washer_usage.. 'W) is above upper boundary (' ..consumption_upper.. 'W), so ' .. title .. ' has started!')
myCounterVar.set(idle_minutes)
end
--Status is set to on but actual power used is above upper limit: Washing machine is still washing
if (myStatusVar.value == 1) and (washer_usage > consumption_upper) then
domoticz.log('Current power usage (' ..washer_usage.. 'W) is above upper boundary (' ..consumption_upper.. 'W), so ' .. title .. ' is still washing')
if (myCounterVar.value ~= idle_minutes) then
myCounterVar.set(idle_minutes)
domoticz.log('Resetting ' .. title .. ' Idle Timer')
end
end
--Status is set to on but actual power used is below lower limit: Washing machine is idle
if (myStatusVar.value == 1) and (washer_usage <= consumption_lower) then
if (myCounterVar.value == idle_minutes) then
domoticz.log('Current power usage (' ..washer_usage.. 'W) is below lower boundary (' ..consumption_lower.. 'W), ' .. title .. ' seems idle')
else
domoticz.log('Current power usage (' ..washer_usage.. 'W) is below lower boundary (' ..consumption_lower.. 'W), ' .. title .. ' has been idle for ' ..idle_minutes - myCounterVar.value .. ' minutes' )
end
myCounterVar.set(myCounterVar.value-1)
end
--Washing machine is done
if (myStatusVar.value == 1) and (myCounterVar.value <= 0) then
domoticz.log(title .. ' is done!')
myStatusVar.set(0)
domoticz.notify(title, 'The ' .. title .. ' is ready!', domoticz.PRIORITY_NORMAL)
end
end
}
What would be the preferred way of monitoring the state of the machine, use the power usage only device or the device that also reports energy consumption.
Besides that I find it so strange that a single plug can report two different values for the same parameter.