jdeneef / ha_gpiod

gpiod based RPI gpio switches and sensors
https://github.com/jdeneef/ha_gpiod
MIT License
21 stars 4 forks source link

Add the option to have persistent switches #15

Closed tomer-w closed 1 day ago

tomer-w commented 6 days ago

Add new GPIO switch class - PersistentRPiGPIOSwitch which will restore the switch state after Home Assistant restart. As part of the change move the core switch to use async functions

This is based on my work in the original branch: https://github.com/thecode/ha-rpi_gpio/pull/266

tomer-w commented 2 days ago

@jdeneef kind reminder. Thanks.

jdeneef commented 1 day ago

will take a look, hardly any time during weekdays, sry

tomer-w commented 1 day ago

Hi @jdeneef , thanks for taking a look. What did you do with this PR? It seems deleted.

jdeneef commented 1 day ago

sry, messed up using github, but now I see I only closed it ;-) more used to local git. Anyways, your request is merged in 1.4.1, see prereleases. I updated your code to avoid flickers at startup, and had to remove some reading of gpio switches before setting from persistence, cause this is more consistent. It's working for me in prod now, please test the prerelease.

tomer-w commented 1 day ago

I tested it in my setup and it looks great as well. I would remove all the commented lines to clean it up :). I think the changes you made make it looks better. I mainly wanted to minimize changes but you took it further.

jdeneef commented 1 day ago

nice! I will cleanup in a next drop and make it a github release if no errors pop up. Will test for a few days and than move to release state.