Calculated montly kwh from relay status - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Calculated montly kwh from relay status (/showthread.php?tid=1802) |
Calculated montly kwh from relay status - Kai-Roger - 19.12.2018 Hi. I want to make a simple and cost efficiant way to have an montly overview of kwh for usage of underfloor heatingcables. How much kW the heatingcable is delivering is easily measured with instruments and the measured kW is accurate enough for most uses. My plan is to count the time while the relay for the heating cable is active, and multiply this time with the cables kW for every hour of active relay. Then i want to extract the kWh for each previous month, and add it to a trend. This will when time goes by show the last 2 years of heating cable kWh usage. Does anybody have a script with something similar that can help me on my way? BR Kai-Roger RE: Calculated montly kwh from relay status - buuuudzik - 19.12.2018 You could use something like below. This is for event-based script connected to the status of your heating load. It automatically generates data of your consumption in kWh. You can also add the cost parameter to have it in same place. All current calculations are available in storage. Value is refreshed on every change or update of status. Code: // Event based script And below example is how to use data in your monthly script: Code: energyCounter = storage.get('energy_counter', {price = price, currency = currency, consumers = {}}) RE: Calculated montly kwh from relay status - Kai-Roger - 19.12.2018 Thanks. I will try to understand the code better tomorrow (: |