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

Controlling two cars #266

Open
mvso opened this issue Jun 4, 2024 · 3 comments
Open

Controlling two cars #266

mvso opened this issue Jun 4, 2024 · 3 comments

Comments

@mvso
Copy link

mvso commented Jun 4, 2024

Is your feature request related to a problem? Please describe.
I have two cars and one home charger. Each night I typically plug in the one with the lowest charge. I want to be able to use the features of this integration on both cars

Describe the solution you'd like
I want to have the app control multiple cars using the same charger (one at a time)

Describe alternatives you've considered
An automation sensing the charging status from each of the cars (and possibly the charger), triggering an update of the value of two helpers, SOC and SOC target based on values from the car connected

Additional context

@andreasd
Copy link

andreasd commented Jul 4, 2024

shouldn't it be possible to add the integration twice and set it up for each car?

@jtonk
Copy link

jtonk commented Jul 5, 2024

I have the same issue. A workaround is to have the integration setup with home assistant helpers for the soc and charge speed and have a separate automation to update the helpers based on which car is plugged in. This is determined by location of the car and whether it is plugged in the charger. This does rely on the integration of the car, but for Audi this works fine. In the past I've used Tronity, which was also working.

@mvso
Copy link
Author

mvso commented Jul 7, 2024

I have had success with the following:
I made a couple of hjelpers that the integration is linked to:
IMG_0481

Furthermore, I have an automation updating the helper values every 10 minutes:
`
alias: Set EV charger values
description: ""
trigger:

  • platform: time_pattern
    minutes: /10
    condition:
  • condition: state
    entity_id: sensor.solberg_garasje_charger_mode
    state: Charging
  • condition: or
    conditions:
    • condition: state
      entity_id: binary_sensor.i3_charging_status
      state: "on"
    • condition: state
      entity_id: binary_sensor.ix_xdrive40_charging_status
      state: "on"
      alias: "Verify that one of the cars is connected "
      action:
  • alias: Select car
    choose:
    • conditions:
      • condition: state
        entity_id: binary_sensor.ix_xdrive40_charging_status
        state: "on"
        sequence:
      • service: text.set_value
        metadata: {}
        data:
        value: BMW iX
        target:
        entity_id: input_text.charger_input_selected_car
      • service: input_number.set_value
        target:
        entity_id: input_number.charger_input_soc_target
        data:
        value: "{{ states('number.ix_xdrive40_target_soc')|int(0) }}"
      • service: input_number.set_value
        target:
        entity_id: input_number.charger_input_soc
        data:
        value: >-
        {{ states('sensor.ix_xdrive40_remaining_battery_percent')|int(0)
        }}
      • service: number.set_value
        target:
        entity_id: number.ev_smart_charging_charging_speed
        data:
        value: >-
        {{ ( states('sensor.solberg_garasje_charge_power')|int(0) /
        76600 * 100 )|round(2) }}
        alias: iX
    • conditions:
      • condition: state
        entity_id: binary_sensor.i3_charging_status
        state: "on"
        sequence:
      • service: text.set_value
        metadata: {}
        data:
        value: BMW i3
        target:
        entity_id: input_text.charger_input_selected_car
      • service: input_number.set_value
        target:
        entity_id: input_number.charger_input_soc_target
        data:
        value: "{{ states('sensor.i3_charging_target')|int(0) }}"
      • service: input_number.set_value
        target:
        entity_id: input_number.charger_input_soc
        data:
        value: "{{ states('sensor.i3_remaining_battery_percent')|int(0) }}"
      • service: number.set_value
        target:
        entity_id: number.ev_smart_charging_charging_speed
        data:
        value: >-
        {{ ( states('sensor.solberg_garasje_charge_power')|int(0) /
        42200 * 100 )|round(2) }}
        alias: i3
  • if:
    • condition: and
      conditions:
      • condition: state
        entity_id: binary_sensor.ix_xdrive40_charging_status
        state: "on"
      • condition: state
        entity_id: binary_sensor.i3_charging_status
        state: "on"
        alias: "Both cars are charging "
        then:
    • service: input_number.set_value
      target:
      entity_id: input_number.charger_input_soc_target
      data:
      value: 80
    • service: input_number.set_value
      target:
      entity_id: input_number.charger_input_soc
      data:
      value: 10
    • service: text.set_value
      metadata: {}
      data:
      value: "Error -Both cars charging "
      target:
      entity_id: input_text.charger_input_selected_car
    • service: number.set_value
      target:
      entity_id: number.ev_smart_charging_charging_speed
      data:
      value: 0.1
      alias: "Charge if both cars are charging simultaneously "
      mode: single
      `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants