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

Energy per hour sensor ? #183

Open
ujhede opened this issue May 8, 2022 · 14 comments
Open

Energy per hour sensor ? #183

ujhede opened this issue May 8, 2022 · 14 comments
Labels
support Support and questions

Comments

@ujhede
Copy link

ujhede commented May 8, 2022

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 ujhede added the support Support and questions label May 8, 2022
@olalid
Copy link
Collaborator

olalid commented May 8, 2022

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
Copy link

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
Copy link
Collaborator

olalid commented Apr 25, 2023

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
Copy link

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.

@Krabbee
Copy link

Krabbee commented Oct 23, 2023

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

@olalid
Copy link
Collaborator

olalid commented Oct 23, 2023

Can you show how your automation looks?

@Krabbee
Copy link

Krabbee commented Oct 23, 2023

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
Copy link
Collaborator

olalid commented Oct 24, 2023

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
Copy link

Krabbee commented Oct 24, 2023

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
Copy link
Collaborator

olalid commented Oct 24, 2023

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
Copy link

Krabbee commented Oct 24, 2023

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
Copy link

Mats1717 commented Oct 25, 2023 via email

@olalid
Copy link
Collaborator

olalid commented Oct 25, 2023

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
Copy link

Mats1717 commented Oct 25, 2023 via email

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

5 participants