ev_smart_charging icon indicating copy to clipboard operation
ev_smart_charging copied to clipboard

Easee integration

Open achmeed opened this issue 2 years ago • 34 comments

Hi, have not seen anything that describes this but when you connect your charge cable to your car the ev-robot will start to charge instantly, will ev smart charging stop this after x amount of time?

For now I rely on a schedule where the easee box will say the ev charge between 22-07:00 , but this will trigger my EVs to start charging at 22 when we really want it to start when esm decides to.

achmeed avatar Dec 06 '22 13:12 achmeed

I don't have an Easee myself, so it's difficult to give a clear advice. I believe that there are people with Easee that is using this integration successfully.

My guess is that you should remove the schedules from the Easee, and let this integration get complete control of start and stop of charging. In the documentation I provide an example of automations that I thought where going to make it work. Can you try those?

You can use the "Manually start charging" and "Manually stop charging" buttons in the integration to verify that it works.

jonasbkarlsson avatar Dec 06 '22 15:12 jonasbkarlsson

Now I saw that there is a switch in the Easee integration, "switch.exxxxxxx_is_enabled", that seems to be possible to use in this integration. So please configure this integration using that switch. No need to add any automations.

jonasbkarlsson avatar Dec 06 '22 17:12 jonasbkarlsson

I believe that switch doesnt do much, tried to enable smart charging with it but nothing happens,

Regarding your documentation the suggested command has changed I.e to start smart charging when schedule is enabled and it has to be overrided

action:

  • service: easee.action_command data: device_id: 123456 action_command: override_schedule

Without schedule use and it will toggle resume then if you run again it wil toggle pause action:

  • service: easee.action_command data: device_id: 123456 action_command: toggle

https://developer.easee.cloud/reference/post_api-chargers-id-commands-start-charging

achmeed avatar Dec 06 '22 18:12 achmeed

I have seen people that successfully used the switch, but all schedules need to be removed from Easee (and the car). Can you try that?

jonasbkarlsson avatar Dec 06 '22 18:12 jonasbkarlsson

It will just trigger to deactive the charger when I toggle smart charging, and then when I enable it it actives the charger wihtout starting any charging

achmeed avatar Dec 06 '22 18:12 achmeed

And you have removed the Easee schedules? In your orignal post you said the charging started instantly when connecting the car. Is that still the case?

If you

  • remove all schedules
  • active Easee (using the Easee app or whatever)
  • is the switch.exxxxxxx_is_enabled now onin the Easee integration?
  • connect the car to Easee
  • did the charging start now?
  • if you now toggle the switch.exxxxxxx_is_enabled to off, will the charging stop?
  • if you then toggle the switch.exxxxxxx_is_enabled to on, will the charging start?

Note that none of the above involves this integration.

jonasbkarlsson avatar Dec 06 '22 19:12 jonasbkarlsson

**remove all schedules -** Done
**active Easee (using the Easee app or whatever) -**Done
**is the switch.exxxxxxx_is_enabled now onin the Easee integration?** Yes
**connect the car to Easee** Done
**did the charging start now?** Yes
**if you now toggle the switch.exxxxxxx_is_enabled to off, will the charging stop?** It disbales the charger robot, ie puts it in disbled mode
**if you then toggle the switch.exxxxxxx_is_enabled to on, will the charging start?** No, it just enables the robot again

achmeed avatar Dec 07 '22 08:12 achmeed

Ok. So if just using the switch will not work, then you need to use automations to let this integration use the Easee integration.

I guess it should be the following. Can you try? And then let me know what worked?

I'm not sure how "start" and "override_schedule" is supposed to be used. Only one of them? Or first "override_schedule", and then "start"?

alias: EV Smart Charging - Start
description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - sensor.ev_smart_charging_charging
    from: "off"
    to: "on"
condition: []
action:
  - service: easee.action_command
    data:
      device_id: "b40f1f45d28b0891fe8d" (replace with your own device id)
      action_command: "start" (or "override_schedule")

alias: EV Smart Charging - Stop
description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - sensor.ev_smart_charging_charging
    from: "on"
    to: "off"
condition: []
action:
  - service: easee.action_command
    data:
      device_id: "b40f1f45d28b0891fe8d" (replace with your own device id)
      action_command: "stop"

jonasbkarlsson avatar Dec 07 '22 16:12 jonasbkarlsson

Hi,

yes that works and how I use the integration, override_schedule is only needed if charging happends outside the schedule, to stop charging toggle is working but not the stop command - this is how ever on the easee side not your integraiton - will play around more

I think the solution if you dont use a schedule is to set an automation to listen to the cable connected sensor and send action_command pause then wait for the integration to toggle a start besided on cheapest hours.

You can close this if you want or leave it open for others to chip in with information so you can update your documentation

achmeed avatar Dec 08 '22 11:12 achmeed

I checked with the developers of the Easee integration, and their recommendation was to remove all schedules and then to use the following two actions in the automations to start and stop charging.

action:
  - service: easee.set_circuit_dynamic_limit
    data:
      device_id: "b40f1f45d28b0891fe8d" (replace with your own device id)
      currentP1: 16 (replace with your preferred charging current)
action:
  - service: easee.set_circuit_dynamic_limit
    data:
      device_id: "b40f1f45d28b0891fe8d" (replace with your own device id)
      currentP1: 0 (something below 6 to make the charging stop)

jonasbkarlsson avatar Dec 11 '22 19:12 jonasbkarlsson

I'm using the switch.<ID>_is_enabled using my Easee charger. Seems to work. I can use the "Manually start charging" and "Manually stop charging" buttons in the integration. I it OK to do it this way or do you still recommend to use the actions above?

jstorgaard avatar Dec 13 '22 20:12 jstorgaard

The developers of the Easee integration recommend to not use the switch._is_enabled. So it's recommended to use the above actions.

jonasbkarlsson avatar Dec 13 '22 20:12 jonasbkarlsson

Thank you @jonasbkarlsson for your contribution with ev_smartcharging. You can also make a easee switch with the switch template (https://www.home-assistant.io/integrations/switch.template/)

switch:
  - platform: template
    switches:
      easee:
        friendly_name: "Easee charge switch"
        value_template: "{{ is_state('sensor.easee_home_XXXXXX_status', 'charging') }}"
        turn_on:
          service: easee.set_circuit_dynamic_limit
          data:
            device_id: "b40f1f45d28b0891fe8d" (replace with your own device id)
            currentP1: 10
        turn_off:
          service: easee.set_circuit_dynamic_limit
          data:
            device_id: "b40f1f45d28b0891fe8d" (replace with your own device id)
            currentP1: 0

image

overas avatar Dec 14 '22 18:12 overas

@jonasbkarlsson, when I setup ev_smartcharging I get an error about "Charger control switch not found". I use switch.easee in the input setting for "Charger Control switch".

image

The switch state is "on" or "off" and the switch works. When I switch to off I get easee status "awaiting_start" and when I switch to on I get easee status "charging".

image

overas avatar Dec 14 '22 19:12 overas

when I setup ev_smartcharging I get an error about "Charger control switch not found"

I found out what was wrong with the switch.easee. I needed a unique_id: which Studio Code Server generated for me. Now the setup works. Thanks again.

switch:
  - platform: template
    switches:
      easee:
        friendly_name: "Easee charge switch"
        unique_id: 5789b94f-96d6-4bdb-b31d-78c4b6ca6285
        value_template: "{{ is_state('sensor.easee_home_XXXXX_status', 'charging') }}"
        turn_on:
          service: easee.set_circuit_dynamic_limit
          data:
            device_id: "b40f1f45d28b0891fe8d" (replace with your own device id)
            currentP1: 10
        turn_off:
          service: easee.set_circuit_dynamic_limit
          data:
            device_id: "b40f1f45d28b0891fe8d" (replace with your own device id)
            currentP1: 0

overas avatar Dec 14 '22 20:12 overas

Thanks @overas unique_id did the trick for me too.

ress23 avatar Dec 15 '22 14:12 ress23

switch:
[...]
        friendly_name: "Easee charge switch"
        value_template: "{{ is_state('sensor.easee_home_XXXXXX_status', 'charging') }}"
[...]

Hi! Nice work! I could be overlooking something obvious, but wouldn't it make more sense to use {{ states('sensor.easee_dynamic_circuit_limit') | int > 0 }} as a value template here? This would ensure that the state of the switch is on even if it's not actively charging.

Skeletorjus avatar Jan 03 '23 10:01 Skeletorjus

Thanks @Skeletorjus, you have right. The documentation for switch template says:

https://www.home-assistant.io/integrations/switch.template/

availability_template template (optional, default: true) Defines a template to get the available state of the entity. If the template either fails to render or returns True, "1", "true", "yes", "on", "enable", or a non-zero number, the entity will be available. If the template returns any other value, the entity will be unavailable. If not configured, the entity will always be available. Note that the string comparison not case sensitive; "TrUe" and "yEs" are allowed.

I made the availability_template from the example in the documentation, but your approch is better. It gives True if the attributt is bigger than 0 and False if it is 0.

overas avatar Jan 03 '23 12:01 overas

@overas You mean value_template? The value_template will make the state of the switch whatever the template renders to, so in this example the switch will be on if sensor.easee_dynamic_circuit_limit i above zero. The availability_template dictates if the switch should be available at all. In that case it would make sense to use binary_sensor.easee_online, so when the charger goes offline the switch will be disabled as well. With this taken into consideration, the whole template switch can look something like this:

switch:
  - platform: template
    switches:
      easee:
        friendly_name: "Easee charge"
        unique_id: easee_charge_switch
        availability_template: "{{ states('binary_sensor.easee_online') }}"
        value_template: "{{ states('sensor.easee_dynamic_circuit_limit') | int > 0 }}"
        icon_template: mdi:ev-station
        turn_on:
          service: easee.set_circuit_dynamic_limit
          data:
            device_id: device_id_here
            currentP1: 16
        turn_off:
          service: easee.set_circuit_dynamic_limit
          data:
            device_id: device_id_here
            currentP1: 0

Skeletorjus avatar Jan 03 '23 13:01 Skeletorjus

Sorry @Skeletorjus, but I misunderstood the documentation. You are right and thanks for the clarification

overas avatar Jan 03 '23 15:01 overas

A lot of the examples here are using device_id to identify their charger. The device_id is not easily discoverable in HA. The only way I've been able to find out my device_id was to parse it from the URL of the easee integration, or create an automation with the charger to see what HA generated.

If I understand the Easee HASS docs correctly, you can instead use charger_id - this is the 7-8 character serial number of your charger and is much easier to discover in the HA UI, or in the Easee app (Charger Settings -> About -> Serial Number).

ulfben avatar Jan 27 '23 11:01 ulfben

@ulfben Have you tried using charger_id? Does it work? I don't have an Easee charger so I can't test myself. When I read the source code for the Easee integration, I can only see support of device_id. If you use the GUI to create automations in HA, you should be able to find the device_id.

jonasbkarlsson avatar Jan 27 '23 18:01 jonasbkarlsson

Yes! My charger is "ehfhjymw" and my switch uses charger_id to identify it:

switch:
  - platform: template
    switches:
      easee:
        friendly_name: "Easee charge"
        unique_id: easee_charge_switch
        availability_template: "{{ states('binary_sensor.ehfhjymw_online') }}"
        value_template: "{{ states('sensor.ehfhjymw_dynamic_circuit_limit') | int > 0 }}"
        icon_template: mdi:ev-station
        turn_on:
          service: easee.set_circuit_dynamic_limit
          data:
            charger_id: "ehfhjymw"
            currentP1: 16
            currentP2: 16
            currentP3: 16
        turn_off:
          service: easee.set_circuit_dynamic_limit
          data:
            charger_id: "ehfhjymw"
            currentP1: 0
            currentP2: 0
            currentP3: 0

Regarding the setting of all phases: I double-checked and it is enough to set P1. The others will be assigned the same value. But I find implicit APIs like that less clear, so I opted to write them all out explicitly.

ulfben avatar Jan 27 '23 18:01 ulfben

Thanks for the confirmation! I will change the example in the documentation to use charger_id instead.

jonasbkarlsson avatar Jan 28 '23 15:01 jonasbkarlsson

Yes! My charger is "ehfhjymw" and my switch uses charger_id to identify it:

switch:
  - platform: template
    switches:
      easee:
        friendly_name: "Easee charge"
        unique_id: easee_charge_switch
        availability_template: "{{ states('binary_sensor.ehfhjymw_online') }}"
        value_template: "{{ states('sensor.ehfhjymw_dynamic_circuit_limit') | int > 0 }}"
        icon_template: mdi:ev-station
        turn_on:
          service: easee.set_circuit_dynamic_limit
          data:
            charger_id: "ehfhjymw"
            currentP1: 16
            currentP2: 16
            currentP3: 16
        turn_off:
          service: easee.set_circuit_dynamic_limit
          data:
            charger_id: "ehfhjymw"
            currentP1: 0
            currentP2: 0
            currentP3: 0

Regarding the setting of all phases: I double-checked and it is enough to set P1. The others will be assigned the same value. But I find implicit APIs like that less clear, so I opted to write them all out explicitly.

I think this method does not work if I also use a Equalizer. It is then instantly overwritten by Easee Equalizer itself :(

Flight777 avatar Feb 27 '23 20:02 Flight777

Can't you just use the pause and resume action form the Easee charger? I have an automation that turns the charger on (still on pause) when my car gets connected to the charger. (it checks if the car is connected) When the chargers is on the car can use power for example to use the preheat.

What I am missing is the this integration only support on/off. It would be nice to have it directly connect to the Easee charge so it can use the pause/resume action easee.action_command resume/pause. I now need to use another automation that get triggered by the on/of state form sensor.ev_smart_charging_charging

liudger avatar Mar 02 '23 11:03 liudger

What I am missing is the this integration only support on/off. It would be nice to have it directly connect to the Easee charge so it can use the pause/resume action easee.action_command resume/pause. I now need to use another automation that get triggered by the on/of state form sensor.ev_smart_charging_charging

Yes, I'm aware of this. Intitially I have focused on the charging control, and I have a few more things I would like to improve. I have some ideas on how to handle your request, but I will need some time to find a good solution that make sense to implement considering that there are quite many different chargers.

jonasbkarlsson avatar Mar 03 '23 10:03 jonasbkarlsson

Yeah the logic is quite nice.

A bit off topic

Maybe this ev-smart-charging could be upgraded to be a module inside homeassistant that can for example also control headpump and other high energy devices.

I know in the Netherlands there is a project starting that has the goal to enable device control that will results in more stable electric network. They want to create open standard for this. Maybe this is interesting so the module can be used also from outsiders de by the electric network provider. (I guess you earn a bit of money by stabilizing the network)

https://elaad.nl/ is one of the companies that is working on this platform. They also helped the standaard for ev charging. Mostly for public charging stations.

https://elaad.nl/energiemanagement-in-en-om-de-woning-biedt-grote-kansen/

This is the link for the project. It's in Dutch :(

There is also an English pdf https://elaad.nl/wp-content/uploads/downloads/Energy-Management-Opportunities-for-The-Home_ElaadNL-FAN_Dec2022_V1.2.pdf

liudger avatar Mar 03 '23 15:03 liudger

I know that there are users of this intergration that already now use it to control other high energy devices, and I have added some controlling means to better support that. Also, I have plans to eventually add a discharging function so that it can be used with home batteries and V2H capable chargers/cars.

jonasbkarlsson avatar Mar 03 '23 15:03 jonasbkarlsson

Yes! My charger is "ehfhjymw" and my switch uses charger_id to identify it:

switch:
  - platform: template
    switches:
      easee:
        friendly_name: "Easee charge"
        unique_id: easee_charge_switch
        availability_template: "{{ states('binary_sensor.ehfhjymw_online') }}"
        value_template: "{{ states('sensor.ehfhjymw_dynamic_circuit_limit') | int > 0 }}"
        icon_template: mdi:ev-station
        turn_on:
          service: easee.set_circuit_dynamic_limit
          data:
            charger_id: "ehfhjymw"
            currentP1: 16
            currentP2: 16
            currentP3: 16
        turn_off:
          service: easee.set_circuit_dynamic_limit
          data:
            charger_id: "ehfhjymw"
            currentP1: 0
            currentP2: 0
            currentP3: 0

Regarding the setting of all phases: I double-checked and it is enough to set P1. The others will be assigned the same value. But I find implicit APIs like that less clear, so I opted to write them all out explicitly.

I think this method does not work if I also use a Equalizer. It is then instantly overwritten by Easee Equalizer itself :(

Did you find a solution for this @Flight777?

I have two Easee (22kW) chargers + one Equalizer, and no matter if I start one or the other charger, both starts charging. Maybe there's a way around this?

enoch85 avatar Oct 20 '23 18:10 enoch85