Advertisement
i670684

Node Red flow

Mar 9th, 2024
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.49 KB | None | 0 0
  1. [{"id":"668f7f4d823b7826","type":"subflow","name":"Subflow 1","info":"","in":[{"x":160,"y":60,"wires":[{"id":"4f5c8f7de9427aa9"}]}],"out":[]},{"id":"4f5c8f7de9427aa9","type":"delay","z":"668f7f4d823b7826","name":"limit","pauseType":"rate","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"15","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":290,"y":60,"wires":[["320e0f8446248277"]]},{"id":"320e0f8446248277","type":"change","z":"668f7f4d823b7826","name":"set payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.charge_state.battery_level","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":60,"wires":[["f9ec108e18ae2b99","1a2e6ea420e7342f"]]},{"id":"f9ec108e18ae2b99","type":"convert","z":"668f7f4d823b7826","name":"Number","convertTo":"number","x":580,"y":60,"wires":[["f015d857f0976466"]]},{"id":"f015d857f0976466","type":"influxdb out","z":"668f7f4d823b7826","influxdb":"637c445f.716e74","name":"","measurement":"teslaSOC","precision":"","retentionPolicy":"","database":"","retentionPolicyV18Flux":"","org":"","bucket":"","x":810,"y":60,"wires":[]},{"id":"1a2e6ea420e7342f","type":"mqtt out","z":"668f7f4d823b7826","name":"Tesla/Mantacore/SoC","topic":"Tesla/Mantacore/SoC","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"c605faa7.393b8","x":680,"y":120,"wires":[]},{"id":"637c445f.716e74","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"mydb","name":"","usetls":false,"tls":"63dc698c.a7b1b","influxdbVersion":"1.x"},{"id":"63dc698c.a7b1b","type":"tls-config","name":"victron","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"venus-ca.crt","verifyservercert":true},{"id":"fde0a1de2ae3acae","type":"subflow","name":"Tesla Location","info":"","category":"","in":[{"x":60,"y":80,"wires":[{"id":"aed12bbc1e87d363"}]}],"out":[{"x":1040,"y":80,"wires":[{"id":"609011a5ef067291","port":0},{"id":"af0fed44f050af7f","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"0a17581e8561634c","type":"catch","z":"fde0a1de2ae3acae","name":"","scope":["08de361b1c69d51f"],"uncaught":false,"x":200,"y":160,"wires":[[]]},{"id":"08de361b1c69d51f","type":"tesla-api","z":"fde0a1de2ae3acae","teslaConfig":"556502263f9abba0","command":"driveState","name":"Location","vehicleID":"1492657034489431","autoWakeUp":false,"x":180,"y":40,"wires":[[]]},{"id":"609011a5ef067291","type":"change","z":"fde0a1de2ae3acae","name":"\"home\"","rules":[{"t":"set","p":"payload.location","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":60,"wires":[[]]},{"id":"af0fed44f050af7f","type":"change","z":"fde0a1de2ae3acae","name":"\"away\"","rules":[{"t":"set","p":"payload.location","pt":"msg","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":120,"wires":[[]]},{"id":"1b52f3d65216dd0f","type":"geofence","z":"fde0a1de2ae3acae","name":"Home","mode":"circle","inside":"both","rad":1209.0949035227702,"points":[],"centre":{"latitude":-38.74811960840397,"longitude":143.38849872350693},"floor":"","ceiling":"","worldmap":false,"outputs":1,"x":530,"y":80,"wires":[["689fcd938035a3ef"]]},{"id":"aed12bbc1e87d363","type":"change","z":"fde0a1de2ae3acae","name":"","rules":[{"t":"set","p":"payload.lat","pt":"msg","to":"payload.drive_state.latitude","tot":"msg"},{"t":"set","p":"payload.lon","pt":"msg","to":"payload.drive_state.longitude","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":80,"wires":[["1b52f3d65216dd0f"]]},{"id":"689fcd938035a3ef","type":"switch","z":"fde0a1de2ae3acae","name":"","property":"location.inarea","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":690,"y":80,"wires":[["609011a5ef067291"],["af0fed44f050af7f"]]},{"id":"1f5d142db86e6391","type":"comment","z":"fde0a1de2ae3acae","name":"Define home location in this node","info":"","x":530,"y":120,"wires":[]},{"id":"463a2bddfe31a8d2","type":"comment","z":"23ef37abdce18c52","name":"global.TeslaActualChargePower","info":"Setting global.TeslaActualChargePower \nenables TeslaActualChargePower \nto be removed from the calculations of \ndaily residential power usage so we can \npredict power usage not skewed by Tesla \ncharging.","x":730,"y":660,"wires":[]},{"id":"a3025190d061e1c0","type":"inject","z":"23ef37abdce18c52","name":"Rpt","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"120","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":70,"y":360,"wires":[["1cdaa7f527e39e0b"]]},{"id":"e2be7e2f238ff621","type":"inject","z":"23ef37abdce18c52","name":"Daily 0600","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 06 * * *","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":60,"wires":[["abe799aefe2f3403"]]},{"id":"436ba47c7aee39da","type":"debug","z":"23ef37abdce18c52","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":410,"y":60,"wires":[]},{"id":"0c60d2fc6bc13616","type":"switch","z":"23ef37abdce18c52","name":"charging?","property":"payload.charge_state.charging_state","propertyType":"msg","rules":[{"t":"eq","v":"Charging","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":220,"y":400,"wires":[["f938c57e1c987ea9"],["af49ee6cce964ac6"]]},{"id":"163334101645c789","type":"tesla-api","z":"23ef37abdce18c52","teslaConfig":"556502263f9abba0","command":"setChargingAmps","name":"setChargingAmps","vehicleID":"3744424814825633","autoWakeUp":false,"x":1150,"y":700,"wires":[[]]},{"id":"c75a251b0cb899b1","type":"link in","z":"23ef37abdce18c52","name":"Set charging off","links":["aede7faf300907d9"],"x":120,"y":220,"wires":[["12f9daefc5758dee"]],"l":true},{"id":"f9c97c19db9c3403","type":"switch","z":"23ef37abdce18c52","name":"SOC 20%, 25%, >","property":"BatterySOC","propertyType":"global","rules":[{"t":"lt","v":"20","vt":"num"},{"t":"lt","v":"25","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":230,"y":660,"wires":[["1100ed1503a91f37"],["915a3d89034b9cc0"],["a6bfaeb2ba44ad1c"]],"outputLabels":["<20","<25","Other"]},{"id":"62552824d2bd4452","type":"change","z":"23ef37abdce18c52","name":"Stopped","rules":[{"t":"set","p":"payload","pt":"msg","to":"Tesla charging stopped due to low SOC","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Warning","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":380,"wires":[["05b32f1d73c51ee6"]]},{"id":"12f9daefc5758dee","type":"change","z":"23ef37abdce18c52","name":"hdr","rules":[{"t":"set","p":"payload","pt":"msg","to":"Tesla charging stopped","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Warning","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":260,"wires":[["05b32f1d73c51ee6"]]},{"id":"896b0f28bc9376da","type":"catch","z":"23ef37abdce18c52","name":"","scope":["2b7f180127edba90","8d77e0bb801b559e"],"uncaught":false,"x":140,"y":1020,"wires":[["ea9f235862c0271a"]]},{"id":"ea9f235862c0271a","type":"switch","z":"23ef37abdce18c52","name":"Filter 401,408","property":"msg.error.message","propertyType":"jsonata","rules":[{"t":"eq","v":"Error response: 408","vt":"str"},{"t":"eq","v":"Error response: 401","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":290,"y":1020,"wires":[["503aaba1582024a3"],["4a147350c4474cb5"],["4a147350c4474cb5"]]},{"id":"06b6e866afeb3c28","type":"function","z":"23ef37abdce18c52","name":"Amps adjust","func":"// Adjust charge rate so as to minimise draw from battery \nmsg.commandArgs = new Object();\nvar houseSOC_full_enough = 85;\nvar logmsg = \"\"; // send this to grafana \nvar soc = msg.payload.charge_state.battery_level;\nvar cur_amps = msg.payload.charge_state.charge_amps; // current charging amps setting\nvar batpower = global.get(\"BatPower\"); // current battery draw\nvar BatterySOC = global.get(\"BatterySOC\");\nvar ACFreq = global.get(\"ACFrequency\");\nvar TeslaSOC = flow.get(\"TeslaSOC\");\nvar ampsManualSetting = flow.get(\"Tesla/Mantacore/manualchargeamps\");\n\n//if (soc < 95) batpower = batpower - 1500; // TEMP TEMP keep 1500w charging\n\nvar amps_adjust = batpower / 228;\nvar mode;\n\ncur_amps = Math.round(cur_amps);\nvar new_amps = Math.round(cur_amps + amps_adjust); // default is try to zero out battery drain/charge\n\nif (ampsManualSetting > 0) { // >zero means manual\n new_amps = ampsManualSetting; // set it to manual\n flow.set(\"Tesla/Mantacore/manualchargeamps\", new_amps);\n logmsg = \"Tesla charging amps=\" + new_amps;\n if (ACFreq > 50.3) {\n new_amps = new_amps + 15; // if Victron throttling charging, bump charge rate\n logmsg = \"Victron throttling so Tesla charge amps increased\";\n } \n mode = ' manual';\n}\nelse if (ampsManualSetting < 0) { // was not charging \n logmsg = \"Tesla started charging - auto\";\n flow.set(\"Tesla/Mantacore/manualchargeamps\", new_amps);\n}\nelse { // must be automatic\n mode = ' auto'; // assume auto until proven otherwise\n if (BatterySOC < houseSOC_full_enough) {\n new_amps = new_amps - 5; // save a bit for the battery\n }\n else { // auto and fullish house battery\n new_amps = 32; \n logmsg = \"Tesla auto charging max as full house battery\";\n }\n}\nif (new_amps > 32) new_amps = 32;\nif (new_amps < 2) new_amps = 2;\n\nmsg.payload = \"Changing charge rate from \" + cur_amps + \" to \" + new_amps;\nmsg.commandArgs.amps = new_amps;\n\nvar label = new_amps+'A '+soc+'%'+mode;\nnode.status({text:label});\n\nreturn [msg, {payload:logmsg}];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":720,"wires":[["3ab573ea68ef13ee"],["f5fd2af77a595e74"]]},{"id":"1ec9045d43c32bac","type":"mqtt in","z":"23ef37abdce18c52","name":"Tesla/Mantacore/manualchargeamps","topic":"Tesla/Mantacore/manualchargeamps","qos":"2","datatype":"auto-detect","broker":"c605faa7.393b8","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":160,"wires":[["35a8f1c17b6184ed"]]},{"id":"7b514b08b9267f8f","type":"mqtt out","z":"23ef37abdce18c52","name":"Tesla/Mantacore/actualchargeamps","topic":"Tesla/Mantacore/actualchargeamps","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"c605faa7.393b8","x":1130,"y":640,"wires":[]},{"id":"aa0150796e453adc","type":"change","z":"23ef37abdce18c52","name":"set payload & global.TeslaActualChargePower","rules":[{"t":"set","p":"TeslaActualChargePower","pt":"global","to":"(payload.charge_state.charger_actual_current * payload.charge_state.charger_voltage)","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"payload.charge_state.charger_actual_current","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":640,"wires":[["7b514b08b9267f8f"]]},{"id":"35a8f1c17b6184ed","type":"convert","z":"23ef37abdce18c52","name":"","convertTo":"number","x":450,"y":160,"wires":[["ec3f7b1eb095fc20"]]},{"id":"724fc20f22ec739a","type":"change","z":"23ef37abdce18c52","name":"save flow variable Tesla/Mantacore/manualchargeamps","rules":[{"t":"set","p":"Tesla/Mantacore/manualchargeamps","pt":"flow","to":"payload","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":140,"wires":[["dcacc8e2f311365a","657ed394a24cdcf0"]]},{"id":"d8965b52332d79f9","type":"comment","z":"23ef37abdce18c52","name":"This is manual amps set by OpenHab (resets when charging ends). See notes inside.","info":"value of zero indicates disable manual mode\nvalue of -1 indicates disable all logic on this page","x":330,"y":120,"wires":[]},{"id":"af49ee6cce964ac6","type":"change","z":"23ef37abdce18c52","name":"Rate = -1","rules":[{"t":"set","p":"payload","pt":"msg","to":"-1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":420,"wires":[["724fc20f22ec739a","6da67c07a215eabb"]]},{"id":"3ab573ea68ef13ee","type":"delay","z":"23ef37abdce18c52","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"2","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":840,"y":700,"wires":[["163334101645c789"]]},{"id":"3e4b19c9d09979b2","type":"inject","z":"23ef37abdce18c52","name":"Reset manual","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":450,"y":440,"wires":[["af49ee6cce964ac6"]]},{"id":"15e3fdf1d8811b7e","type":"inject","z":"23ef37abdce18c52","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":860,"wires":[["89b5381af906d0a1"]]},{"id":"89b5381af906d0a1","type":"tesla-api","z":"23ef37abdce18c52","teslaConfig":"556502263f9abba0","command":"vehicleData","name":"Vehicle state","vehicleID":"3744424814825633","autoWakeUp":false,"x":310,"y":860,"wires":[["ea6cc3b777ccbc93"]]},{"id":"ea6cc3b777ccbc93","type":"debug","z":"23ef37abdce18c52","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":860,"wires":[]},{"id":"48879fe48bf8e4d6","type":"inject","z":"23ef37abdce18c52","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":400,"y":200,"wires":[["12f9daefc5758dee"]]},{"id":"822759ebacd06415","type":"subflow:fde0a1de2ae3acae","z":"23ef37abdce18c52","name":"Get location","env":[],"x":490,"y":480,"wires":[[]]},{"id":"ec3f7b1eb095fc20","type":"switch","z":"23ef37abdce18c52","name":"map values","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"2","vt":"num"},{"t":"lt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":630,"y":160,"wires":[["724fc20f22ec739a"],["724fc20f22ec739a"],["7058279f96bc0e09"]],"info":"Makes it easier to set the slider to 0 for automation. \nSo if you don't quite hit zero, it will still function as zero."},{"id":"7058279f96bc0e09","type":"change","z":"23ef37abdce18c52","name":"0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":180,"wires":[["724fc20f22ec739a"]]},{"id":"93e466885f4cbf1c","type":"link out","z":"23ef37abdce18c52","name":"Telegram","links":["a7ffd00d.060ac8"],"x":1380,"y":420,"wires":[],"l":true},{"id":"dcacc8e2f311365a","type":"rbe","z":"23ef37abdce18c52","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":990,"y":180,"wires":[["ddbbeda05c8bb83f","a5700b32cf8e9d6a"]]},{"id":"f938c57e1c987ea9","type":"switch","z":"23ef37abdce18c52","name":"At home?","property":"TeslaLocation","propertyType":"flow","rules":[{"t":"eq","v":"Home","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":220,"y":540,"wires":[["0d6acc067e8b5e9a","0116fb082f1f8d29"]]},{"id":"096bdfc430ac0742","type":"subflow:668f7f4d823b7826","z":"23ef37abdce18c52","name":"Log SOC","x":1040,"y":300,"wires":[]},{"id":"4a147350c4474cb5","type":"debug","z":"23ef37abdce18c52","name":"error","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"error.message","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":1040,"wires":[]},{"id":"a1d3ff644021a3bd","type":"comment","z":"23ef37abdce18c52","name":"this api call won't wake car","info":"","x":150,"y":260,"wires":[]},{"id":"5c6b9d7425c3d296","type":"comment","z":"23ef37abdce18c52","name":"Not charging","info":"","x":650,"y":380,"wires":[]},{"id":"6818d739fe51bd25","type":"link out","z":"23ef37abdce18c52","name":"Log","mode":"link","links":["f37a0ccc.3830c8"],"x":1190,"y":740,"wires":[],"l":true},{"id":"42d06a5af3f18ee4","type":"link out","z":"23ef37abdce18c52","name":"Log","links":["f37a0ccc.3830c8"],"x":1270,"y":180,"wires":[],"l":true},{"id":"ddbbeda05c8bb83f","type":"change","z":"23ef37abdce18c52","name":"header","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"Tesla manual amps \" &payload","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Info","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":180,"wires":[["42d06a5af3f18ee4"]]},{"id":"1e7f5aa3ac1aaf71","type":"change","z":"23ef37abdce18c52","name":"set auto Tesla/Mantacore/manualchargeamps","rules":[{"t":"set","p":"Tesla/Mantacore/manualchargeamps","pt":"flow","to":"0","tot":"num","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":580,"wires":[["f9c97c19db9c3403","080160babebcaf2f"]]},{"id":"0116fb082f1f8d29","type":"switch","z":"23ef37abdce18c52","name":"Just started charging?","property":"Tesla/Mantacore/manualchargeamps","propertyType":"flow","rules":[{"t":"eq","v":"-1","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":440,"y":600,"wires":[["dadc491753b78ac6"],["f9c97c19db9c3403"]]},{"id":"92798ade67dc88ac","type":"delay","z":"23ef37abdce18c52","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":880,"y":300,"wires":[["096bdfc430ac0742"]]},{"id":"657ed394a24cdcf0","type":"debug","z":"23ef37abdce18c52","name":"debug 16","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1200,"y":100,"wires":[]},{"id":"11c13fbb5528bd31","type":"link out","z":"23ef37abdce18c52","name":"link out 1","mode":"link","links":["cc63c70313b3e544"],"x":815,"y":540,"wires":[]},{"id":"5b68087b340dd930","type":"change","z":"23ef37abdce18c52","name":"","rules":[{"t":"set","p":"TeslaSOC","pt":"flow","to":"payload.charge_state.battery_level","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":280,"wires":[[]]},{"id":"e55a48ddb04adca5","type":"change","z":"23ef37abdce18c52","name":"Now charging Tesla","rules":[{"t":"set","p":"payload","pt":"msg","to":"Now charging Tesla","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Info","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":500,"wires":[["93e466885f4cbf1c"]]},{"id":"0d6acc067e8b5e9a","type":"within-time-switch","z":"23ef37abdce18c52","name":"Overnight?","nameInt":"","positionConfig":"66485716e30801af","startTime":"05:00","startTimeType":"entered","startOffset":0,"startOffsetType":"none","startOffsetMultiplier":60000,"endTime":"sunsetStart","endTimeType":"pdsTime","endOffset":"180","endOffsetType":"num","endOffsetMultiplier":60000,"timeRestrictions":0,"timeRestrictionsType":"none","timeDays":"*","timeOnlyOddDays":false,"timeOnlyEvenDays":false,"timeOnlyOddWeeks":false,"timeOnlyEvenWeeks":false,"timeMonths":"*","timedatestart":"","timedateend":"","propertyStart":"","propertyStartType":"none","propertyStartCompare":"true","propertyStartThreshold":"","propertyStartThresholdType":"num","startTimeAlt":"","startTimeAltType":"entered","startOffsetAlt":0,"startOffsetAltType":"none","startOffsetAltMultiplier":60000,"propertyEnd":"","propertyEndType":"none","propertyEndCompare":"true","propertyEndThreshold":"","propertyEndThresholdType":"num","endTimeAlt":"","endTimeAltType":"entered","endOffsetAlt":0,"endOffsetAltType":"none","endOffsetAltMultiplier":60000,"withinTimeValue":"","withinTimeValueType":"msgInput","outOfTimeValue":"","outOfTimeValueType":"msgInput","tsCompare":"0","x":470,"y":540,"wires":[[],["be47f48e616b0eb0"]]},{"id":"6da67c07a215eabb","type":"change","z":"23ef37abdce18c52","name":"global.TeslaActualChargePower=0","rules":[{"t":"set","p":"TeslaActualChargePower","pt":"global","to":"0","tot":"num"},{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":340,"wires":[["f9a59e45e30e1e37"]]},{"id":"79afc334273e980d","type":"delay","z":"23ef37abdce18c52","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":680,"y":800,"wires":[["f9598c1165ca9a1b"]]},{"id":"f9598c1165ca9a1b","type":"change","z":"23ef37abdce18c52","name":"set payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"TeslaActualChargePower","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":800,"wires":[["de0fccba3cfded05"]]},{"id":"de0fccba3cfded05","type":"convert","z":"23ef37abdce18c52","name":"Number","convertTo":"number","x":1000,"y":800,"wires":[["f9a59e45e30e1e37"]]},{"id":"f9a59e45e30e1e37","type":"influxdb out","z":"23ef37abdce18c52","influxdb":"637c445f.716e74","name":"","measurement":"teslaChargePower","precision":"","retentionPolicy":"","database":"","retentionPolicyV18Flux":"","org":"","bucket":"","x":1260,"y":800,"wires":[]},{"id":"0a76907cee073e5b","type":"switch","z":"23ef37abdce18c52","name":"SOC < 70%","property":"BatterySOC","propertyType":"global","rules":[{"t":"lt","v":"70","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1010,"y":460,"wires":[["e01fcca0c8155cfb"],[]]},{"id":"e01fcca0c8155cfb","type":"change","z":"23ef37abdce18c52","name":"hdr","rules":[{"t":"set","p":"payload","pt":"msg","to":"Tesla charging stopped night","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Warning","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1090,"y":400,"wires":[["05b32f1d73c51ee6"]]},{"id":"080160babebcaf2f","type":"change","z":"23ef37abdce18c52","name":"header","rules":[{"t":"set","p":"topic","pt":"msg","to":"amps auto","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":580,"wires":[["93e466885f4cbf1c"]]},{"id":"72770e9b5836d851","type":"inject","z":"23ef37abdce18c52","name":"msg.commandArgs.amps = new_amps;","props":[{"p":"payload"},{"p":"commandArgs.amps","v":"2","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1080,"y":900,"wires":[["163334101645c789"]]},{"id":"f5b6f8bb0cb9483c","type":"inject","z":"23ef37abdce18c52","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":620,"y":200,"wires":[["7058279f96bc0e09"]]},{"id":"7de61c6dde1ff175","type":"rbe","z":"23ef37abdce18c52","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":970,"y":740,"wires":[["6818d739fe51bd25"]]},{"id":"f5fd2af77a595e74","type":"switch","z":"23ef37abdce18c52","name":"^empty","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":840,"y":740,"wires":[["7de61c6dde1ff175"]]},{"id":"915a3d89034b9cc0","type":"change","z":"23ef37abdce18c52","name":"auto","rules":[{"t":"set","p":"Tesla/Mantacore/manualchargeamps","pt":"flow","to":"0","tot":"num","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":660,"wires":[["a6bfaeb2ba44ad1c"]]},{"id":"e8355e91ca283ef7","type":"comment","z":"23ef37abdce18c52","name":"Thresholds","info":"Stop at 21%\nSet auto at 25%\nNormal above 25%","x":260,"y":700,"wires":[]},{"id":"4af005197174bd6c","type":"comment","z":"23ef37abdce18c52","name":"Location API broken","info":"","x":350,"y":480,"wires":[]},{"id":"11f0019d919fd451","type":"change","z":"23ef37abdce18c52","name":"save flow variable Tesla/Mantacore/manualchargeamps","rules":[{"t":"set","p":"Tesla/Mantacore/manualchargeamps","pt":"flow","to":"payload","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":980,"wires":[[]]},{"id":"503aaba1582024a3","type":"change","z":"23ef37abdce18c52","name":"Rate = -1","rules":[{"t":"set","p":"payload","pt":"msg","to":"-1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":980,"wires":[["11f0019d919fd451"]]},{"id":"965a78a157862bc1","type":"comment","z":"23ef37abdce18c52","name":"If asleep, ensure var set to \"not charging\"","info":"","x":580,"y":940,"wires":[]},{"id":"1aee92951d0778a1","type":"comment","z":"23ef37abdce18c52","name":"Everything else","info":"","x":640,"y":1040,"wires":[]},{"id":"1b9bd98137352dd2","type":"http request","z":"23ef37abdce18c52","name":"Stop charge","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.tessie.com/LRWYHCEL4PC726XXX/command/stop_charging?retry_duration=40&wait_for_completion=true","tls":"63dc698c.a7b1b","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"accept","valueType":"other","valueValue":"application/json"},{"keyType":"other","keyValue":"","valueType":"other","valueValue":""}],"x":1290,"y":340,"wires":[["ce4e539310ddddb7"]]},{"id":"abe799aefe2f3403","type":"http request","z":"23ef37abdce18c52","name":"Start charge","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://api.tessie.com/LRWYHCEL4PC726XXX/command/start_charging?retry_duration=40&wait_for_completion=true","tls":"63dc698c.a7b1b","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"accept","valueType":"other","valueValue":"application/json"},{"keyType":"other","keyValue":"","valueType":"other","valueValue":""}],"credentials":{},"x":270,"y":60,"wires":[["436ba47c7aee39da"]]},{"id":"a141372001de48ab","type":"inject","z":"23ef37abdce18c52","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1220,"y":280,"wires":[["1b9bd98137352dd2"]]},{"id":"552a3c22794042d5","type":"change","z":"23ef37abdce18c52","name":"Failed","rules":[{"t":"set","p":"payload","pt":"msg","to":"Tesla STOP CHARGE failed","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"Warning","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1550,"y":340,"wires":[["93e466885f4cbf1c"]]},{"id":"ce4e539310ddddb7","type":"switch","z":"23ef37abdce18c52","name":"Error?","property":"payload.result","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1430,"y":340,"wires":[["552a3c22794042d5"]]},{"id":"43f9a3cce3a88ad8","type":"catch","z":"23ef37abdce18c52","name":"","scope":["163334101645c789"],"uncaught":false,"x":130,"y":1100,"wires":[["4fbf28bdd4b4a490"]]},{"id":"4fbf28bdd4b4a490","type":"change","z":"23ef37abdce18c52","name":"Create error message","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"Error from \" &msg.error.source.name & \" \" & msg.error.source.id & \": \" & msg.error.message","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Error","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":1100,"wires":[["93e466885f4cbf1c"]]},{"id":"be4ce385c454b0df","type":"http request","z":"23ef37abdce18c52","name":"Get location","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.tessie.com/LRWYHCEL4PC726XXX/location","tls":"63dc698c.a7b1b","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"accept","valueType":"other","valueValue":"application/json"},{"keyType":"other","keyValue":"","valueType":"other","valueValue":""}],"x":570,"y":320,"wires":[["fbe9965444b1ae9d"]]},{"id":"fbe9965444b1ae9d","type":"change","z":"23ef37abdce18c52","name":"set","rules":[{"t":"set","p":"TeslaLocation","pt":"flow","to":"payload.saved_location","tot":"msg","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":320,"wires":[[]]},{"id":"a5700b32cf8e9d6a","type":"http request","z":"23ef37abdce18c52","name":"Get state","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.tessie.com/LRWYHCEL4PC726XXX/state?use_cache=true","tls":"63dc698c.a7b1b","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"accept","valueType":"other","valueValue":"application/json"},{"keyType":"other","keyValue":"","valueType":"other","valueValue":""}],"x":400,"y":300,"wires":[["92798ade67dc88ac","5b68087b340dd930","be4ce385c454b0df","0c60d2fc6bc13616"]]},{"id":"1cdaa7f527e39e0b","type":"http request","z":"23ef37abdce18c52","name":"Get status","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.tessie.com/LRWYHCEL4PC726XXX/status","tls":"63dc698c.a7b1b","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"accept","valueType":"other","valueValue":"application/json"},{"keyType":"other","keyValue":"","valueType":"other","valueValue":""}],"x":90,"y":300,"wires":[["519039dc475e044f"]]},{"id":"519039dc475e044f","type":"switch","z":"23ef37abdce18c52","name":"Awake?","property":"payload.status","propertyType":"msg","rules":[{"t":"eq","v":"awake","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":240,"y":300,"wires":[["a5700b32cf8e9d6a"]]},{"id":"be47f48e616b0eb0","type":"switch","z":"23ef37abdce18c52","name":"next24<50kwh","property":"next24","propertyType":"global","rules":[{"t":"lt","v":"50","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":840,"y":440,"wires":[["e01fcca0c8155cfb"],["0a76907cee073e5b"]]},{"id":"a6bfaeb2ba44ad1c","type":"junction","z":"23ef37abdce18c52","x":540,"y":780,"wires":[["aa0150796e453adc","06b6e866afeb3c28","79afc334273e980d"]]},{"id":"dadc491753b78ac6","type":"junction","z":"23ef37abdce18c52","x":740,"y":540,"wires":[["e55a48ddb04adca5","11c13fbb5528bd31","1e7f5aa3ac1aaf71"]]},{"id":"05b32f1d73c51ee6","type":"junction","z":"23ef37abdce18c52","x":1180,"y":380,"wires":[["93e466885f4cbf1c","1b9bd98137352dd2"]]},{"id":"1100ed1503a91f37","type":"junction","z":"23ef37abdce18c52","x":540,"y":600,"wires":[["62552824d2bd4452"]]},{"id":"556502263f9abba0","type":"tesla-config","email":"svwhisper@gmail.com"},{"id":"c605faa7.393b8","type":"mqtt-broker","name":"192.168.2.5","broker":"192.168.2.5","port":"1883","clientid":"af","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"30","cleansession":false,"birthTopic":"","birthQos":"0","birthRetain":"true","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"66485716e30801af","type":"position-config","name":"","isValide":"true","angleType":"deg","timeZoneOffset":"99","timeZoneDST":"0","stateTimeFormat":"3","stateDateFormat":"12","contextStore":""}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement