1212 STARTUP_MESSAGE ,
1313)
1414from homeassistant .const import EVENT_HOMEASSISTANT_START , EVENT_HOMEASSISTANT_STOP
15- from homeassistant .core import callback
15+ from homeassistant .core import callback , HomeAssistant , ServiceCall
1616import homeassistant .helpers .config_validation as cv
17- from homeassistant .helpers .typing import ConfigType , HomeAssistantType , ServiceDataType
17+ from homeassistant .helpers .typing import ConfigType
1818from smbus import SMBus
1919import voluptuous as vol
2020
2929I2C_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 :
0 commit comments