nordicopen / easee_hass

Custom component for Easee EV charger integration with Home Assistant
216 stars 37 forks source link

Energy per hour sensor ? #183

Open ujhede opened 2 years ago

ujhede commented 2 years ago

Question

I am trying to calculate the cost of a charging session using hourly rates and the energy per hour sensor from this integration.

I am having a bit of trouble figuring out what value the energy per hour sensor exposes. It seems to be update every hour around 10 mins past the hour but the time does not seem to be consistent. Smetimes it updates at 5 minutes past.

Is the sensor value the total charge energy since the last update or is it in the last "clock hour" ?

What version of the integration are you using?

manua installation easee (opening the configuration panel give an error)

Anything in the logs that might be useful for us?

Not that i can think of.

Additional information

No response

olalid commented 2 years ago

There is no exact timing when sensors update, this is just how the easee cloud works, it does not push out updates to all connected clients at the same time because that would use far too much bandwidth. The value is supplied from easee cloud and we do not really know the exact algorithm behind calculating it. But from the way it behaves I would assume that it is showing the amount of energy between hour marks.

PS. It would be nice to know what kind of problem you are seeing with the configuration panel?

TheEnergy commented 1 year ago

Im kinda hijacking this thread, but its like the same question.

I have a sensor nordpool_kwh_dk2_dkk_3_10_025, that give me this output 1.971 DKK/kWh Is it possibel to get it to write it to the EHTEYW8B Cost per kWh sensor? so the hourly would match?

Could be nice with a script like this.

olalid commented 1 year ago

Yes, you can use an automation to write the current price to Easee. I do not think that will mean that the price will be logged correctly throughout a charging session. I think the price that is set when the charging starts is the one it will use for the whole session. Not 100% sure though. Something along these lines (untested):

- id: update_easee_price
  alias: Easee price
  trigger:
  - platform: state
    entity_id: sensor.nordpool_kwh_dk2_dkk_3_10_025
  action:
  - service: easee.set_charging_cost
    data:
      cost_per_kwh: {{ states('sensor.nordpool_kwh_dk2_dkk_3_10_025') }}
      vat: 0
      device_id: xxxxxx
TheEnergy commented 1 year ago

Seems to be on the right track. When i run the script, this happens.

alias: Price description: "" trigger:

Krabbee commented 1 year ago

I get the same error when using sensor. cost_per_kwh: "[object Object]": null Can anyone help with that? :)

olalid commented 1 year ago

Can you show how your automation looks?

Krabbee commented 1 year ago

Can you show how your automation looks?

Right now it looks like this:

alias: "Easee Set Charging Price "
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.energi_data_service_buy
condition: []
action:
  - service: easee.set_charging_cost
    data:
      cost_per_kwh:
        - entity_id: sensor.energi_data_service_buy
      vat: 0
      device_id: 890d81a5e...
      currency_id: DKK

And the entity looks right. But I get this error:

Screenshot_2023-10-23-13-56-26-59_c3a231c25ed346e59462e84656a70e50.jpg

olalid commented 1 year ago

You can not use an entity_id: as input to cost_per_kwh. You must provide a value, and you can do that with a template, similar to what I wrote above. In your case it would probably be: {{ states('sensor.energi_data_service_buy') }}

Krabbee commented 1 year ago

You can not use an entity_id: as input to cost_per_kwh. You must provide a value, and you can do that with a template, similar to what I wrote above. In your case it would probably be: {{ states('sensor.energi_data_service_buy') }}

I tried using the suggested template, but that does not seem to work :(

service: easee.set_charging_cost
data:
  cost_per_kwh:
    '[object Object]': null
  vat: 0
  device_id: blabla...

Full automation:

alias: "Easee Set Charging Price "
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.energi_data_service_buy
condition: []
action:
  - service: easee.set_charging_cost
    data:
      cost_per_kwh:
        "[object Object]": null
      vat: 0
      device_id: 890d81a5ec62c...
olalid commented 1 year ago

This works for me:

- id: elbil_laddkostnad
  alias: Elbil laddkostnad
  trigger:
  - platform: state
    entity_id: sensor.elpris_total
  action:
  - service: easee.set_charging_cost
    data:
      charger_id: EHxxxxxx
      cost_per_kwh: "{{ states('sensor.elpris_total') }}"
      vat: 0

Your sensor has a different name of course, so your template will be different. In your code above you have "[object Object]": null instead of a template. If the automation editor does not allow you to create it the correct way, you need to edit the automation manually.

Krabbee commented 1 year ago

This works for me:

- id: elbil_laddkostnad
  alias: Elbil laddkostnad
  trigger:
  - platform: state
    entity_id: sensor.elpris_total
  action:
  - service: easee.set_charging_cost
    data:
      charger_id: EHxxxxxx
      cost_per_kwh: "{{ states('sensor.elpris_total') }}"
      vat: 0

Your sensor has a different name of course, so your template will be different. In your code above you have "[object Object]": null instead of a template. If the automation editor does not allow you to create it the correct way, you need to edit the automation manually.

I probably missed the quotation marks around the states(...) - it works now. Thank you very much, @olalid

Mats1717 commented 1 year ago

Hi Olalid

Below works for me but the slave charger has a delay for about 5 minutes before it changes. Master update directly when new hour.

alias: Elpris Easee Garaget Utsida description: "" trigger:

Den ons 25 okt. 2023 kl 00:55 skrev Ola Lidholm @.***>:

This works for me:

  • id: elbil_laddkostnad alias: Elbil laddkostnad trigger:
    • platform: state entity_id: sensor.elpris_total action:
    • service: easee.set_charging_cost data: charger_id: EHxxxxxx cost_per_kwh: "{{ states('sensor.elpris_total') }}" vat: 0

Your sensor has a different name of course, so your template will be different. In your code above you have "[object Object]": null instead of a template. If the automation editor does not allow you to create it the correct way, you need to edit the automation manually.

— Reply to this email directly, view it on GitHub https://github.com/fondberg/easee_hass/issues/183#issuecomment-1778181513, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5V43TWBL5U3D5PRPEX26QLYBBBPRAVCNFSM5VMFXHY2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXHAYTQMJVGEZQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

olalid commented 1 year ago

Ok, I do not think there is anything we can do about that. What we do is call the API to change the price setting and monitor changes sent back from Easee cloud. If the cloud delays the response for a slave charger it is just the way it is.

You can complain with Easee about if you want, but they typically have intentional (random) delays in sending out data so that things that happens at specific times are not sent out to all clients at exactly the same time to avoid bandwidth issues. So my guess it is not a bug, it is by design.

Mats1717 commented 1 year ago

Ok. Not a big problem.Just wanted to report what I been seeing👍Skickat från min iPad25 okt. 2023 kl. 16:42 skrev Ola Lidholm @.***>: Ok, I do not think there is anything we can do about that. What we do is call the API to change the price setting and monitor changes sent back from Easee cloud. If the cloud delays the response for a slave charger it is just the way it is. You can complain with Easee about if you want, but they typically have intentional (random) delays in sending out data so that things that happens at specific times are not sent out to all clients at exactly the same time to avoid bandwidth issues. So my guess it is not a bug, it is by design.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>