Open analystcmyk opened 1 year ago
Maybe overstretching and out of scope here, but possibly this would not be strictly to be limited to power.
Any value could be "statted" using the sample period , but it would mean having to calculate and store min/max/avg per sample period, while currently we only hold the total per sample period.
Example : Value = Temperature , Sample time = 5 seconds, Sample count = 2
Any plans for moving the stats out of the BLE code? Even just a daily diff like https://github.com/openshwprojects/OpenBK7231T_App/blob/c07f66f3818c7067e60acbf27cb1a5d86f77e692/src/driver/drv_bl_shared.c#L187 would be nice (instead of the full fledged configurable powermeter)
Maybe a script can do the same thing, ill try that as well.
Show energy usage of last hour:
Of course this is not a real running hourly total, as it will reset to zero every hour. A moving window would be better, sharing here anyway.
// measure 1 hr usage, $CH5 holds total kWh
// store the last measured value
setChannelType 10 EnergyTotal_kWh_div100
setChannelLabel 10 EnergyTotal_1hr
// set to total when booting
// check if you need a wait time, some tuya's do not have this value yet when booting
setChannel 10 $CH5;
// channel to hold the usage of last hour
setChannelType 11 EnergyTotal_kWh_div100
setChannelLabel 11 EnergyUse_1hr
// every hour, reset the counter
addRepeatingEventID 3600 -1 111 measure1hr
// and keep updating the hour totals when the energytotal changes
addEventHandler OnChannelChange 5 measure1hr_update
alias measure1hr backlog setChannel 11 $CH5-$CH10; publishChannel 10; setChannel 10 $CH5;
alias measure1h_rupdate backlog setChannel 11 $CH5-$CH10; publishChannel 11;
The power statistics command (SetupEnergyStats) is a great tool, but unfortunately hardcoded to be used only for power measured using the BL driver.
definition
Suggestion : allow statistics to be collected for other type of meters, eg Tuya powermeters.
My autoexec.bat ( using EARU EAMPDW-TY-63 ) :
Thank you for considering.