Skip to content

Commit 0ea2910

Browse files
authored
2025.5 fixes (#89)
Update HomeAssistantType and ServiceDataType types with HomeAssistant and ServiceCall Import `HomeAssistant` and `ServiceCall` from `homeassistant.core`. Replace `HomeAssistantType` with `HomeAssistant` in the `async_setup` function. Replace `ServiceDataType` with `ServiceCall` in the `set_fan_speed` and `set_mode` functions. Bump version Update hacs.json
1 parent 871aba0 commit 0ea2910

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

custom_components/argon40/__init__.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
STARTUP_MESSAGE,
1313
)
1414
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
15-
from homeassistant.core import callback
15+
from homeassistant.core import callback, HomeAssistant, ServiceCall
1616
import homeassistant.helpers.config_validation as cv
17-
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceDataType
17+
from homeassistant.helpers.typing import ConfigType
1818
from smbus import SMBus
1919
import voluptuous as vol
2020

@@ -29,7 +29,7 @@
2929
I2C_ADDRESS = 0x1A
3030

3131

32-
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
32+
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
3333
"""Set up the Argon40 component."""
3434

3535
_LOGGER.info(STARTUP_MESSAGE)
@@ -59,16 +59,16 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
5959
shutdown_pin = 4
6060
GPIO.setup(shutdown_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
6161

62-
@callback
63-
def event_detect_callback(channel):
64-
if GPIO.input(shutdown_pin):
65-
_LOGGER.debug("Rising edge detected on 4")
66-
# hass.bus.async_fire("argon40_event", {"key": "pressed"})
67-
else:
68-
_LOGGER.debug("Falling edge detected on 4")
69-
hass.bus.async_fire("argon40_event", {"action": "double-tap"})
62+
# @callback
63+
# def event_detect_callback(channel):
64+
# if GPIO.input(shutdown_pin):
65+
# _LOGGER.debug("Rising edge detected on 4")
66+
# # hass.bus.async_fire("argon40_event", {"key": "pressed"})
67+
# else:
68+
# _LOGGER.debug("Falling edge detected on 4")
69+
# hass.bus.async_fire("argon40_event", {"action": "double-tap"})
7070

71-
GPIO.add_event_detect(shutdown_pin, GPIO.BOTH, callback=event_detect_callback)
71+
# GPIO.add_event_detect(shutdown_pin, GPIO.BOTH, callback=event_detect_callback)
7272

7373
bus.write_byte(I2C_ADDRESS, 10)
7474

@@ -81,7 +81,7 @@ def event_detect_callback(channel):
8181
)
8282
return False
8383

84-
async def set_fan_speed(service: ServiceDataType) -> None:
84+
async def set_fan_speed(service: ServiceCall) -> None:
8585
value = service.data.get(ATTR_SPEED_NAME)
8686
_LOGGER.debug("Set fan speed to %s", value)
8787
bus.write_byte(I2C_ADDRESS, value)
@@ -94,7 +94,7 @@ async def set_fan_speed(service: ServiceDataType) -> None:
9494
schema=SERVICE_SET_FAN_SPEED_SCHEMA,
9595
)
9696

97-
async def set_mode(service: ServiceDataType) -> None:
97+
async def set_mode(service: ServiceCall) -> None:
9898
value = service.data.get(ATTR_ALWAYS_ON_NAME)
9999
_LOGGER.debug("Set always on mode to %s", value)
100100
if value:

custom_components/argon40/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"RPi.GPIO==0.7.1",
1010
"smbus-cffi==0.5.1"
1111
],
12-
"version": "0.0.5"
12+
"version": "0.0.6"
1313
}

hacs.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "Argon40",
3-
"homeassistant": "0.110.0",
4-
"render_readme": true,
3+
"homeassistant": "2025.1",
54
"zip_release": true,
65
"filename": "argon40.zip"
76
}

0 commit comments

Comments
 (0)