Wallpanel Battery Management

Blueprint to control the charger for a permanently installed tablet control panel with a controllable switch device on the charger.

You can select the battery sensor, the charged percentage, the low charge percentage and the switch to control the charger.

Screen

Blueprint

Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or import this Blueprint by using th forum topic URL:

blueprint:
  name: Wallpanel Battery Management
  description: 'Control the charger for a permanently mounted tablet control panel.'

  domain: automation
  input:
    battery:
      name: Battery
      description: This is the battery sensor for the device.
      selector:
        entity:
          domain: sensor
          device_class: battery
    charged_percent:
      name: Charged Percent
      description: 'The percentage charge the charger will turn off. (default: 80%)'
      selector:
        number:
          min: 50
          max: 100
          unit_of_measurement: '%'
          mode: slider
          step: 1
      default: 80
    low_percent:
      name: Low Percent
      description: 'The percentage charge the charger will turn on. (default: 30%)'
      selector:
        number:
          min: 0
          max: 50
          unit_of_measurement: '%'
          mode: slider
          step: 1
      default: 30
    charger:
      name: Charger
      description: The switch entity which turns the charger on and off.
      selector:
        entity:
          domain: switch

  source_url: https://gist.github.com/seamus65/ce7da8634366630537a62a55cfe321c8

mode: single

trigger:
  - platform: homeassistant
    event: start
  - platform: event
    event_type: automation_reloaded
  - platform: numeric_state
    entity_id: !input battery
    above: !input charged_percent
  - platform: numeric_state
    entity_id: !input battery
    below: !input low_percent

action:
  - choose:
    - conditions:
        - condition: numeric_state
          entity_id: !input battery
          above: !input charged_percent
      sequence:
        - service: switch.turn_off
          data:
            entity_id: !input charger
    - conditions:
        - condition: numeric_state
          entity_id: !input battery
          below: !input low_percent
      sequence:
        - service: switch.turn_on
          data:
            entity_id: !input charger
3 Likes

Thank you very mutch, going to use it!

1 Like

Let me know if there are any problems.

The automation works for me, but converting to blueprint might have done something.

Why does the blueprint request inputs for charged_percent and low_percent but only uses them in the automation’s condition and not its trigger? In the trigger, the values are hard-coded to 80 and 30. Shouldn’t the triggers also be using the inputs?

Oops, I will fix that…

That should be it fixed now.

Good spot, a leftover from testing and converting from my automation. :upside_down_face:

Has anyone successfully imported this?

If I use the github url I get:

mapping values are not allowed here in “”, line 16, column 77: … charger will turn off. (default: 80%) ^

If I use the community thread url I get:

No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax.

i also get an error when trying to import this

I think I have fixed it.

Let me know if it works now.

:+1: Thanks muchly!

Thanks! I had plans for creating exactly this automation.
Since my switches are Philips Hue light switches, I had to find/replace all ‘switch’ with ‘light’ in the Blueprint.

That’s good, glad it works for you.

thank you very useful, I’m using it for a smartphone that is always connected to the electricity grid. As a further improvement it would be very nice to be able to introduce a logic to prioritize charging during the night when electricity is cheaper. Do you have any plans to produce something like this?
thank you

1 Like

Thank you.

I do not have any plans to modify this at the moment, but the blueprint files are reasonably easy to modify, you could make a copy and have a go at modifying and updating yourself and let me know how you get on.

thanks for this

Just what I needed, thank you! My attempt was an epic fail so I was pleased to stumble across yours which addresses my Home Assistant start-up issue.