jonasbkarlsson / ev_smart_charging

Electric vehicle smart charging for Home Assistant.
MIT License
191 stars 28 forks source link

Command-line switch not accepted as charger control switch #326

Open nilrog opened 3 months ago

nilrog commented 3 months ago

Version of the custom_component

Version 2.0.1

Configuration

Home assistant v2024.7.4 running in docker with this integration downloaded using HACS

Describe the bug

When trying to configure the integration it does not accept the switch entity that I have that controls the EV charger. I get the error "Brytare för laddningsstyrning hittas inte.". Yet the switch entity exists and can be used as switch everywhere else in HA. I have been using it for many years from automations et.al. If I substitute the switch entity in the configuration with one for a zigbee switch it is accepted.

The switch is a command-line switch that is configured like this:

command_line:
  - switch:
      name: the_name
      command_on: "..."
      command_off: "..."
      command_state: "..."
      value_template: '...'

Debug log

There are no debug logs from this integration that shows that anything goes wrong when I try to fill in the config parameters.


2024-09-03 12:20:26.659 DEBUG (MainThread) [custom_components.ev_smart_charging.config_flow] EVChargingControlConfigFlow.__init__
2024-09-03 12:20:26.659 DEBUG (MainThread) [custom_components.ev_smart_charging.config_flow] EVChargingControlConfigFlow.async_step_user
2024-09-03 12:21:05.879 DEBUG (MainThread) [custom_components.ev_smart_charging.config_flow] EVChargingControlConfigFlow.async_step_user
jopocop commented 1 month ago

Neither does normal custom switch. I don't have start/stop control in the charger, and the car (vw id3) doesn't have a switch to start/stop charging, but separate button entities. So I created a switch that turn_on --> service: button.press (start) and turn_off --> service: button,press (stop).

However, the integration doesn't allow this. "Charger control switch entity is not a switch."

janneho commented 1 month ago

Use automation for start/stop charging. Like this

jopocop commented 1 month ago

Perfection. Thanks.

Just noting that it seems to me that the integration's own manual start/stop buttons don't seem to work. I do have similar buttons in the VW integration itself. They are actually bit weird, they exist and they work, but they are not visible in the VW integration screen, only in the developer tools - where the description looks identical to the ones created by the VW integration.

Problem with these VW buttons is that they are obviously not connected to the EV smart charging integration, so stopping manually charging will not be relayed to the charging_charging -sensor. Therefore, I created instead a script that presses both start buttons or both stop buttons. One starts/stops the charging and the other just notifies the EV Smart Charging integration. And script triggered when switch.ev_smart_charging_smart_charging_activated switch changes state.

Still in testing phase. Testing is slow as the battery is mostly full.