Optimizing use of unused Solar Power to charge a Tesla

Looks promising from their website, but i was unable to find the addon, for home assistant, both in official supported, and HACS sections.

Where and how would i go about installing it as an addon for Home Assistant?

Thank you.

Tried this but i am not clever enough to even get past the first steps apparantly :slight_smile:

Did as the manual says, and it apparantly added the evcc, i can see it in the “three dots - Repository” menu with a red trashcan besides it.

But when i close the window and go back to repositories and search it does not find the EVCC one anyway.

Did try to restart, but it is still not there.

Using latest version of Home Assistant OS (HAOS) installed on a RaspberryPi 4

You need to a hard refresh to see the new addons after adding a repo. Shift+F5 should do it if you’re on the addon page

Thank you that worked.

Now comes the hard part, it seems that all setup is done inside the evcc.yaml i created.

When i start the evcc it offcourse complains about missing stuff. I found the documentation and found the section for Growatt, but it seems it expects a RS-485 connection to the inverter. I already have solar assistant connected via RS-232 .

Is it not possible to setup the system to use the sensors i have already integrated into Home Assistant ?

For the battery i have a sensor called “sensor.battery_state_of_charge”

For the hose usage i have a sensor called “Load power” (This is current combined consumption)

For the solar panels i have a sensor called “PV power” that shows how much solar the solar panels are producing right now.

With those sensor i believe the calculation on how much power the charger is allowed too draw should be possible to calculate.

These sensors are updated every 2 seconds

I also have a max usage of 3700 Watts as this is how much my solar inverter is able to deliver to the grid, that needs to be set. This is what the system should try to (just) stay under, when charging.

Another option would be to use my blueprint/script for PV excess automation. That should work for your Tesla (or wallbox) too.
See https://community.home-assistant.io/t/pv-solar-excess-optimizer-auto-control-appliances-wallbox-dish-washer-heatpump-based-on-excess-solar-power/

1 Like

You could use the HTTP component in EVCC and call the Home Assistant API to get the sensor data.
I haven’t tried this yet, but I use the HTTP component for my WiFi P1 meter

So there is no way i can just feed it a home assistant sensor and let it use that directly, i need to have it call the actual Solar Assistant Raspberry to get the data ?

No, because it’s not a Home Assistant integration. Is just a Docker container that you can load via the add-on store, but it has no direct connection with the Home Assistant sensors.

If you use modbus there is probably a 1 device limitation. To get around that you can setup the Modbus proxy addon. That addon will make the connection to the inverter and then the other services will send their requests via the addon over that same modbus connection.

Fair enough, i think i will find another solution then, i wanted something that integrated into Home Assistant, not another standalone solution.

But thanks for the tip.

this is mine, GitHub - torsteinelv/NodeRed-Excess-charging-flow: Charge EV from excess solar

I am currently using “switch on Tesla charger when Powerwalls are above 99%” which seems to work well.
However , i cant get it to switch off again when Powerwall drops to 90%. i had it working last year, so not sure whats happening differently now.

I writed this nodered flow (I’ve bought a Model 3 last week) maybe it need a debug :slight_smile: because I’m a newbie :smiley: :

  1. when I start charging My Tesla M3, Nodered Ask me by Telegram if I want to charge Tesla by maximize self PV consumption or a manual charge
  2. if answer is “yes” then a function node calculates unused PV power (Inverter output power + PV power to grid)
  3. So if residual PV power is between a range interval es. 230W-460W a node set 2A tesla sensor “number.charging_amps”
  4. nodered wait until unused PW power is over than 230W or under 230W to repeat cycle and set a smaller or greater Ampere value in sensor “number.charging_amps”
  5. on sunset Nodered turn off the flow, same as Tesla’s Battery is 100% charged
  6. a check on Tesla’s charge = on avoid nodered loop to set Ampere uselessly

[{"id":"cda4cbac66948c9c","type":"tab","label":"Tesla","disabled":false,"info":"","env":[]},{"id":"d4fa434ed53dfa64","type":"telegrambot-switch","z":"cda4cbac66948c9c","name":"Scelta DLM","bot":"7ac1b2eced8b20a3","chatId":"57748018","question":"Vuoi gestire la ricarica dell'auto per massimizzare l'autoconsumo del fotovoltaico?","answers":["si","no"],"outputs":3,"autoAnswerCallback":true,"verticalAnswers":true,"timeoutValue":"1","timeoutUnits":"min","parseMode":"","x":290,"y":120,"wires":[["8a947ab0f9c6cc1b"],["8e2baf6ba25acb32"],["8a947ab0f9c6cc1b"]]},{"id":"7725f19802142a07","type":"trigger-state","z":"cda4cbac66948c9c","name":"Tesla Charge ON","server":"1c37c350.3f926d","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"switch.charger","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":false,"x":80,"y":80,"wires":[["d4fa434ed53dfa64"],["3fbe5fb8508b6f43"]]},{"id":"22dc7b1664a7da58","type":"api-call-service","z":"cda4cbac66948c9c","name":"Auto","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"telegram_bot","service":"send_message","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"ok avvio la gestione automatica!\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":40,"wires":[["1f84fcfc79acc87e"]]},{"id":"8e2baf6ba25acb32","type":"api-call-service","z":"cda4cbac66948c9c","name":"Manual","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"telegram_bot","service":"send_message","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"La gestione della ricarica proseguirà in modo manuale\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":380,"y":220,"wires":[["3fbe5fb8508b6f43"]]},{"id":"1f84fcfc79acc87e","type":"function","z":"cda4cbac66948c9c","name":"","func":"var power1 = global.get('homeassistant.homeAssistant.states[\"sensor.input_power\"].state');\nvar power2 = global.get('homeassistant.homeAssistant.states[\"sensor.charger_power\"].state');\nvar power3 = global.get('homeassistant.homeAssistant.states[\"sensor.active_power\"].state');\nvar power4 = global.get('homeassistant.homeAssistant.states[\"sensor.pv_to_grid_kwp\"].state');\n\nlet w1 = parseFloat(power1);\nlet w2 = parseFloat(power2);\nlet w3 = parseFloat(power3);\nlet w4 = parseFloat(power4);\n\nmsg.payload = w1 - w3 + w4 + (w2 * 1000) - 300;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":220,"wires":[["1dfa78e36e48e542","410ab08425cbf79b"]]},{"id":"1dfa78e36e48e542","type":"switch","z":"cda4cbac66948c9c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"230","vt":"str"},{"t":"btwn","v":"230","vt":"num","v2":"460","v2t":"num"},{"t":"btwn","v":"461","vt":"num","v2":"691","v2t":"num"},{"t":"btwn","v":"692","vt":"num","v2":"922","v2t":"num"},{"t":"btwn","v":"923","vt":"num","v2":"1153","v2t":"num"},{"t":"btwn","v":"1154","vt":"num","v2":"1384","v2t":"num"},{"t":"btwn","v":"1385","vt":"num","v2":"1615","v2t":"num"},{"t":"btwn","v":"1616","vt":"num","v2":"1846","v2t":"num"},{"t":"btwn","v":"1847","vt":"num","v2":"2077","v2t":"num"},{"t":"btwn","v":"2078","vt":"num","v2":"2308","v2t":"num"},{"t":"btwn","v":"2309","vt":"num","v2":"2539","v2t":"num"},{"t":"btwn","v":"2540","vt":"num","v2":"2770","v2t":"num"},{"t":"btwn","v":"2771","vt":"num","v2":"3001","v2t":"num"},{"t":"btwn","v":"3002","vt":"num","v2":"3232","v2t":"num"},{"t":"btwn","v":"3233","vt":"num","v2":"3463","v2t":"num"},{"t":"btwn","v":"3464","vt":"num","v2":"3694","v2t":"num"},{"t":"btwn","v":"3695","vt":"num","v2":"3925","v2t":"num"},{"t":"btwn","v":"3926","vt":"num","v2":"4156","v2t":"num"},{"t":"btwn","v":"4157","vt":"num","v2":"4387","v2t":"num"},{"t":"btwn","v":"4388","vt":"num","v2":"4618","v2t":"num"},{"t":"btwn","v":"4619","vt":"num","v2":"4849","v2t":"num"},{"t":"gte","v":"4850","vt":"num"}],"checkall":"false","repair":false,"outputs":22,"x":890,"y":260,"wires":[["b2c231128d26b2e1"],["7cec61285af7710c"],["a2022d91a8c24697"],["1ef1e04dba22a52b"],["25111e7925ed9ecc"],["b3f8c5d56d5d6b1c"],["e3fcf7f32ec8cb77"],["6e85ac0f1223a91f"],["5603f6d63da3317c"],["7c23d0da8b04505e"],["778a6599898376f1"],["fea9b4b36d73a950"],["77fbc0857669572d"],["7a5fc827c4cbdfcd"],["43c10d26bb957df3"],["1f90d56ebcd06f3c"],["9545f5a05c5554bb"],["122bd183a1b3b6b8"],["f518695425da67e4"],["9f3adf1edfa017dd"],["f76787dc7f3e551f"],["16927fc2ad18f84d"]]},{"id":"b2c231128d26b2e1","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":1}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":120,"wires":[["09d0a58c1fa54ce0"]]},{"id":"7cec61285af7710c","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":2}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":160,"wires":[["09d0a58c1fa54ce0"]]},{"id":"a2022d91a8c24697","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":3}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":200,"wires":[["09d0a58c1fa54ce0"]]},{"id":"25111e7925ed9ecc","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":5}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":280,"wires":[["09d0a58c1fa54ce0"]]},{"id":"1ef1e04dba22a52b","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":4}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":240,"wires":[["09d0a58c1fa54ce0"]]},{"id":"b3f8c5d56d5d6b1c","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":6}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":320,"wires":[["09d0a58c1fa54ce0"]]},{"id":"e3fcf7f32ec8cb77","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":7}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":360,"wires":[["09d0a58c1fa54ce0"]]},{"id":"6e85ac0f1223a91f","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":8}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":400,"wires":[["09d0a58c1fa54ce0"]]},{"id":"fea9b4b36d73a950","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":12}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":560,"wires":[["09d0a58c1fa54ce0"]]},{"id":"77fbc0857669572d","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":13}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":600,"wires":[["09d0a58c1fa54ce0"]]},{"id":"778a6599898376f1","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":11}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":520,"wires":[["09d0a58c1fa54ce0"]]},{"id":"7c23d0da8b04505e","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":10}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":480,"wires":[["09d0a58c1fa54ce0"]]},{"id":"5603f6d63da3317c","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":9}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":440,"wires":[["09d0a58c1fa54ce0"]]},{"id":"7a5fc827c4cbdfcd","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":14}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":640,"wires":[["09d0a58c1fa54ce0"]]},{"id":"43c10d26bb957df3","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":15}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":680,"wires":[["09d0a58c1fa54ce0"]]},{"id":"9545f5a05c5554bb","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":17}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":760,"wires":[["09d0a58c1fa54ce0"]]},{"id":"1f90d56ebcd06f3c","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":16}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":720,"wires":[["09d0a58c1fa54ce0"]]},{"id":"122bd183a1b3b6b8","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":18}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":800,"wires":[["09d0a58c1fa54ce0"]]},{"id":"f76787dc7f3e551f","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":21}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":920,"wires":[["09d0a58c1fa54ce0"]]},{"id":"9f3adf1edfa017dd","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":20}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":880,"wires":[["09d0a58c1fa54ce0"]]},{"id":"f518695425da67e4","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":19}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":840,"wires":[["09d0a58c1fa54ce0"]]},{"id":"16927fc2ad18f84d","type":"api-call-service","z":"cda4cbac66948c9c","name":"Set Amp Value","server":"1c37c350.3f926d","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.charging_amps"],"data":"{\"value\":22}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":960,"wires":[["09d0a58c1fa54ce0"]]},{"id":"b007dee0136dbed1","type":"inject","z":"cda4cbac66948c9c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":140,"wires":[["1f84fcfc79acc87e"]]},{"id":"410ab08425cbf79b","type":"ha-sensor","z":"cda4cbac66948c9c","name":"PV avaible for Tesla","entityConfig":"ede6040ad88b4bc3","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":690,"y":340,"wires":[[]]},{"id":"09d0a58c1fa54ce0","type":"ha-wait-until","z":"cda4cbac66948c9c","name":"waith power is 1","server":"1c37c350.3f926d","version":2,"outputs":2,"entityId":"sensor.pwleft_for_tesla","entityIdFilterType":"exact","property":"state","comparator":"is","value":"1","valueType":"num","timeout":"150","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":false,"blockInputOverrides":false,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":1460,"y":480,"wires":[["77a18864989d7823"],["77a18864989d7823"]]},{"id":"77a18864989d7823","type":"api-current-state","z":"cda4cbac66948c9c","name":"check 1 again","server":"1c37c350.3f926d","version":3,"outputs":2,"halt_if":"1","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.pwleft_for_tesla","state_type":"str","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"60","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1500,"y":360,"wires":[["a385dcc1806a30a3"],["53c346490c537f93"]]},{"id":"53c346490c537f93","type":"delay","z":"cda4cbac66948c9c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1800,"y":500,"wires":[["77a18864989d7823"]]},{"id":"04a35f51460f31f9","type":"time-range-switch","z":"cda4cbac66948c9c","name":"Set Sun","lat":"38.953554","lon":"16.285832","startTime":"sunrise","endTime":"sunset","startOffset":"0","endOffset":"-30","x":1360,"y":80,"wires":[["1f84fcfc79acc87e"],["8cfa908163bb902b"]]},{"id":"8cfa908163bb902b","type":"api-call-service","z":"cda4cbac66948c9c","name":"Off on Sunset!","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.charger"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1600,"y":80,"wires":[["bca3780193b5c1b3"]]},{"id":"96e908d56d2d7f6a","type":"api-current-state","z":"cda4cbac66948c9c","name":"if on Charger","server":"1c37c350.3f926d","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.charger","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1450,"y":180,"wires":[["04a35f51460f31f9"],[]]},{"id":"3fbe5fb8508b6f43","type":"api-call-service","z":"cda4cbac66948c9c","name":"Off DLM Switch","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.pv_dlm_button"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":400,"y":300,"wires":[[]]},{"id":"8a947ab0f9c6cc1b","type":"api-call-service","z":"cda4cbac66948c9c","name":"On DLM Switch","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.pv_dlm_button"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":540,"y":60,"wires":[["22dc7b1664a7da58"]]},{"id":"1662c9f1eb796f6d","type":"api-current-state","z":"cda4cbac66948c9c","name":"if on DLM Switch","server":"1c37c350.3f926d","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.pv_dlm_button","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1490,"y":260,"wires":[["96e908d56d2d7f6a"],[]]},{"id":"bca3780193b5c1b3","type":"api-call-service","z":"cda4cbac66948c9c","name":"Off DLM Switch","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.pv_dlm_button"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1820,"y":80,"wires":[[]]},{"id":"48c5dd0d1da99315","type":"cronplus","z":"cda4cbac66948c9c","name":"Pool on Sunrise","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"solar","expression":"0 30 20 * * *","location":"38.95349692898102 16.28588925115764","offset":"15","solarType":"selected","solarEvents":"sunrise"}],"x":120,"y":340,"wires":[["8e764f86a3b8e328"]]},{"id":"8e764f86a3b8e328","type":"api-call-service","z":"cda4cbac66948c9c","name":"Pooling on","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.polling"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":330,"y":400,"wires":[[]]},{"id":"c89cbdf9186dbe41","type":"cronplus","z":"cda4cbac66948c9c","name":"Pool off Sunset","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"default","payload":"","expressionType":"solar","expression":"0 30 20 * * *","location":"38.95349692898102 16.28588925115764","offset":"15","solarType":"selected","solarEvents":"sunset"}],"x":120,"y":440,"wires":[["dca700937fda58dd"]]},{"id":"dca700937fda58dd","type":"api-call-service","z":"cda4cbac66948c9c","name":"Pooling off","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.polling"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":330,"y":500,"wires":[[]]},{"id":"a385dcc1806a30a3","type":"api-current-state","z":"cda4cbac66948c9c","name":"if batt lev < 100%","server":"1c37c350.3f926d","version":3,"outputs":2,"halt_if":"100","halt_if_type":"num","halt_if_compare":"lt","entity_id":"sensor.battery","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1770,"y":360,"wires":[["1662c9f1eb796f6d"],["601c54e86a00ccfc"]]},{"id":"601c54e86a00ccfc","type":"api-call-service","z":"cda4cbac66948c9c","name":"Off DLM Switch","server":"1c37c350.3f926d","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.charger"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1860,"y":420,"wires":[[]]},{"id":"7ac1b2eced8b20a3","type":"telegrambot-config","botname":"Casa Lamezia - Home Assistant","usernames":"","chatIds":"57748018","pollInterval":"300"},{"id":"1c37c350.3f926d","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"id","deviceSelector":"id","entitySelector":"id","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"ede6040ad88b4bc3","type":"ha-entity-config","server":"1c37c350.3f926d","deviceConfig":"a08c40dd19ee2726","name":"pv 4 tesla","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"pv 4 tesla"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"power"},{"property":"unit_of_measurement","value":"W"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"a08c40dd19ee2726","type":"ha-device-config","name":"pv 4 tesla","hwVersion":"","manufacturer":"Node-RED","model":"","swVersion":""}]

I can’t really help with node red since I use HA Automations to achieve the same. My charging automation is working pretty perfectly, I do have some problems with it not being triggered though because the “Charger Plugged in” status isn’t recognised properly when the car is asleep. Need to find a way to wake it before the status is checked…:thinking:

try use “switch.charger” sensor, in nodered I’ve no problem.

I will try.

I seem to be having similar problems. I’ve used the automations and script by @swainstm as a base for my configuration and it seems to run well when the car is awake. However, I noticed this morning that the charging switch did not activate because my Tesla was asleep. Did you figure out a way to force the car to wake via HA?

Sadly not really. If I send a wake-up call to the car before running the Automation to check if it’s ready, then that wakes up the car too frequently and needlessly. For now I will just have to do this the old fashioned way and start the process manually. Not ideal, but workable for now, especially since solar excess is growing sparser as autumn approaches.

Hi, I have a custom integration exactly for this purpose and more. See here: GitHub - jmcollin78/solar_optimizer: The Solar Optimizer integration for Home Assistant starts and stops your equipments depending on the Solar net production

With this you can adjust the charge amp of your Tesla depending on your solar exceeded production. This integration does more than this: you can switch / on / off any equipments.

1 Like

Long time stalker of this thread, first time poster. I have been using a frankestein HA solution for charging my Model Y on excess solar based on @CommanderROR and @swainstm above posts. Firstly, a big thank you, with zero coding experience and far more hours that was reasonable, I have had a functioning program running well for the last 5 months.

My wife just purchased a Model 3 and the thought of modifing my working automations/scripts to add the ability to charge either of our Teslas has me paralysed.

Has anyone walked this path and have any guidance? Thanks in advance

2 Likes