At the end of each month, my input_number value gets reset to 0. Before its reset, I’d like to write its current value to a txt file for historical purposes. I searched HA and found something about SHELL commands, but I couldent find definitive examples.
So in my flow, I’d place something to do this between the Big Timer node and the ‘Reset Monthly to 0’ node. I just don’t know what.
[{"id":"0a5271580a216855","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"887c0872b6c288d6","type":"switch","z":"0a5271580a216855","name":"Heater running?","property":"data.attributes.hvac_action","propertyType":"msg","rules":[{"t":"eq","v":"heating","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":576,"y":387,"wires":[["1bf3381f42c93e85"],["18924c8fbacbb6ce"]]},{"id":"03d0cde613995902","type":"api-current-state","z":"0a5271580a216855","name":"Thermostat status","server":"ab3e2c53.e3491","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"climate.my_ecobee","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":361,"y":387,"wires":[["887c0872b6c288d6"]]},{"id":"a3e2fa643b7d7eda","type":"change","z":"0a5271580a216855","name":"Status","rules":[{"t":"set","p":"command","pt":"msg","to":"status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":816,"y":504,"wires":[["c615b25b4305a26c","8ecf2a0ad443f59d"]]},{"id":"8ecf2a0ad443f59d","type":"change","z":"0a5271580a216855","name":"Reset","rules":[{"t":"set","p":"command","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":806,"y":540,"wires":[["c615b25b4305a26c"]]},{"id":"c615b25b4305a26c","type":"hourglass","z":"0a5271580a216855","name":"Counter","persistId":"","humanizeLocale":"","x":816,"y":396,"wires":[["b7012b8ce81320d1","64b4d77707cf09f7"]]},{"id":"b7012b8ce81320d1","type":"api-call-service","z":"0a5271580a216855","name":"Add to yearly input number (hours)","server":"ab3e2c53.e3491","version":3,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.heater_on_yearly","data":"{\"value\": $number($entities(\"input_number.heater_on_yearly\").state) + $round(elapsed.millis/3600000,3)}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1122,"y":513,"wires":[[]]},{"id":"1bf3381f42c93e85","type":"change","z":"0a5271580a216855","name":"Start","rules":[{"t":"set","p":"command","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":806,"y":342,"wires":[["c615b25b4305a26c"]]},{"id":"18924c8fbacbb6ce","type":"change","z":"0a5271580a216855","name":"Stop","rules":[{"t":"set","p":"command","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":806,"y":468,"wires":[["c615b25b4305a26c","a3e2fa643b7d7eda"]]},{"id":"64b4d77707cf09f7","type":"api-call-service","z":"0a5271580a216855","name":"Add to monthly input number (hours)","server":"ab3e2c53.e3491","version":3,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.heater_on_monthly","data":"{\"value\": $number($entities(\"input_number.heater_on_monthly\").state) + $round(elapsed.millis/3600000,3)}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1132,"y":441,"wires":[[]]},{"id":"3a2cf379cfab4cc0","type":"server-state-changed","z":"0a5271580a216855","name":"Heater state change","server":"ab3e2c53.e3491","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"climate.my_ecobee","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":136,"y":387,"wires":[["03d0cde613995902"]]},{"id":"5948dd0a94ceeb7a","type":"bigtimer","z":"0a5271580a216855","outtopic":"","outpayload1":"","outpayload2":"","name":"Reset at midnight of new month","comment":"","lat":0,"lon":0,"starttime":"0","endtime":"15","starttime2":0,"endtime2":0,"startoff":0,"endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":false,"mon":false,"tue":false,"wed":false,"thu":false,"fri":false,"sat":true,"jan":false,"feb":false,"mar":false,"apr":false,"may":false,"jun":false,"jul":false,"aug":false,"sep":false,"oct":false,"nov":false,"dec":false,"day1":"30","month1":"1","day2":"27","month2":"2","day3":"30","month3":"3","day4":"29","month4":"4","day5":"30","month5":"5","day6":"29","month6":"6","day7":"30","month7":"7","day8":"30","month8":"8","day9":"29","month9":"9","day10":"30","month10":"10","day11":"29","month11":"11","day12":"30","month12":"12","d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":0,"xmonth7":0,"xday8":0,"xmonth8":0,"xday9":0,"xmonth9":0,"xday10":0,"xmonth10":0,"xday11":0,"xmonth11":0,"xday12":0,"xmonth12":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":1113,"y":288,"wires":[["d1c4146fc71715e5"],[],[]]},{"id":"d1c4146fc71715e5","type":"api-call-service","z":"0a5271580a216855","name":"Reset monthly to 0","server":"ab3e2c53.e3491","version":3,"debugenabled":false,"service_domain":"input_number","service":"set_value","entityId":"input_number.heater_on_monthly","data":"{\"value\":0}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1072,"y":369,"wires":[[]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]