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?
I don’t use IOTlink, but does it have a more general active/inactive-type sensor for you laptop? You could use the laptop switching to “active” as a second trigger, just add the
Something like the following (make sure to put the actual name of your laptop activity sensor in the trigger section)
Batteries are “smart”, nowadays. They only charge when needed to maximize their life expectancy (different type of batteries require different “profiles” of charging).
If you’re trying to outsmart the logic, you’ll likely do more harm than good…
Actually, the laptop is three years old and original battery swelled up and died. Seems like it is a very common problem with HP laptops. Now, HP does not sell batteries, so my only choice was to either throw away a $1600 laptop or get a no-name battery from Amazon. I tried two different batteries from Amazon and they did not work. The third one is working. The battery seller said that the battery should not be left connected to charger all the time otherwise it will get damaged. I can manually connect/disconnect charger, but just wanted to add a “coolness” factor by automating with HA.