And what switch.pv.dlm_button does in your case ?
Hi Dick, I hope that I may pick your brain on your routines to charge Your/My Tesla with access PV power. I understand the logic behind your code, but as a newbee I am unsure if I took the right steps and how to "see"what is going on. Could you let me know if I am ontrack or not?
I took each of your code blocks seperately and copy and pasted them via File Editor into a new Yaml file. I changed all variables to reflect my environment. But now I struggleā¦do I have to start them or do they launch automatically with HA boot sequence? You refer to ON of OFF status pop ups and iOS messages. When would I see those? Do I need to create an overview TAB and link that to your code? Any help would be greatly appreciated. As a background I am with Tibber for the energy and have the Tibber integration up- and running in HA. I use the Tibber sensor.power_production which is the net of production minus usage.
Thanks for this automation. Nicely done. Iām trying it on my Tesla named Noir.
When I plug the Tesla, I get the demand to enable or not Smart Charging. I answer and I see the action automation being received. But for some reason the charging doesnāt start. It seems like my HA doesnāt want to talk to my Tesla. Iām using the Tessie integration and the Tesla one too. (Iām transitioning from the Tesla one to the Tessie one right now). When I do a switch.on service call, I get an error.
This should work right?
By the way, it also doesnāt work when using the Tesla variable switch.noir_charge
(without the r)
Semantically speaking, this should work. This error seems unrelated to the automation. Check your core logging.
Hi Axel, itās been a while since you posted your question. Did you progress? Your questions seem to be quite basic ones in regard to how automations and iOS callbacks work. I donāt think this kind of automation is for the faint of heart, but I do encourage you to dig deep and get this to work!
As soon as you add or edit an automation, all you have to do is restart the automation through the developer tools menu and they are up and running. The iOS notification callback function is not for beginners, so Iālld encourage you to experiment with this a bit more at first with a simpler automation (for instance with a button and a light, where the button triggers the iOS question āDo you want to turn on the light?ā and a yes/no reaction triggers the action. You could start your research here: Introduction | Home Assistant Companion Docs (home-assistant.io)
Good luck, days are getting longer over here so now is as good a time as ever to get this up and running! Let me know how youāre progressing.
There is indeed errors in the log. Iām quite useless in reading these, I have to admit.
Thanks
Could this be because Iām running both he Tesla and the Tessie integration?
And also this one, longer
Both errors show that the integration isnāt connecting tot the Tesla API. Dit you manage to authenticate correctly? I would strongly advise you to use only one, preferably the (HACS) Tesla Custom Integration. You connect to the Tessie platform using itās own API, which in turn is connected to the Tesla API. This introduces not only a new āpoint of failureā but itās also abstracting/obscuring whatās really happening and hard to debug. First get the Tesla integration working, then make the switch to the Tessie platform.
Yeah I figured it out. It was indeed Tessie who needed a second authentication for access to my virtual key apparently. Somehow I missed it. I didnāt try it yet but Iām guessing itāll work now. Canāt wait til tomorrow morning. .
As for using the Tesla integration, thatās what Iāve had for a while but itās not been responding well with a lot of unknown values on my entities.
Apparently Tesla is about to close it up and I read that Tessie is a more sure way to go from now on. That why Iām still using both. I didnāt get to turn the other off and change all my entities names
Thanks for guiding me in the right direction.
Hi,
I have change the code to suit my sensor. I am using tessie to communicate with my tesla. But I canāt find what to write instead of :
max_charging_amps: ā{{ state_attr(ānumber.charging_ampsā, āmaxā) | int }}ā
since I have no number.charging_amps, I presume itās created from the old tesla integration. But donāt find the equivalent with tessie.
EDIT :
I think that I found it :
max_charging_amps: "{{ state_attr('number.mycarname_courant_de_recharge', 'max') | int }}"
yep, itās in french
But now, the Tesla UMC can set 13A max but my power socket canāt handle that much, 8A is the max it can do. So How can I set it up to get only 8A max ? changing like the first post ? Like :
max_charging_amps: 8
I donāt understand why you would speak of the āold Tesla integrationā, as it is just the direct implementation of Teslaās API. In sharp contrast to Tessieās API, which is an API which in turn addresses that exact same Tesla API. Enfin, thereās that.
Indeed.
Tessie is working fine for me, the other tesla integration return the stat of the car but I canāt interract with the car. As tesla shutdown on january something regarding the wzy to communicate with the car, I was thinking thatās why I canāt use the āoldā integration of tesla in Home Assistant.
Perhaps itās finally just a setting that I miss
Iāve thought about creating one, but when thinking this over, thereās quite a few considerations and choices for every individual situation. So my conclusion was to leave it as it is: a nice and complete write-up of how I did it.
Hey guys, I am wanting to do a similar to spread excess solar into my Tesla with the use of SMA solar and energy meter, Tesla wall connect 3 and tessie.
I have come up with this using the UI options as I am new to ymal.
If anyone could assist in merging to a ymal in this thread or make some recommendations to change that would be great.
The issue I have with my code is it only accounts for the excess turns on the charge but the start of sequence doesnāt no itās already charging and drops down the charge.
Some how I need to run checks in a loop if itās already charging and than step up or down based on excess or overdrawn.
Please help
Many thanks
alias: Tesla Auto Charge
description: Test
trigger:
- platform: time_pattern
seconds: "10"
condition:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
enabled: true
action:
- choose:
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_absorbed
below: sensor.sn_3009010635_metering_power_supplied
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_supplied
above: 0
below: 3000
sequence:
- device_id: e20bff6e893d4daed32f519ee7ca50ba
domain: number
entity_id: 5ab2772349f8b59a17f58a4cb2031530
type: set_value
value: 0
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: numeric_state
entity_id: number.thunder_charge_current
above: 5
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_absorbed
below: sensor.sn_3009010635_metering_power_supplied
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_supplied
above: 3000
below: 4000
sequence:
- device_id: e20bff6e893d4daed32f519ee7ca50ba
domain: number
entity_id: 5ab2772349f8b59a17f58a4cb2031530
type: set_value
value: 5
- type: turn_on
device_id: e20bff6e893d4daed32f519ee7ca50ba
entity_id: fd0034d4f594ed89d4b5177c14c1c860
domain: switch
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_absorbed
below: sensor.sn_3009010635_metering_power_supplied
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_supplied
above: 4000
below: 5000
sequence:
- device_id: e20bff6e893d4daed32f519ee7ca50ba
domain: number
entity_id: 5ab2772349f8b59a17f58a4cb2031530
type: set_value
value: 6
- type: turn_on
device_id: e20bff6e893d4daed32f519ee7ca50ba
entity_id: fd0034d4f594ed89d4b5177c14c1c860
domain: switch
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_absorbed
below: sensor.sn_3009010635_metering_power_supplied
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_supplied
below: 6000
above: 5000
sequence:
- device_id: e20bff6e893d4daed32f519ee7ca50ba
domain: number
entity_id: 5ab2772349f8b59a17f58a4cb2031530
type: set_value
value: 7
- type: turn_on
device_id: e20bff6e893d4daed32f519ee7ca50ba
entity_id: fd0034d4f594ed89d4b5177c14c1c860
domain: switch
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_absorbed
below: sensor.sn_3009010635_metering_power_supplied
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_supplied
below: 7000
above: 6000
sequence:
- device_id: e20bff6e893d4daed32f519ee7ca50ba
domain: number
entity_id: 5ab2772349f8b59a17f58a4cb2031530
type: set_value
value: 8
- type: turn_on
device_id: e20bff6e893d4daed32f519ee7ca50ba
entity_id: fd0034d4f594ed89d4b5177c14c1c860
domain: switch
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_absorbed
below: sensor.sn_3009010635_metering_power_supplied
- condition: numeric_state
entity_id: sensor.sn_3009010635_metering_power_supplied
above: 7000
below: 8000
sequence:
- device_id: e20bff6e893d4daed32f519ee7ca50ba
domain: number
entity_id: 5ab2772349f8b59a17f58a4cb2031530
type: set_value
value: 10
- type: turn_on
device_id: e20bff6e893d4daed32f519ee7ca50ba
entity_id: fd0034d4f594ed89d4b5177c14c1c860
domain: switch
- conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: time
after: "17:00:00"
before: "08:00:00"
sequence:
- type: turn_off
device_id: e20bff6e893d4daed32f519ee7ca50ba
entity_id: fd0034d4f594ed89d4b5177c14c1c860
domain: switch
- conditions:
- condition: state
entity_id: binary_sensor.tesla_wall_connector_vehicle_connected
state: "on"
- condition: time
before: "17:00:00"
after: "08:00:00"
sequence:
- type: turn_on
device_id: e20bff6e893d4daed32f519ee7ca50ba
entity_id: fd0034d4f594ed89d4b5177c14c1c860
domain: switch
- device_id: e20bff6e893d4daed32f519ee7ca50ba
domain: number
entity_id: 5ab2772349f8b59a17f58a4cb2031530
type: set_value
value: 0
- conditions:
- type: is_not_plugged_in
condition: device
device_id: 778a5d086b864d124094f016e8933490
entity_id: d3501082b649e259b7ccda846f00fc95
domain: binary_sensor
sequence:
- device_id: e20bff6e893d4daed32f519ee7ca50ba
domain: number
entity_id: 5ab2772349f8b59a17f58a4cb2031530
type: set_value
value: 16
mode: restart
Hi, iām using your code since yesterday.
Iām having a 3 phase grid connection so iāve changed some things here and there.
My amps where wiggling very strong to the highās and lowās.
One thing i donāt understand is, why do you take the grid_usage + charger_power_draw? When i do so, iām getting, by example: 4000W + 3000W = 7000W / grid_voltage and thatās the new set value in Ampās, so thatās way too high in my situation.
When i deleted that charger_power_draw and letting it change ampās only based on grid_usage / grid_voltage it doesānt wiggle so much anymore.
Hi Richard,
you should keep in mind that when using a 3 phase charger, the multiplication of the set number of amps and the voltage is threefold. That causes the big swings in power draw.
Try this code, which adjusts for a 3-phase situation:
data:
value: >
{% set charger_power_draw_per_phase = (states('number.charging_amps') | int * grid_voltage) / 3 %}
{% set total_charger_power_draw = charger_power_draw_per_phase * 3 %}
{% set new_grid_usage = grid_usage + total_charger_power_draw %}
{% set charging_amps_per_phase = ((new_grid_usage / 3) / grid_voltage) | round(0, 'floor') | int %}
{% set total_charging_amps = charging_amps_per_phase * 3 %}
{{ [max_charging_amps, total_charging_amps] | min }}
While Iām flattered that my code inspired you to create one yourself, your code is fundamentally different from mine. To be honest I donāt feel inclined to fully analyze whatās going on here, but what seems to be a fundamental problem is that nowhere inside the automation there is the calculation of what part of the grid power usage is ACTUALLY drawn by the charger itself when recalculating the adjusted charger draw. Not sure if going about this solely by the automation UI is sufficient to achieve the desired outcome.
Hi @dikkertjedap Thanks for posting this! Iāve been reviewing the post, config, comments, etc. to figure out whether I can adapt this for myself but Iām stuck at the beginning as I do not have a smart power meter. But I DO have a Sense monitor w/Solar capability as well as a SolarEdge inverter & accounts. Iāve added both Sense and SolarEdge to my HA setup. SolarEdge doesnāt seem to provide very much detail and my inverter doesnāt know about my power usage, only what my solar system is generating (current power) and lifetime generation. The Sense HA integration documentation indicates it should include active sensors for usage and production, both in watts. But these appear to be per device detected in Sense and not a total.
I also donāt have a Tesla wall charger, but the mobile charger.
Can you give me an idea whether I can still adapt your automation with these differences?
Since I was planning a much less complex automation that would charge my Tesla based on a certain solar power production (at least over fixed value), not taking into account other usage in my house, maybe I can still make it work?
Thoughts? Thanks!
Hi Tim,
thank you for the appreciation! Iām not familiar with Sense or SolarEdge, but the automation does something as simple as calculating the power produced minus the power drawn, and then set the charger to the correct amount of amps to be used for charging the car. If you are able to do so with the Sense and SolarEdge integrations, you are on your way! Furthermore Iām not familiar with the posibility to set the charging amps while using the mobile charger, but as you set the power draw on the car settings, this might not be any problem.
The simpler concept you are proposing is in fact a suitable alternative, so if the above fails, I would certainly give that a go! Good luck!
Hi again @dikkertjedap! I have configured the sensor.power_grid_usage
, including debugging what I had wrong with the Developer Tools > Template. I had removed the | float * 1000
per another suggestion in this thread because my sensor is already in Watts, but it doesnāt happy performing the >=
operation between str
and int
. So I restored | float
and itās working in the Dev Tools. It outputs the value Iām expecting with Result type: string
at the top.
I figured out the sensors I needed from my Sense energy monitor are sensor.energy_production
and sensor.energy_usage
.
However, the sensor.power_grid_usage
sensor is still showing a state of unavailable
under Dev Tools > States and shows no value/change on the history screen. How can I verify this sensor is working via my written configuration? I wanted to make sure it was working before moving on to the automations. Thanks for any advice.