2
2
import logging
3
3
from typing import Any
4
4
5
- from RPi import GPIO # pylint: disable=import-error
5
+ # from RPi import GPIO # pylint: disable=import-error
6
6
from custom_components .argon40 .const import (
7
7
ATTR_NAME ,
8
8
DOMAIN ,
@@ -29,29 +29,29 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
29
29
_LOGGER .info (STARTUP_MESSAGE )
30
30
31
31
try :
32
- rev = GPIO .RPI_REVISION
33
- if rev == 2 or rev == 3 :
34
- bus = SMBus (1 )
35
- else :
36
- bus = SMBus (0 )
37
-
38
- @callback
39
- def cleanup_gpio (event : Any ) -> None :
40
- """Stuff to do before stopping."""
41
- GPIO .cleanup ()
42
-
43
- # not sure if @callback needed
44
- @callback
45
- def prepare_gpio (event : Any ) -> None :
46
- """Stuff to do when Home Assistant starts."""
47
- hass .bus .listen_once (EVENT_HOMEASSISTANT_STOP , cleanup_gpio )
48
-
49
- hass .bus .listen_once (EVENT_HOMEASSISTANT_START , prepare_gpio )
50
-
51
- GPIO .setwarnings (False )
52
- GPIO .setmode (GPIO .BCM )
53
- shutdown_pin = 4
54
- GPIO .setup (shutdown_pin , GPIO .IN , pull_up_down = GPIO .PUD_DOWN )
32
+ # rev = GPIO.RPI_REVISION
33
+ # if rev == 2 or rev == 3:
34
+ bus = SMBus (1 )
35
+ # else:
36
+ # bus = SMBus(0)
37
+
38
+ # @callback
39
+ # def cleanup_gpio(event: Any) -> None:
40
+ # """Stuff to do before stopping."""
41
+ # GPIO.cleanup()
42
+
43
+ # # not sure if @callback needed
44
+ # @callback
45
+ # def prepare_gpio(event: Any) -> None:
46
+ # """Stuff to do when Home Assistant starts."""
47
+ # hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, cleanup_gpio)
48
+
49
+ # hass.bus.listen_once(EVENT_HOMEASSISTANT_START, prepare_gpio)
50
+
51
+ # GPIO.setwarnings(False)
52
+ # GPIO.setmode(GPIO.BCM)
53
+ # shutdown_pin = 4
54
+ # GPIO.setup(shutdown_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
55
55
56
56
address = 0x1A
57
57
bus .write_byte (address , 10 )
@@ -63,7 +63,7 @@ def prepare_gpio(event: Any) -> None:
63
63
err .strerror ,
64
64
address ,
65
65
)
66
- pass
66
+ return False
67
67
68
68
async def set_fan_speed (service : ServiceDataType ) -> None :
69
69
value = service .data .get (ATTR_NAME )
0 commit comments