(Bosch) Ebike charging automation

After searching ( like many others ) for a way of charging my two Bosch BES3 E-Bikes not to 100% but stopping at around 90% I ended up with the following plan.

  1. I created a sensor for my TAPO Plug showing the actual Power consumption which is during normal charging around 180 W and slowly decreases as the SOC get`s near 90%.

  2. I cretaed a second sensor substracting 100 from the actual Value, because the following blueprint I’m using can handle only Values with a max. of 100 W.

  3. This shown drop of charging current start’s at 90% SOC and when this happens the automation turn’s of the TAPO Plug and send’s a notification.

Tried this out for a while and you can easily adjust the end of charging by changing the “appliance_finishing_power_threshold:” value

This is the autimation I’m using.

The code for the Helper TemplateSensor with - 100W Power

{{ (float(states( "sensor.tapo_ebike_current_power"))) - 100 }}

And the yaml code for Fleofabri’s blueprint

alias: 90%laden
description: ""
use_blueprint:
  path: leofabri/appliance-status-monitor.yaml
  input:
    appliance_socket: switch.tapo_ebike
    appliance_power_sensor: sensor.tapo_100
    delayed_job_completion_duration: 0
    actions_job_cycle_ends:
      - type: turn_off
        device_id: 830732532d893247de93ce2364dff12b
        entity_id: 5f21b4cf06c796384dcd35758d9e8c0
        domain: switch
      - metadata: {}
        data:
          message: 90% voll
        action: notify.mobile_app_iphone
      - metadata: {}
        data:
          stop_actions: true
        target:
          entity_id: automation.90_laden
        action: automation.turn_off
    appliance_starting_power_threshold: 74
    appliance_finishing_power_threshold: 73
    appliance_state_machine: input_select.tapo_ebike_state_machine
    appliance_job_cycle: input_boolean.tapo_ebike_job_cycle
    delayed_job_completion_timer: timer.tapo_ebike_delayed_job_completion_timer
    automation_self_trigger: input_boolean.tapo_ebike_automation_self_trigger

The only thing what took me a while was setting up all the state machine helpers but therefore you just have to read LEOFABRI’s description

In my case the Automation is triggert by an automation with an IKEA Tradfri switch ( right press = charching 90% left press is charging 100%)

alias: E-Bike laden 90%
description: ""
trigger:
  - platform: device
    domain: mqtt
    device_id: 7096ed1cfa2b91da89d
    type: action
    subtype: arrow_right_click
condition: []
action:
  - type: turn_on
    device_id: 830732532d893247de93ce2364dff12b
    entity_id: 5f21b4cf06c796384dcd35758d9e8c0
    domain: switch
  - target:
      entity_id: automation.90_laden
    data: {}
    action: automation.turn_on
mode: single
4 Likes

Thank you for sharing. This is something I have intended to look into for my Haibike which has a Yamaha motor and battery combination.
This should be a good donor project.
Thanks!