jonasbkarlsson / ev_smart_charging

Electric vehicle smart charging for Home Assistant.
MIT License
169 stars 25 forks source link

`Charging is planned` does not pass as `true` even if it is #219

Closed enoch85 closed 11 months ago

enoch85 commented 11 months ago

Version of the custom_component

Version 1.9.0

Describe the bug

I'm not sure if this is a bug or a feature request... I would like to build an automation based on sensor.ev_smart_charging_charging and test if the Charging is planned is true. Just tested, and even if the value actually is true when checking in Developer tools, the condition doesn't pass.

I will use it to wake the car if charging is planned.

And another thing, I would like to be able to fetch the time slot when charging is planned from the charging_schedule, but I don't know if that's supported? If not please let me know and I'll open up a feature request.

Thanks for a great integration, makes my life so much easier!

jonasbkarlsson commented 11 months ago

To test on Charging is planned, I think an automation with following conditionstatement should work.

alias: EV - TEST condition
description: ""
trigger:
  - platform: state
    entity_id:
      - input_button.test
condition:
  - condition: state
    entity_id: sensor.ev_smart_charging_charging
    attribute: Charging is planned
    state: true
action:
  - service: number.set_value
    data:
      value: "30"
    target:
      entity_id: number.ev_smart_charging_minimum_ev_soc
mode: single

The starting time of the planned charging is one of the attributes of sensor.ev_smart_charging_charging. It can be fetched with a template like this {{ state_attr('sensor.ev_smart_charging_charging', 'Charging start time') }}

enoch85 commented 11 months ago

Thanks! That worked flawlessly.

Now, if I would like to extract the start time and stop time, do you have a suggestion for that?

jonasbkarlsson commented 11 months ago

I did provide a way to extract the start time above. {{ state_attr('sensor.ev_smart_charging_charging', 'Charging start time') }}

enoch85 commented 11 months ago

🙈 Yes you did.