Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106260

Trigger automation on a static value of a sensor

$
0
0

I am trying to prevent my laptop battery from being connected to charger all the time. Here is what I have done:

Power outlet → Kasa Wifi plug → laptop charger → laptop → IoTLink MQTT messages to HA about laptop

One of the IoTLink message is sensor.battery_remaining. It shows the percentage of battery remaining. When battery level falls below 25%, an automation turns on the Kasa wifi plug. When the battery level goes about 98%, an automation tuns off the Kasa wifi plug after 20 minutes. This allows battery to charge to 100%.

All works fine when I am actively using the laptop. But once the laptop goes into sleep mode, it can become 100% charged and the automation to turn of the wifi outlet will not trigger because IoTLink is not sending messages to HA. This is also fine.

The problem arises when I wake up the laptop and battery is 100% charged. The automation to turn off wifi outlet will never fire because the state has to change to trigger the automation but it cannot change beyond 100%. Is there a way to trigger the automation with something which says if battery_remaining=100, trigger the automation?

alias: Laptop Charger OFF
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.arun_hpspectre_battery_remaining
    above: '98'
condition: []
action:
  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.laptop_charger
mode: single

Thanks

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>