Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommended way to start and stop charging using services #256

Open
jonasbkarlsson opened this issue Dec 10, 2022 · 28 comments
Open

Recommended way to start and stop charging using services #256

jonasbkarlsson opened this issue Dec 10, 2022 · 28 comments
Labels
support Support and questions

Comments

@jonasbkarlsson
Copy link

Question

I have developed an integration that automatically charges the car when the electricity price is low, see EV Smart Charging. Some of my users are using this Easee integration, and would like to have an description in my documentation that they can use to create suitable automations to connection the two integrations.

There seems to be several related action commands, Start, Stop, Toggle, Pause, Resume, Overide schedule. And it's far from clear to me which one should be used. Reading people's comments, there seems to be different ways for different scenarions.

Is there a recommend way to start and stop charging that will work for all possible scenarios (with/without scheduled charging, various authorization methods)?

Or, should one recommend a certain scenarion (e.g. remove all scheduled charging), and which services should be used in that case?

What version of the integration are you using?

Latest

Anything in the logs that might be useful for us?

No response

Additional information

No response

@jonasbkarlsson jonasbkarlsson added the support Support and questions label Dec 10, 2022
@olalid
Copy link
Collaborator

olalid commented Dec 10, 2022

Looks nice!

I recommend using the circuit dynamic limit. If you set it to anything lower then 6A the charging will pause. If you set it to 6A or higher it will resume.

You can also read here about how the different commands and limits work:
https://developer.easee.cloud/docs/api-smart-charging

@jonasbkarlsson
Copy link
Author

Thanks for quick reply!

To use the service easee.set_circuit_dynamic_limit, does that assume that no schedules have been configured?

So the follow two actions could be used in the automations to start and to 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)

@olalid
Copy link
Collaborator

olalid commented Dec 10, 2022

Yes, a programmed schedule would override the circuit dynamic current limit. Removing the schedule would be the logical thing to do if you want the charging to be controlled by your integration I think.

Your actions look right to me.

@tmjo
Copy link
Collaborator

tmjo commented Dec 10, 2022

Wow, this looks cool. I'll take a look at your integration!

@ulfben
Copy link

ulfben commented Jan 27, 2023

Is it enough to adjust the limit on P1, or should we also set P2 and P3?

@olalid
Copy link
Collaborator

olalid commented Jan 27, 2023

If you set only P1 the same limit is applied also to P2 and P3.
But you can also set each one to a different value if you add all 3 to the service call.

@Flight777
Copy link

This method does not seem to work with also the Equalizer enabled, am I correct?

@olalid
Copy link
Collaborator

olalid commented Feb 28, 2023

It works together with equalizer. The lowest limit of all the possible limits will "win" always, so if your circuit dynamic current limit is lower than what the equalizer thinks you are allowed to use it will control the charger limit, and the other way around if the equalizer thinks a lower limit should be applied it will control the charger limit.

@t112013
Copy link

t112013 commented Mar 15, 2023

Hello. i was trying this method to "turn on and off" (with the dynamic value for one particualr charger) then when the cable is connected the value restores to the naximum. When changing the value to 0, the charnig stops but, if you unplug and plug the cable then the value changes again to 32(in may case max circuit), any tips to keep it on 0 besides making an automation with the trigger on the connexion of the cable.
thanks

@olalid
Copy link
Collaborator

olalid commented Mar 15, 2023

It is the way the charger dynamic limit works, it is only valid until the car is unplugged.
The circuit dynamic limit is different, it retains the value you have set between charing sessions.

@enoch85
Copy link

enoch85 commented Oct 20, 2023

@olalid I'm trying @jonasbkarlsson's integration right now and I have two chargers together with an Equalizer. To make it simple for you to follow:

Charger 1 start:

      charger_id: [charger ID for charger 1]
      currentP1: 16
      currentP2: 16
      currentP3: 16

Charger 1 stop:

      charger_id: [charger ID for charger 1]
      currentP1: 0
      currentP2: 0
      currentP3: 0

Charger 2 start:

      charger_id: [charger ID for charger 2]
      currentP1: 16
      currentP2: 16
      currentP3: 16

Charger 2 stop:

      charger_id: [charger ID for charger 2]
      currentP1: 0
      currentP2: 0
      currentP3: 0

This is put in an automation according to @jonasbkarlsson documentation. Problem is that it doesn't matter if I press the button for charger 1 or 2, both chargers either starts or stops. I would only like one charger to start or stop depending on which button I press. Is this due to the Equalizer or something else?

Is there a way around this?

Thanks for a great integration!

@Mats1717
Copy link

Do you have the chargers on the same circuit master and slave?
I have them on same circuit and need to use
Switch turn off on the other charger

@enoch85
Copy link

enoch85 commented Oct 21, 2023

Do you have the chargers on the same circuit master and slave? I have them on same circuit and need to use Switch turn off on the other charger

Yes, they are on the same circuit, I think. I have two separate switches for the two different chargers in my main electric switchboard - "aka proppskåp in Swedish (sorry for bad translation) - but I think the equalizer is on the same circuit. Anyway, both chargers starts if I start either of them, same applies for stopping. And yes, one master and one slave.

Yeah, that solution would work, but I'm under the impression that it creates unnecessary ware on the fuse, or flash memory on the charger?

@Mats1717
Copy link

You can have the. Installer på make booth masters. That will work. Had it for a time with the new lite when Easee was not ready with firmware. Ursäkta engelskan😃

@enoch85
Copy link

enoch85 commented Oct 21, 2023

You can have the. Installer på make booth masters. That will work. Had it for a time with the new lite when Easee was not ready with firmware. Ursäkta engelskan😃

Du är ursäktad. :)

Can you please elaborate on that? So you mean that I should set both chargers as master in Easee cloud, or that I should set them as master with 'easee_hass'?

@Mats1717
Copy link

On site as masters booth. Then you have 2 different dynamic values.
I am not using the off mode more than once a day so hopefully It don’t wear out the flash.

@enoch85
Copy link

enoch85 commented Oct 21, 2023

On site as masters booth. Then you have 2 different dynamic values. I am not using the off mode more than once a day so hopefully It don’t wear out the flash.

Ok, I understand. Still once per day is 365 times per year. ;)

Problem is if schelude charging is set on different intervals which overlaps... Then the scenario could be like:

  1. Start charge car 1 at 01:00
  2. Start charge car 2 at 02:00
  3. Car 2 only needs charge for 1 hour and stops at 03:00 which then also stops car 1
  4. Now car 1 isn't charged as it should since the circuit command will stop both chargers

This is my setup: jonasbkarlsson/ev_smart_charging#46 (comment)

@Mats1717
Copy link

Ok, I don’t use this application, using nordpool shipest hour and my automation.
But the question about dynamic i am quite sure about, master master and you can control it

@enoch85
Copy link

enoch85 commented Oct 21, 2023

@Mats1717 Thanks for your help, will give it a go tonight.

@enoch85
Copy link

enoch85 commented Oct 21, 2023

@Mats1717 Tried to find any info on how to set both chargers as master, but couldn't find it. Do you know where I can find it?

Thanks again!

@enoch85
Copy link

enoch85 commented Oct 21, 2023

Hello. i was trying this method to "turn on and off" (with the dynamic value for one particular charger) then when the cable is connected the value restores to the maximum. When changing the value to 0, the charring stops but, if you unplug and plug the cable then the value changes again to 32(in may case max circuit), any tips to keep it on 0 besides making an automation with the trigger on the connection of the cable.
thanks

@t112013 Did you find out any good solution?

Preferably I would like to be able to check if sensor.ev_smart_charging_XXXXXX_charging is set to off and then do Press EV Smart Charging XXXXXX Manually stop charging button, but for now I use this:

image

@olalid
Copy link
Collaborator

olalid commented Oct 21, 2023

Do you have the chargers on the same circuit master and slave? I have them on same circuit and need to use Switch turn off on the other charger

Yes, they are on the same circuit, I think. I have two separate switches for the two different chargers in my main electric switchboard - "aka proppskåp in Swedish (sorry for bad translation) - but I think the equalizer is on the same circuit. Anyway, both chargers starts if I start either of them, same applies for stopping. And yes, one master and one slave.

Circuit is equivalent to "grupp", "gruppsäkring" in swedish. If you by switch mean fuse (säkring) and they are separate for each of the chargers they are clearly not really on the same circuit and if they are configured as being on the same circuit the installer did not install them correctly.

@olalid
Copy link
Collaborator

olalid commented Oct 21, 2023

If the chargers are configured as being on the same circuit, then the dynamic circuit limit will affect both charger on that circuit.
Dynamic charger limit will affect only that specific charger.

The concept of "circuit" is used by Easee to be able to share the same fuse for several chargers. The chargers need to know that they are on the same fuse so that they will not allow the connected cars to draw more current combined than the fuse rating. So for example if you have 16A 3-phase fuses and have 2 chargers connected to that fuse, you would be able to allow 2 cars to draw 8A each if they are both charging at the same time. If only one car is charging you can that car to draw 16A.
Or 16A on 2 different phases for 1-phase charging.

The equalizer is normally not on a circuit, it is providing data about current draw from the whole household, not just a specific circuit. Its job is to provide data that can protect the main fuses, not the circuit fuses.

So I guess step one would be to verify how your electrical installation actually looks and if the configuration of the chargers actually match that.

@olalid
Copy link
Collaborator

olalid commented Oct 21, 2023

@Mats1717 Tried to find any info on how to set both chargers as master, but couldn't find it. Do you know where I can find it?

Thanks again!

I do not think master or slave matters, it is the circuit number that matters. If the circuit number is the same, then the chargers think they share the same fuses. If the circuit number is different then they think they are on separate fuses.

@Mats1717
Copy link

@Mats1717 Tried to find any info on how to set both chargers as master, but couldn't find it. Do you know where I can find it?
Thanks again!

I do not think master or slave matters, it is the circuit number that matters. If the circuit number is the same, then the chargers think they share the same fuses. If the circuit number is different then they think they are on separate fuses.

You must reinstall the charger and make new ”krets”

@enoch85
Copy link

enoch85 commented Oct 22, 2023

@olalid @Mats1717 and others.

Thanks for all the pointers. Meanwhile (late yesterday - early today) I managed to fix it without any changes to circuits, well erhrm, continue to read.

The solution is quite simple actually when everything fell into place. I got inspired by some posts here on Github, and the community forum.

System info

  • 1 X HAOS 11 (installed 2023-10-16)
  • 2 X Easee Home
  • 1 X Equalizer
  • EV Smart (for smart charging the car(s))
  • Easee HASS (this integration)
  • Energi Data Service (to get the cheapest prices)

Start charging:

alias: EV Smart - Garage STARTA laddning
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.ev_smart_charging_charging
    to: "on"
    from: "off"
condition: []
action:
  - service: easee.set_charger_dynamic_limit
    data:
      current: 16
      device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
  - device_id: 06dXXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: mobile_app
    type: notify
    message: ":)"
    title: Garage - laddning startad
mode: single

Stop charging

alias: EV Smart - Garage STOPPA laddning
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.ev_smart_charging_charging
    to: "off"
    from: "on"
condition: []
action:
  - service: easee.set_charger_dynamic_limit
    data:
      current: 0
      device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
  - device_id: 06dXXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: mobile_app
    type: notify
    message: ":)"
    title: Garage - laddning stoppad
mode: single

For this to work with smart charging though (not using the easee.set_circuit_dynamic_limit) I need to set the easee.set_charger_dynamic_limit to zero. I also opted to use another trigger for the event, since using the cars [plugged|unplugged] could cause the whole thing to fail if the car was sleeping once the cable was attached - the charger is always connected and online...

Charger plugged

alias: EV Smart - Tesla inkopplad
description: ""
trigger:
  - type: locked
    platform: device
    device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
    entity_id: ac1XXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: binary_sensor
condition: []
action:
  - type: turn_on
    device_id: 748XXXXXXXXXXXXXXXXXXXXXXXXXXX
    entity_id: 03eXXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: switch
  - service: easee.set_charger_dynamic_limit
    data:
      current: 0
      device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
mode: single

Charger unplugged

alias: EV Smart - Tesla urkopplad
description: ""
trigger:
  - type: not_locked
    platform: device
    device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
    entity_id: ac1XXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: binary_sensor
condition: []
action:
  - type: turn_off
    device_id: 748XXXXXXXXXXXXXXXXXXXXXXXXXXX
    entity_id: 03eXXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: switch
mode: single

The above YAML configs applies to both cars (chargers) - with different devices ofc.

Debuggning

The problem I faced during my testing was that I had a function for easee.set_circuit_dynamic_limit which had set the whole circuit to 0 A (since I stopped using that function and tried easee.set_charger_dynamic_limit instead), so when testing it didn't matter what I did, as the charging would never start. When I found out that it was 0 A (THANK YOU "reason for not starting") and set it back to it's normal value (40A) then everything started to come together.

Wrapping it up - solved ✔️

The charging now works as expected, and I can start and stop charging of both cars independent from each other, or at the same time. When me or my wife comes home from work, we connect the charger and the easee.set_circuit_dynamic_limit is set to 0 A and stops immediately. It can only be started manually from within HAOS. The downside is that for it to work, I can't put a permanent lock on the chargers, as the trigger used wouldn't be triggered in that case. I hope that no one steals the cable, they are expensive! :)

I will contact the installer anyway, since I for sure would want the chargers to be on different circuits. It should be the default way of installing more than 1 charger IMHO. @Mats1717 If it's physically on 2 separate circuits already, can I just change the value in Easee Cloud? Because as I said; in my fuse box I have three fuses per charger (total of 6) - so to me it seems like they are already separated...?

All and all, I'm happy it now finally works - on to the next deep dive: Fronius, BYD, and optimizing [charge|discharge] based on weather forecasts and Nordpool prices with Modbus. See you on the other side! :)

Oh, and btw, if you have some advice on my next endeavor, I would be grateful! I never worked with Modbus before, and even though I think I'm quite technical, HAOS is new to me since last week. I'm a fast learner though. :)

@Mats1717
Copy link

@olalid @Mats1717 and others.

Thanks for all the pointers. Meanwhile (late yesterday - early today) I managed to fix it without any changes to circuits, well erhrm, continue to read.

The solution is quite simple actually when everything fell into place. I got inspired by some posts here on Github, and the community forum.

System info

  • 1 X HAOS 11 (installed 2023-10-16)
  • 2 X Easee Home
  • 1 X Equalizer
  • EV Smart (for smart charging the car(s))
  • Easee HASS (this integration)
  • Energi Data Service (to get the cheapest prices)

Start charging:

alias: EV Smart - Garage STARTA laddning
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.ev_smart_charging_charging
    to: "on"
    from: "off"
condition: []
action:
  - service: easee.set_charger_dynamic_limit
    data:
      current: 16
      device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
  - device_id: 06dXXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: mobile_app
    type: notify
    message: ":)"
    title: Garage - laddning startad
mode: single

Stop charging

alias: EV Smart - Garage STOPPA laddning
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.ev_smart_charging_charging
    to: "off"
    from: "on"
condition: []
action:
  - service: easee.set_charger_dynamic_limit
    data:
      current: 0
      device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
  - device_id: 06dXXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: mobile_app
    type: notify
    message: ":)"
    title: Garage - laddning stoppad
mode: single

For this to work with smart charging though (not using the easee.set_circuit_dynamic_limit) I need to set the easee.set_charger_dynamic_limit to zero. I also opted to use another trigger for the event, since using the cars [plugged|unplugged] could cause the whole thing to fail if the car was sleeping once the cable was attached - the charger is always connected and online...

Charger plugged

alias: EV Smart - Tesla inkopplad
description: ""
trigger:
  - type: locked
    platform: device
    device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
    entity_id: ac1XXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: binary_sensor
condition: []
action:
  - type: turn_on
    device_id: 748XXXXXXXXXXXXXXXXXXXXXXXXXXX
    entity_id: 03eXXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: switch
  - service: easee.set_charger_dynamic_limit
    data:
      current: 0
      device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
mode: single

Charger unplugged

alias: EV Smart - Tesla urkopplad
description: ""
trigger:
  - type: not_locked
    platform: device
    device_id: 07fXXXXXXXXXXXXXXXXXXXXXXXXXXX
    entity_id: ac1XXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: binary_sensor
condition: []
action:
  - type: turn_off
    device_id: 748XXXXXXXXXXXXXXXXXXXXXXXXXXX
    entity_id: 03eXXXXXXXXXXXXXXXXXXXXXXXXXXX
    domain: switch
mode: single

The above YAML configs applies to both cars (chargers) - with different devices ofc.

Debuggning

The problem I faced during my testing was that I had a function for easee.set_circuit_dynamic_limit which had set the whole circuit to 0 A (since I stopped using that function and tried easee.set_charger_dynamic_limit instead), so when testing it didn't matter what I did, as the charging would never start. When I found out that it was 0 A (THANK YOU "reason for not starting") and set it back to it's normal value (40A) then everything started to come together.

Wrapping it up - solved ✔️

The charging now works as expected, and I can start and stop charging of both cars independent from each other, or at the same time. When me or my wife comes home from work, we connect the charger and the easee.set_circuit_dynamic_limit is set to 0 A and stops immediately. It can only be started manually from within HAOS. The downside is that for it to work, I can't put a permanent lock on the chargers, as the trigger used wouldn't be triggered in that case. I hope that no one steals the cable, they are expensive! :)

I will contact the installer anyway, since I for sure would want the chargers to be on different circuits. It should be the default way of installing more than 1 charger IMHO. @Mats1717 If it's physically on 2 separate circuits already, can I just change the value in Easee Cloud? Because as I said; in my fuse box I have three fuses per charger (total of 6) - so to me it seems like they are already separated...?

All and all, I'm happy it now finally works - on to the next deep dive: Fronius, BYD, and optimizing [charge|discharge] based on weather forecasts and Nordpool prices with Modbus. See you on the other side! :)

Oh, and btw, if you have some advice on my next endeavor, I would be grateful! I never worked with Modbus before, and even though I think I'm quite technical, HAOS is new to me since last week. I'm a fast learner though. :)

With your setup you shall have booth as master. You need to remove the slave and then install again with new krets. I think this is on installer level but not sure

@AMajland
Copy link

The downside is that for it to work, I can't put a permanent lock on the chargers, as the trigger used wouldn't be triggered in that case. I hope that no one steals the cable, they are expensive! :)

I have the cable permanently locked to the easee and just use a time patterne to check whether a car is connected - or rather when states('sensor.XXXXX_status') is different from 'disconnected'.

The last sunny season i've primarly used an automation to charge with surplus from the sun.

https://gist.github.com/AMajland/6ffc6814df2a92e99cff2c901447efee

Now it is the time to look into charging when the electricity is least expensive.

The difficult thing is not to enable chargin the X cheapers hours - but finding an easy way to enter the required range and taking the forecast into account. Might only need 100 km tomorrow and the forecast (Carnot) might show better prices tomorrow night etc .... At the moment i just use the easee app to enter a weekly schedule and changes it according to the needs. Yesteday morning i needed the car fully charged, but most days anywthing between 50% and 80% is fine. HA implementation has to be at least as easy to change as the easee app for the WIF. High WAF is mandatory ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Support and questions
Projects
None yet
Development

No branches or pull requests

9 participants