Hello everyone,
I want to share my automation for smart charging the Switchbot Curtain 3 Motors with attached solarpanel. I’m using two of these on a large window. As you may know, batterys live longer when they are not always charged up to 100% and get used. So I created my automation in Home Assistant to smart charge these motors and disabled the auto-charge in the Switchbot App. The automation needs 2 boolean helpers, one for the left and one for the right motor. An Automation checks for the battery level and enables or disables the value for the helpers. This is my charging indicator. Below 21 the indicator is enabled, above 79 it gets disabled.
The other automation is to decide if it’s an working day or not and use different times for the actions. On workday at 7am and at weekend or public holiday at 10am.
As this is my first contribution to this forum, what do you think? Do you see any mistakes? What would you change?
Automation for enable charging:
alias: Balkon Lade-Start, wenn Akku ≤ 21%
description: ""
triggers:
- type: battery_level
device_id: 9d0f9537754a70828c259409efd7384e
entity_id: 992c4800e31485c8ef2c3690c80ba139
domain: sensor
trigger: device
below: 21
- type: battery_level
device_id: ddaab5077e8035cb7842ceb82fba172b
entity_id: 858cc7794528f7e9e44dac0fbf6ad438
domain: sensor
trigger: device
below: 21
conditions: []
actions:
- choose:
- conditions:
- type: is_battery_level
condition: device
device_id: 9d0f9537754a70828c259409efd7384e
entity_id: 992c4800e31485c8ef2c3690c80ba139
domain: sensor
below: 21
sequence:
- action: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.gardine_links_laden
- conditions:
- type: is_battery_level
condition: device
device_id: ddaab5077e8035cb7842ceb82fba172b
entity_id: 858cc7794528f7e9e44dac0fbf6ad438
domain: sensor
below: 22
sequence:
- action: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.gardine_rechts_laden
mode: single
Automation for disable charging:
alias: Balkon Lade-Stop, wenn Akku ≥ 80%
description: ""
triggers:
- type: battery_level
device_id: 9d0f9537754a70828c259409efd7384e
entity_id: 992c4800e31485c8ef2c3690c80ba139
domain: sensor
trigger: device
above: 79
- type: battery_level
device_id: ddaab5077e8035cb7842ceb82fba172b
entity_id: 858cc7794528f7e9e44dac0fbf6ad438
domain: sensor
trigger: device
above: 79
conditions: []
actions:
- choose:
- conditions:
- type: is_battery_level
condition: device
device_id: 9d0f9537754a70828c259409efd7384e
entity_id: 992c4800e31485c8ef2c3690c80ba139
domain: sensor
above: 79
sequence:
- action: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.gardine_links_laden
- conditions:
- type: is_battery_level
condition: device
device_id: ddaab5077e8035cb7842ceb82fba172b
entity_id: 858cc7794528f7e9e44dac0fbf6ad438
domain: sensor
above: 79
sequence:
- action: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.gardine_rechts_laden
mode: single
Automation to open the curtains on workdays:
alias: Balkon öffnen (Werktag)
description: ""
triggers:
- trigger: time
at: "07:00:00"
conditions:
- type: is_on
condition: device
device_id: c096cccd607f0b21cf3fee705078e2a8
entity_id: 43ce77a1c49dddc0ae435708ea6e4f27
domain: binary_sensor
actions:
- if:
- condition: state
entity_id: input_boolean.gardine_links_laden
state: "on"
then:
- device_id: 9d0f9537754a70828c259409efd7384e
domain: cover
entity_id: 1b4e86fe521f0a2e899ff317c1c565d0
type: set_position
position: 50
else:
- device_id: 9d0f9537754a70828c259409efd7384e
domain: cover
entity_id: 1b4e86fe521f0a2e899ff317c1c565d0
type: open
- if:
- condition: state
entity_id: input_boolean.gardine_rechts_laden
state: "on"
then:
- device_id: ddaab5077e8035cb7842ceb82fba172b
domain: cover
entity_id: 9237bfa53abc64b338dd77d7f40837ee
type: set_position
position: 50
else:
- device_id: ddaab5077e8035cb7842ceb82fba172b
domain: cover
entity_id: 9237bfa53abc64b338dd77d7f40837ee
type: open
mode: single
Automation to open the curtains on weekend/public holidays:
alias: Balkon öffnen (außerh. Werktagen)
description: ""
triggers:
- trigger: time
at: "10:00:00"
conditions:
- type: is_off
condition: device
device_id: c096cccd607f0b21cf3fee705078e2a8
entity_id: 43ce77a1c49dddc0ae435708ea6e4f27
domain: binary_sensor
actions:
- if:
- condition: state
entity_id: input_boolean.gardine_links_laden
state: "on"
then:
- device_id: 9d0f9537754a70828c259409efd7384e
domain: cover
entity_id: 1b4e86fe521f0a2e899ff317c1c565d0
type: set_position
position: 50
else:
- device_id: 9d0f9537754a70828c259409efd7384e
domain: cover
entity_id: 1b4e86fe521f0a2e899ff317c1c565d0
type: open
- if:
- condition: state
entity_id: input_boolean.gardine_rechts_laden
state: "on"
then:
- device_id: ddaab5077e8035cb7842ceb82fba172b
domain: cover
entity_id: 9237bfa53abc64b338dd77d7f40837ee
type: set_position
position: 50
else:
- device_id: ddaab5077e8035cb7842ceb82fba172b
domain: cover
entity_id: 9237bfa53abc64b338dd77d7f40837ee
type: open
mode: single
Automation to close the curtains 30 minutes before sunset:
alias: Balkon schließen (30 Min. vor Sonnenuntergang)
description: ""
triggers:
- trigger: sun
event: sunset
offset: "-00:30:00"
conditions: []
actions:
- device_id: 9d0f9537754a70828c259409efd7384e
domain: cover
entity_id: 1b4e86fe521f0a2e899ff317c1c565d0
type: close
- device_id: ddaab5077e8035cb7842ceb82fba172b
domain: cover
entity_id: 9237bfa53abc64b338dd77d7f40837ee
type: close
mode: single