easee_hass icon indicating copy to clipboard operation
easee_hass copied to clipboard

Energy per hour sensor ?

Open ujhede opened this issue 2 years ago • 14 comments

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

ujhede avatar May 08 '22 17:05 ujhede

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?

olalid avatar May 08 '22 20:05 olalid

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.

TheEnergy avatar Apr 24 '23 18:04 TheEnergy

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

olalid avatar Apr 25 '23 09:04 olalid

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

alias: Price description: "" trigger:

  • platform: state entity_id:

    • sensor.nordpool_kwh_dk2_dkk_3_10_025 condition: [] action:
  • service: easee.set_charging_cost data: cost_per_kwh: "[object Object]": null vat: 0 device_id: cfcdc7cdf0eb5625e3341a9f62845bd1

    So it report back is zero to easse.

TheEnergy avatar Apr 25 '23 19:04 TheEnergy

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

Krabbee avatar Oct 23 '23 10:10 Krabbee

Can you show how your automation looks?

olalid avatar Oct 23 '23 11:10 olalid

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

Krabbee avatar Oct 23 '23 11:10 Krabbee

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') }}

olalid avatar Oct 24 '23 11:10 olalid

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...

Krabbee avatar Oct 24 '23 11:10 Krabbee

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.

olalid avatar Oct 24 '23 22:10 olalid

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

Krabbee avatar Oct 24 '23 23:10 Krabbee

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:

  • platform: state entity_id:
    • sensor.nordpool_buy condition: [] action:
  • service: easee.set_charging_cost data: cost_per_kwh: "{{ states('sensor.nordpool_buy') }}" device_id: b2b21358e8e36127da43d458d0c93d5c mode: single

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: @.***>

Mats1717 avatar Oct 25 '23 08:10 Mats1717

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.

olalid avatar Oct 25 '23 14:10 olalid

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: @.***>

Mats1717 avatar Oct 25 '23 14:10 Mats1717