Flodu31 / HomeAssistant-PeugeotIntegration

Integration between Peugeot API and Home Assistant
108 stars 17 forks source link

How to add "stop charging" button? #87

Open NoisyBoy1308 opened 2 months ago

NoisyBoy1308 commented 2 months ago

I am quite new to HA and my coding skills are below zero. As I cant control my wallbox directly and cannot use evcc, I am working on aworkaround via PSACC. My idea is, that HA will stop charging the car, when the House battery level drops below a certain point. But I cannot figure out, how to add a command that will be sent to the car, so it stops charging. Can someone point me in the right direction?

Simanias commented 1 month ago

Here you go:

Add this to your configuration.yaml:

input_button:
    #NAME#_stop_charging_button: #NAME# change into your own sensor name
      name: Stop charging
      icon: mdi:battery-off-outline
rest_command:
  # stop charging
  #NAME#_stop_charging: #NAME# change into you own sensor name
    url: "http://ip:5000/charge_now/#YOURVIN#/0" #YOURVIN# change into your own VIN and add the correct IP of Home Assistant
    method: GET

If you already have input_button: or rest_command: line in you configuration.yaml, add the information from the line below input_button: or rest_command:

Add this to your automation.yaml

- id: '200844584851'
  alias: stop - charging
  description: ''
  trigger:
  - platform: state
    entity_id:
    - input_button.#NAME#_stop_charging_button #same name as the input button described above
  condition: []
  action:
  - action: rest_command.#NAME#_stop_charging #same name as the rest command described above
    data: {}
  mode: single

Reload the configuration files and add the stop - charging button to a card on the dashboard.

FilipeOS commented 1 week ago

Is this like the delayed charging? stop will defer charging to 22:00 for example? and if charge go back again? I tried but I was not getting it

Simanias commented 5 days ago

Is this like the delayed charging? stop will defer charging to 22:00 for example? and if charge go back again? I tried but I was not getting it

No, this is button to stop the current charging.