Compare commits

..

No commits in common. "main" and "2025.2.0" have entirely different histories.

6 changed files with 43 additions and 52 deletions

View File

@ -23,7 +23,7 @@ jobs:
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.6.0 uses: actions/setup-python@v5.4.0
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install dependencies - name: Install dependencies

View File

@ -52,20 +52,17 @@ async def async_setup_platform(
sensors = [] sensors = []
for sensor in config.get(CONF_SENSORS): for sensor in config.get(CONF_SENSORS):
try: sensors.append(
sensors.append( GPIODBinarySensor(
GPIODBinarySensor( hub,
hub, sensor[CONF_NAME],
sensor[CONF_NAME], sensor[CONF_PORT],
sensor[CONF_PORT], sensor.get(CONF_UNIQUE_ID) or f"{DOMAIN}_{sensor[CONF_PORT]}_{sensor[CONF_NAME].lower().replace(' ', '_')}",
sensor.get(CONF_UNIQUE_ID) or f"{DOMAIN}_{sensor[CONF_PORT]}_{sensor[CONF_NAME].lower().replace(' ', '_')}", sensor.get(CONF_INVERT_LOGIC),
sensor.get(CONF_INVERT_LOGIC), sensor.get(CONF_PULL_MODE),
sensor.get(CONF_PULL_MODE), sensor.get(CONF_BOUNCETIME)
sensor.get(CONF_BOUNCETIME)
)
) )
except Exception as e: )
_LOGGER.error(f"Failed to add binary sensor {sensor[CONF_NAME]} for port {sensor[CONF_PORT]}: {e}")
async_add_entities(sensors) async_add_entities(sensors)

View File

@ -71,24 +71,21 @@ async def async_setup_platform(
invert_relay = config[CONF_INVERT_RELAY] invert_relay = config[CONF_INVERT_RELAY]
covers = [] covers = []
for cover in config.get(CONF_COVERS): for cover in config.get(CONF_COVERS):
try: covers.append(
covers.append( GPIODCover(
GPIODCover( hub,
hub, cover[CONF_NAME],
cover[CONF_NAME], cover.get(CONF_RELAY_PIN),
cover.get(CONF_RELAY_PIN), relay_time,
relay_time, invert_relay,
invert_relay, "AS_IS",
"AS_IS", "PUSH_PULL",
"PUSH_PULL", cover.get(CONF_STATE_PIN),
cover.get(CONF_STATE_PIN), state_pull_mode,
state_pull_mode, invert_state,
invert_state, cover.get(CONF_UNIQUE_ID) or f"{DOMAIN}_{cover.get(CONF_RELAY_PIN)}_{cover[CONF_NAME].lower().replace(' ', '_')}",
cover.get(CONF_UNIQUE_ID) or f"{DOMAIN}_{cover.get(CONF_RELAY_PIN)}_{cover[CONF_NAME].lower().replace(' ', '_')}",
)
) )
except Exception as e: )
_LOGGER.error(f"Failed to add cover {cover[CONF_NAME]} for port {cover.get(CONF_RELAY_PIN)}:{cover.get(CONF_STATE_PIN)}: {e}")
async_add_entities(covers) async_add_entities(covers)

View File

@ -7,5 +7,5 @@
"iot_class": "local_push", "iot_class": "local_push",
"issue_tracker": "https://github.com/thecode/ha-rpi_gpio/issues", "issue_tracker": "https://github.com/thecode/ha-rpi_gpio/issues",
"requirements": [ "gpiod>=2.2.1" ], "requirements": [ "gpiod>=2.2.1" ],
"version": "2025.2.1" "version": "2025.2.0"
} }

View File

@ -56,21 +56,18 @@ async def async_setup_platform(
switches = [] switches = []
for switch in config.get(CONF_SWITCHES): for switch in config.get(CONF_SWITCHES):
try: switches.append(
switches.append( GPIODSwitch(
GPIODSwitch( hub,
hub, switch[CONF_NAME],
switch[CONF_NAME], switch[CONF_PORT],
switch[CONF_PORT], switch.get(CONF_UNIQUE_ID) or f"{DOMAIN}_{switch[CONF_PORT]}_{switch[CONF_NAME].lower().replace(' ', '_')}",
switch.get(CONF_UNIQUE_ID) or f"{DOMAIN}_{switch[CONF_PORT]}_{switch[CONF_NAME].lower().replace(' ', '_')}", switch.get(CONF_INVERT_LOGIC),
switch.get(CONF_INVERT_LOGIC), switch.get(CONF_PULL_MODE),
switch.get(CONF_PULL_MODE), switch.get(CONF_DRIVE),
switch.get(CONF_DRIVE), switch[CONF_PERSISTENT]
switch[CONF_PERSISTENT]
)
) )
except Exception as e: )
_LOGGER.error(f"Failed to add switch {switch[CONF_NAME]} for port {switch[CONF_PORT]}: {e}")
async_add_entities(switches) async_add_entities(switches)

View File

@ -1,7 +1,7 @@
black==25.1.0 black==24.10.0
flake8==7.3.0 flake8==7.1.1
isort==6.0.1 isort==5.13.2
mypy==1.17.0 mypy==1.14.1
pre-commit==4.2.0 pre-commit==4.1.0
pydocstyle==6.3.0 pydocstyle==6.3.0
pylint==3.3.7 pylint==3.3.3