boneIO 0.2.0.dev9__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {boneio-0.2.0.dev9/boneio.egg-info → boneio-0.2.1}/PKG-INFO +2 -2
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/bonecli.py +3 -3
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/const.py +2 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/example_config/input.yaml +46 -46
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/example_config/output32x5A.yaml +32 -32
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/__init__.py +6 -2
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/gpio.py +1 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/ha_discovery.py +50 -42
- boneio-0.2.0.dev9/boneio/runner.py → boneio-0.2.1/boneio/helper/logger.py +4 -68
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/input/gpio.py +1 -1
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/manager.py +38 -3
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/oled.py +4 -5
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/relay/basic.py +6 -1
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/relay/gpio.py +2 -2
- boneio-0.2.1/boneio/runner.py +70 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/schema/schema.yaml +6 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/sensor/gpio.py +3 -1
- boneio-0.2.1/boneio/version.py +2 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1/boneio.egg-info}/PKG-INFO +2 -2
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio.egg-info/SOURCES.txt +1 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio.egg-info/entry_points.txt +0 -1
- boneio-0.2.0.dev9/boneio/version.py +0 -2
- {boneio-0.2.0.dev9 → boneio-0.2.1}/LICENSE +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/MANIFEST.in +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/README.md +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/__init__.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/cover.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/example_config/__init__.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/example_config/adc.yaml +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/example_config/config.yaml +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/example_config/cover.yaml +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/example_config/output24x16A.yaml +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/fonts/danube__.ttf +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/events.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/exceptions.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/loader.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/mqtt.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/oled.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/queue.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/state_manager.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/stats.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/helper/yaml.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/input/__init__.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/modbus.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/mqtt_client.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/relay/__init__.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/relay/mcp.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/schema/actions.yaml +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/schema/actions_sensor.yaml +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/schema/actions_switch.yaml +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/sensor/__init__.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/sensor/adc.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/sensor/modbus/__init__.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/sensor/modbus/sdm120.json +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/sensor/modbus/sdm630.json +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/sensor/modbus/sofar.json +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio/sensor/temp/__init__.py +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio.egg-info/dependency_links.txt +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio.egg-info/requires.txt +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/boneio.egg-info/top_level.txt +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/requirements.txt +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/setup.cfg +0 -0
- {boneio-0.2.0.dev9 → boneio-0.2.1}/setup.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: boneio
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Python App for BoneIO
|
|
5
5
|
Home-page: https://github.com/boneIO-eu/app_bbb
|
|
6
|
+
Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.2.1.zip
|
|
6
7
|
License: GNU General Public License v3.0
|
|
7
|
-
Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.2.0.dev9.zip
|
|
8
8
|
Platform: UNKNOWN
|
|
9
9
|
Classifier: Programming Language :: Python
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.7
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import argparse
|
|
3
3
|
import asyncio
|
|
4
4
|
import logging
|
|
5
|
-
import os
|
|
6
5
|
import sys
|
|
7
6
|
|
|
8
7
|
from colorlog import ColoredFormatter
|
|
9
8
|
|
|
10
9
|
from boneio.const import ACTION
|
|
11
10
|
from boneio.helper import load_config_from_file
|
|
12
|
-
from boneio.
|
|
11
|
+
from boneio.helper.logger import configure_logger
|
|
12
|
+
from boneio.runner import async_run
|
|
13
13
|
from boneio.version import __version__
|
|
14
14
|
|
|
15
15
|
TASK_CANCELATION_TIMEOUT = 1
|
|
@@ -74,7 +74,7 @@ def run(config: str, debug: int, mqttusername: str = "", mqttpassword: str = "")
|
|
|
74
74
|
return asyncio.run(
|
|
75
75
|
async_run(
|
|
76
76
|
config=_config,
|
|
77
|
-
|
|
77
|
+
config_file=config,
|
|
78
78
|
mqttusername=mqttusername,
|
|
79
79
|
mqttpassword=mqttpassword,
|
|
80
80
|
),
|
|
@@ -2,124 +2,124 @@
|
|
|
2
2
|
pin: P8_37
|
|
3
3
|
actions:
|
|
4
4
|
single:
|
|
5
|
-
action: output
|
|
6
|
-
|
|
5
|
+
- action: output
|
|
6
|
+
pin: light 1
|
|
7
7
|
double:
|
|
8
|
-
action: output
|
|
9
|
-
|
|
8
|
+
- action: output
|
|
9
|
+
pin: switch 1
|
|
10
10
|
- id: IN_02
|
|
11
11
|
pin: P8_38
|
|
12
12
|
actions:
|
|
13
13
|
single:
|
|
14
|
-
action: output
|
|
15
|
-
|
|
14
|
+
- action: output
|
|
15
|
+
pin: light 2
|
|
16
16
|
double:
|
|
17
|
-
action: output
|
|
18
|
-
|
|
17
|
+
- action: output
|
|
18
|
+
pin: switch 2
|
|
19
19
|
- id: IN_03
|
|
20
20
|
pin: P8_39
|
|
21
21
|
actions:
|
|
22
22
|
single:
|
|
23
|
-
action: output
|
|
24
|
-
|
|
23
|
+
- action: output
|
|
24
|
+
pin: light 3
|
|
25
25
|
double:
|
|
26
|
-
action: output
|
|
27
|
-
|
|
26
|
+
- action: output
|
|
27
|
+
pin: switch 3
|
|
28
28
|
- id: IN_04
|
|
29
29
|
pin: P8_40
|
|
30
30
|
actions:
|
|
31
31
|
single:
|
|
32
|
-
action: output
|
|
33
|
-
|
|
32
|
+
- action: output
|
|
33
|
+
pin: light 4
|
|
34
34
|
double:
|
|
35
|
-
action: output
|
|
36
|
-
|
|
35
|
+
- action: output
|
|
36
|
+
pin: switch 4
|
|
37
37
|
- id: IN_05
|
|
38
38
|
pin: P8_41
|
|
39
39
|
actions:
|
|
40
40
|
single:
|
|
41
|
-
action: output
|
|
42
|
-
|
|
41
|
+
- action: output
|
|
42
|
+
pin: light 5
|
|
43
43
|
double:
|
|
44
|
-
action: output
|
|
45
|
-
|
|
44
|
+
- action: output
|
|
45
|
+
pin: switch 5
|
|
46
46
|
- id: IN_06
|
|
47
47
|
pin: P8_42
|
|
48
48
|
actions:
|
|
49
49
|
single:
|
|
50
|
-
action: output
|
|
51
|
-
|
|
50
|
+
- action: output
|
|
51
|
+
pin: light 6
|
|
52
52
|
double:
|
|
53
|
-
action: output
|
|
54
|
-
|
|
53
|
+
- action: output
|
|
54
|
+
pin: switch 6
|
|
55
55
|
- id: IN_07
|
|
56
56
|
pin: P8_43
|
|
57
57
|
actions:
|
|
58
58
|
single:
|
|
59
|
-
action: output
|
|
60
|
-
|
|
59
|
+
- action: output
|
|
60
|
+
pin: light 7
|
|
61
61
|
|
|
62
62
|
- id: IN_08
|
|
63
63
|
pin: P8_44
|
|
64
64
|
actions:
|
|
65
65
|
single:
|
|
66
|
-
action: output
|
|
67
|
-
|
|
66
|
+
- action: output
|
|
67
|
+
pin: light 8
|
|
68
68
|
- id: IN_09
|
|
69
69
|
pin: P8_45
|
|
70
70
|
actions:
|
|
71
71
|
single:
|
|
72
|
-
action: output
|
|
73
|
-
|
|
72
|
+
- action: output
|
|
73
|
+
pin: light 9
|
|
74
74
|
- id: IN_10
|
|
75
75
|
pin: P8_46
|
|
76
76
|
actions:
|
|
77
77
|
single:
|
|
78
|
-
action: output
|
|
79
|
-
|
|
78
|
+
- action: output
|
|
79
|
+
pin: light 10
|
|
80
80
|
- id: IN_11
|
|
81
81
|
pin: P9_42
|
|
82
82
|
actions:
|
|
83
83
|
single:
|
|
84
|
-
action: output
|
|
85
|
-
|
|
84
|
+
- action: output
|
|
85
|
+
pin: light 11
|
|
86
86
|
- id: IN_12
|
|
87
87
|
pin: P9_31
|
|
88
88
|
actions:
|
|
89
89
|
single:
|
|
90
|
-
action: output
|
|
91
|
-
|
|
90
|
+
- action: output
|
|
91
|
+
pin: light 12
|
|
92
92
|
- id: IN_13
|
|
93
93
|
pin: P9_30
|
|
94
94
|
actions:
|
|
95
95
|
single:
|
|
96
|
-
action: output
|
|
97
|
-
|
|
96
|
+
- action: output
|
|
97
|
+
pin: light 13
|
|
98
98
|
- id: IN_14
|
|
99
99
|
pin: P9_29
|
|
100
100
|
actions:
|
|
101
101
|
single:
|
|
102
|
-
action: output
|
|
103
|
-
|
|
102
|
+
- action: output
|
|
103
|
+
pin: light 14
|
|
104
104
|
|
|
105
105
|
- id: IN_15
|
|
106
106
|
pin: P9_28
|
|
107
107
|
actions:
|
|
108
108
|
single:
|
|
109
|
-
action: output
|
|
110
|
-
|
|
109
|
+
- action: output
|
|
110
|
+
pin: light 15
|
|
111
111
|
- id: IN_16
|
|
112
112
|
pin: P9_27
|
|
113
113
|
actions:
|
|
114
114
|
single:
|
|
115
|
-
action: output
|
|
116
|
-
|
|
115
|
+
- action: output
|
|
116
|
+
pin: light 16
|
|
117
117
|
- id: IN_17
|
|
118
118
|
pin: P9_25
|
|
119
119
|
actions:
|
|
120
120
|
single:
|
|
121
|
-
action: output
|
|
122
|
-
|
|
121
|
+
- action: output
|
|
122
|
+
pin: light 4
|
|
123
123
|
- id: IN_18
|
|
124
124
|
pin: P9_23
|
|
125
125
|
- id: IN_19
|
|
@@ -2,159 +2,159 @@
|
|
|
2
2
|
kind: mcp
|
|
3
3
|
mcp_id: mcp1
|
|
4
4
|
pin: 0
|
|
5
|
-
|
|
5
|
+
output_type: light
|
|
6
6
|
- id: light 2
|
|
7
7
|
kind: mcp
|
|
8
8
|
mcp_id: mcp1
|
|
9
9
|
pin: 1
|
|
10
|
-
|
|
10
|
+
output_type: light
|
|
11
11
|
- id: light 3
|
|
12
12
|
kind: mcp
|
|
13
13
|
mcp_id: mcp1
|
|
14
14
|
pin: 2
|
|
15
|
-
|
|
15
|
+
output_type: light
|
|
16
16
|
- id: light 4
|
|
17
17
|
kind: mcp
|
|
18
18
|
mcp_id: mcp1
|
|
19
19
|
pin: 3
|
|
20
|
-
|
|
20
|
+
output_type: light
|
|
21
21
|
- id: light 5
|
|
22
22
|
kind: mcp
|
|
23
23
|
mcp_id: mcp1
|
|
24
24
|
pin: 4
|
|
25
|
-
|
|
25
|
+
output_type: light
|
|
26
26
|
- id: light 6
|
|
27
27
|
kind: mcp
|
|
28
28
|
mcp_id: mcp1
|
|
29
29
|
pin: 5
|
|
30
|
-
|
|
30
|
+
output_type: light
|
|
31
31
|
- id: light 7
|
|
32
32
|
kind: mcp
|
|
33
33
|
mcp_id: mcp1
|
|
34
34
|
pin: 6
|
|
35
|
-
|
|
35
|
+
output_type: light
|
|
36
36
|
- id: light 8
|
|
37
37
|
kind: mcp
|
|
38
38
|
mcp_id: mcp1
|
|
39
39
|
pin: 7
|
|
40
|
-
|
|
40
|
+
output_type: light
|
|
41
41
|
- id: light 9
|
|
42
42
|
kind: mcp
|
|
43
43
|
mcp_id: mcp1
|
|
44
44
|
pin: 8
|
|
45
|
-
|
|
45
|
+
output_type: light
|
|
46
46
|
- id: light 10
|
|
47
47
|
kind: mcp
|
|
48
48
|
mcp_id: mcp1
|
|
49
49
|
pin: 9
|
|
50
|
-
|
|
50
|
+
output_type: light
|
|
51
51
|
- id: light 11
|
|
52
52
|
kind: mcp
|
|
53
53
|
mcp_id: mcp1
|
|
54
54
|
pin: 10
|
|
55
|
-
|
|
55
|
+
output_type: light
|
|
56
56
|
- id: light 12
|
|
57
57
|
kind: mcp
|
|
58
58
|
mcp_id: mcp1
|
|
59
59
|
pin: 11
|
|
60
|
-
|
|
60
|
+
output_type: light
|
|
61
61
|
- id: light 13
|
|
62
62
|
kind: mcp
|
|
63
63
|
mcp_id: mcp1
|
|
64
64
|
pin: 12
|
|
65
|
-
|
|
65
|
+
output_type: light
|
|
66
66
|
- id: light 14
|
|
67
67
|
kind: mcp
|
|
68
68
|
mcp_id: mcp1
|
|
69
69
|
pin: 13
|
|
70
|
-
|
|
70
|
+
output_type: light
|
|
71
71
|
- id: light 15
|
|
72
72
|
kind: mcp
|
|
73
73
|
mcp_id: mcp1
|
|
74
74
|
pin: 14
|
|
75
|
-
|
|
75
|
+
output_type: light
|
|
76
76
|
- id: light 16
|
|
77
77
|
kind: mcp
|
|
78
78
|
mcp_id: mcp1
|
|
79
79
|
pin: 15
|
|
80
|
-
|
|
80
|
+
output_type: light
|
|
81
81
|
- id: switch 1
|
|
82
82
|
kind: mcp
|
|
83
83
|
mcp_id: mcp2
|
|
84
84
|
pin: 0
|
|
85
|
-
|
|
85
|
+
output_type: switch
|
|
86
86
|
- id: switch 2
|
|
87
87
|
kind: mcp
|
|
88
88
|
mcp_id: mcp2
|
|
89
89
|
pin: 1
|
|
90
|
-
|
|
90
|
+
output_type: switch
|
|
91
91
|
- id: switch 3
|
|
92
92
|
kind: mcp
|
|
93
93
|
mcp_id: mcp2
|
|
94
94
|
pin: 2
|
|
95
|
-
|
|
95
|
+
output_type: switch
|
|
96
96
|
- id: switch 4
|
|
97
97
|
kind: mcp
|
|
98
98
|
mcp_id: mcp2
|
|
99
99
|
pin: 3
|
|
100
|
-
|
|
100
|
+
output_type: switch
|
|
101
101
|
- id: switch 5
|
|
102
102
|
kind: mcp
|
|
103
103
|
mcp_id: mcp2
|
|
104
104
|
pin: 4
|
|
105
|
-
|
|
105
|
+
output_type: switch
|
|
106
106
|
- id: switch 6
|
|
107
107
|
kind: mcp
|
|
108
108
|
mcp_id: mcp2
|
|
109
109
|
pin: 5
|
|
110
|
-
|
|
110
|
+
output_type: switch
|
|
111
111
|
- id: switch 7
|
|
112
112
|
kind: mcp
|
|
113
113
|
mcp_id: mcp2
|
|
114
114
|
pin: 6
|
|
115
|
-
|
|
115
|
+
output_type: switch
|
|
116
116
|
- id: switch 8
|
|
117
117
|
kind: mcp
|
|
118
118
|
mcp_id: mcp2
|
|
119
119
|
pin: 7
|
|
120
|
-
|
|
120
|
+
output_type: switch
|
|
121
121
|
- id: switch 9
|
|
122
122
|
kind: mcp
|
|
123
123
|
mcp_id: mcp2
|
|
124
124
|
pin: 8
|
|
125
|
-
|
|
125
|
+
output_type: switch
|
|
126
126
|
- id: switch 10
|
|
127
127
|
kind: mcp
|
|
128
128
|
mcp_id: mcp2
|
|
129
129
|
pin: 9
|
|
130
|
-
|
|
130
|
+
output_type: switch
|
|
131
131
|
- id: switch 11
|
|
132
132
|
kind: mcp
|
|
133
133
|
mcp_id: mcp2
|
|
134
134
|
pin: 10
|
|
135
|
-
|
|
135
|
+
output_type: switch
|
|
136
136
|
- id: switch 12
|
|
137
137
|
kind: mcp
|
|
138
138
|
mcp_id: mcp2
|
|
139
139
|
pin: 11
|
|
140
|
-
|
|
140
|
+
output_type: switch
|
|
141
141
|
- id: switch 13
|
|
142
142
|
kind: mcp
|
|
143
143
|
mcp_id: mcp2
|
|
144
144
|
pin: 12
|
|
145
|
-
|
|
145
|
+
output_type: switch
|
|
146
146
|
- id: switch 14
|
|
147
147
|
kind: mcp
|
|
148
148
|
mcp_id: mcp2
|
|
149
149
|
pin: 13
|
|
150
|
-
|
|
150
|
+
output_type: switch
|
|
151
151
|
- id: switch 15
|
|
152
152
|
kind: mcp
|
|
153
153
|
mcp_id: mcp2
|
|
154
154
|
pin: 14
|
|
155
|
-
|
|
155
|
+
output_type: switch
|
|
156
156
|
- id: switch 16
|
|
157
157
|
kind: mcp
|
|
158
158
|
mcp_id: mcp2
|
|
159
159
|
pin: 15
|
|
160
|
-
|
|
160
|
+
output_type: switch
|
|
@@ -20,8 +20,10 @@ from boneio.helper.yaml import (
|
|
|
20
20
|
)
|
|
21
21
|
from boneio.helper.state_manager import StateManager
|
|
22
22
|
from boneio.helper.ha_discovery import (
|
|
23
|
-
|
|
23
|
+
ha_light_availabilty_message,
|
|
24
|
+
ha_switch_availabilty_message,
|
|
24
25
|
ha_sensor_temp_availabilty_message,
|
|
26
|
+
ha_button_availabilty_message,
|
|
25
27
|
ha_binary_sensor_availabilty_message,
|
|
26
28
|
ha_input_availabilty_message,
|
|
27
29
|
ha_sensor_availabilty_message,
|
|
@@ -42,11 +44,13 @@ __all__ = [
|
|
|
42
44
|
"read_input",
|
|
43
45
|
"write_output",
|
|
44
46
|
"make_font",
|
|
45
|
-
"
|
|
47
|
+
"ha_light_availabilty_message",
|
|
48
|
+
"ha_switch_availabilty_message",
|
|
46
49
|
"ha_sensor_availabilty_message",
|
|
47
50
|
"ha_adc_sensor_availabilty_message",
|
|
48
51
|
"ha_sensor_temp_availabilty_message",
|
|
49
52
|
"ha_binary_sensor_availabilty_message",
|
|
53
|
+
"ha_button_availabilty_message",
|
|
50
54
|
"ha_input_availabilty_message",
|
|
51
55
|
"GPIOInputException",
|
|
52
56
|
"I2CError",
|
|
@@ -72,6 +72,7 @@ class GpioBaseClass:
|
|
|
72
72
|
"""Setup GPIO Input Button"""
|
|
73
73
|
self._pin = pin
|
|
74
74
|
gpio = kwargs.get("rest_pin", {GPIO_MODE: GPIO_STR})
|
|
75
|
+
self._bounce_time = gpio.get("bounce_time", 25)
|
|
75
76
|
configure_pin(pin=pin, mode=gpio.get(GPIO_MODE, GPIO_STR))
|
|
76
77
|
self._loop = asyncio.get_running_loop()
|
|
77
78
|
self._press_callback = press_callback
|
|
@@ -19,29 +19,13 @@ from boneio.const import (
|
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def ha_relay_availabilty_message(id: str, name: str, topic: str = "boneIO"):
|
|
23
|
-
"""Create availability topic for HA."""
|
|
24
|
-
return {
|
|
25
|
-
"availability": [{"topic": f"{topic}/{STATE}"}],
|
|
26
|
-
"command_topic": f"{topic}/cmd/relay/{id}/set",
|
|
27
|
-
"device": {
|
|
28
|
-
"identifiers": [topic],
|
|
29
|
-
"manufacturer": "boneIO",
|
|
30
|
-
"model": "boneIO Relay Board",
|
|
31
|
-
"name": f"boneIO {topic}",
|
|
32
|
-
"sw_version": __version__,
|
|
33
|
-
},
|
|
34
|
-
"name": name,
|
|
35
|
-
"payload_off": OFF,
|
|
36
|
-
"payload_on": ON,
|
|
37
|
-
"state_topic": f"{topic}/{RELAY}/{id}",
|
|
38
|
-
"unique_id": f"{topic}{RELAY}{id}",
|
|
39
|
-
"value_template": "{{ value_json.state }}",
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
22
|
def ha_availabilty_message(
|
|
44
|
-
id: str,
|
|
23
|
+
id: str,
|
|
24
|
+
name: str,
|
|
25
|
+
topic: str = "boneIO",
|
|
26
|
+
device_type: str = INPUT,
|
|
27
|
+
model: str = "boneIO Relay Board",
|
|
28
|
+
**kwargs,
|
|
45
29
|
):
|
|
46
30
|
"""Create availability topic for HA."""
|
|
47
31
|
return {
|
|
@@ -49,23 +33,53 @@ def ha_availabilty_message(
|
|
|
49
33
|
"device": {
|
|
50
34
|
"identifiers": [topic],
|
|
51
35
|
"manufacturer": "boneIO",
|
|
52
|
-
"model":
|
|
36
|
+
"model": model,
|
|
53
37
|
"name": f"boneIO {topic}",
|
|
54
38
|
"sw_version": __version__,
|
|
55
39
|
},
|
|
56
|
-
"icon": "mdi:gesture-double-tap",
|
|
57
40
|
"name": name,
|
|
58
|
-
"state_topic": f"{topic}/{
|
|
59
|
-
"unique_id": f"{topic}{
|
|
41
|
+
"state_topic": f"{topic}/{device_type}/{id}",
|
|
42
|
+
"unique_id": f"{topic}{device_type}{id}",
|
|
43
|
+
**kwargs,
|
|
60
44
|
}
|
|
61
45
|
|
|
62
46
|
|
|
47
|
+
def ha_light_availabilty_message(id: str, topic: str = "boneIO", **kwargs):
|
|
48
|
+
"""Create LIGHT availability topic for HA."""
|
|
49
|
+
msg = ha_availabilty_message(device_type=RELAY, topic=topic, id=id, **kwargs)
|
|
50
|
+
msg["command_topic"] = f"{topic}/cmd/relay/{id}/set"
|
|
51
|
+
msg["payload_off"] = OFF
|
|
52
|
+
msg["payload_on"] = ON
|
|
53
|
+
msg["state_value_template"] = "{{ value_json.state }}"
|
|
54
|
+
return msg
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def ha_button_availabilty_message(id: str, topic: str = "boneIO", **kwargs):
|
|
58
|
+
"""Create BUTTON availability topic for HA."""
|
|
59
|
+
msg = ha_availabilty_message(device_type="button", topic=topic, id=id, **kwargs)
|
|
60
|
+
msg["command_topic"] = f"{topic}/cmd/button/{id}/set"
|
|
61
|
+
msg["payload_press"] = "reload"
|
|
62
|
+
return msg
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def ha_switch_availabilty_message(id: str, topic: str = "boneIO", **kwargs):
|
|
66
|
+
"""Create SWITCH availability topic for HA."""
|
|
67
|
+
msg = ha_availabilty_message(device_type=RELAY, topic=topic, id=id, **kwargs)
|
|
68
|
+
msg["command_topic"] = f"{topic}/cmd/relay/{id}/set"
|
|
69
|
+
msg["payload_off"] = OFF
|
|
70
|
+
msg["payload_on"] = ON
|
|
71
|
+
msg["value_template"] = "{{ value_json.state }}"
|
|
72
|
+
return msg
|
|
73
|
+
|
|
74
|
+
|
|
63
75
|
def ha_input_availabilty_message(**kwargs):
|
|
64
|
-
|
|
76
|
+
msg = ha_availabilty_message(device_type=INPUT, **kwargs)
|
|
77
|
+
msg["icon"] = "mdi:gesture-double-tap"
|
|
78
|
+
return msg
|
|
65
79
|
|
|
66
80
|
|
|
67
81
|
def ha_adc_sensor_availabilty_message(**kwargs):
|
|
68
|
-
msg = ha_availabilty_message(
|
|
82
|
+
msg = ha_availabilty_message(device_type=SENSOR, **kwargs)
|
|
69
83
|
msg["unit_of_measurement"] = "V"
|
|
70
84
|
msg["device_class"] = "voltage"
|
|
71
85
|
msg["state_class"] = "measurement"
|
|
@@ -73,7 +87,7 @@ def ha_adc_sensor_availabilty_message(**kwargs):
|
|
|
73
87
|
|
|
74
88
|
|
|
75
89
|
def ha_sensor_availabilty_message(unit_of_measurement: str = None, **kwargs):
|
|
76
|
-
msg = ha_availabilty_message(
|
|
90
|
+
msg = ha_availabilty_message(device_type=SENSOR, **kwargs)
|
|
77
91
|
if not unit_of_measurement:
|
|
78
92
|
return msg
|
|
79
93
|
|
|
@@ -125,7 +139,7 @@ def modbus_sensor_availabilty_message(
|
|
|
125
139
|
state_topic_base: str,
|
|
126
140
|
topic: str,
|
|
127
141
|
model: str,
|
|
128
|
-
|
|
142
|
+
device_type: str = SENSOR,
|
|
129
143
|
**kwargs,
|
|
130
144
|
):
|
|
131
145
|
"""Create Modbus Sensor availability topic for HA."""
|
|
@@ -139,7 +153,7 @@ def modbus_sensor_availabilty_message(
|
|
|
139
153
|
"sw_version": __version__,
|
|
140
154
|
},
|
|
141
155
|
"name": sensor_id,
|
|
142
|
-
"state_topic": f"{topic}/{
|
|
156
|
+
"state_topic": f"{topic}/{device_type}/{id}/{state_topic_base}",
|
|
143
157
|
"unique_id": f"{topic}{sensor_id.replace('_', '').lower()}",
|
|
144
158
|
**kwargs,
|
|
145
159
|
}
|
|
@@ -150,18 +164,13 @@ def ha_cover_availabilty_message(
|
|
|
150
164
|
):
|
|
151
165
|
"""Create Cover availability topic for HA."""
|
|
152
166
|
kwargs = {"device_class": device_class} if device_class else {}
|
|
167
|
+
msg = ha_availabilty_message(
|
|
168
|
+
device_type=COVER, topic=topic, id=id, name=name, **kwargs
|
|
169
|
+
)
|
|
170
|
+
|
|
153
171
|
return {
|
|
154
|
-
"availability": [{"topic": f"{topic}/{STATE}"}],
|
|
155
172
|
"command_topic": f"{topic}/cmd/cover/{id}/set",
|
|
156
173
|
"set_position_topic": f"{topic}/cmd/cover/{id}/pos",
|
|
157
|
-
"device": {
|
|
158
|
-
"identifiers": [topic],
|
|
159
|
-
"manufacturer": "boneIO",
|
|
160
|
-
"model": "boneIO Cover Board",
|
|
161
|
-
"name": f"boneIO {topic}",
|
|
162
|
-
"sw_version": __version__,
|
|
163
|
-
},
|
|
164
|
-
"name": name,
|
|
165
174
|
"payload_open": OPEN,
|
|
166
175
|
"payload_close": CLOSE,
|
|
167
176
|
"payload_stop": STOP,
|
|
@@ -171,6 +180,5 @@ def ha_cover_availabilty_message(
|
|
|
171
180
|
"state_closing": CLOSING,
|
|
172
181
|
"state_topic": f"{topic}/{COVER}/{id}/state",
|
|
173
182
|
"position_topic": f"{topic}/{COVER}/{id}/pos",
|
|
174
|
-
|
|
175
|
-
**kwargs,
|
|
183
|
+
**msg,
|
|
176
184
|
}
|
|
@@ -1,34 +1,8 @@
|
|
|
1
|
-
"""Runner code for boneIO. Based on HA runner."""
|
|
2
|
-
import asyncio
|
|
3
1
|
import logging
|
|
4
|
-
|
|
5
|
-
from boneio.const import (
|
|
6
|
-
ADC,
|
|
7
|
-
COVER,
|
|
8
|
-
ENABLED,
|
|
9
|
-
HA_DISCOVERY,
|
|
10
|
-
HOST,
|
|
11
|
-
INPUT,
|
|
12
|
-
LM75,
|
|
13
|
-
MCP23017,
|
|
14
|
-
MCP_TEMP_9808,
|
|
15
|
-
MODBUS,
|
|
16
|
-
MQTT,
|
|
17
|
-
OLED,
|
|
18
|
-
OUTPUT,
|
|
19
|
-
PASSWORD,
|
|
20
|
-
TOPIC_PREFIX,
|
|
21
|
-
USERNAME,
|
|
22
|
-
PAHO,
|
|
23
|
-
PYMODBUS,
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
_LOGGER = logging.getLogger(__name__)
|
|
27
|
-
from boneio.helper import StateManager
|
|
28
|
-
from boneio.manager import Manager
|
|
29
|
-
from boneio.mqtt_client import MQTTClient
|
|
2
|
+
from boneio.const import PAHO, PYMODBUS
|
|
30
3
|
from boneio.version import __version__
|
|
31
4
|
|
|
5
|
+
_LOGGER = logging.getLogger(__name__)
|
|
32
6
|
_nameToLevel = {
|
|
33
7
|
"CRITICAL": logging.CRITICAL,
|
|
34
8
|
"FATAL": logging.FATAL,
|
|
@@ -66,6 +40,8 @@ def configure_logger(log_config: dict, debug: int) -> None:
|
|
|
66
40
|
if default in _nameToLevel:
|
|
67
41
|
_LOGGER.info("Setting default log level to %s", default)
|
|
68
42
|
logging.getLogger().setLevel(_nameToLevel[default])
|
|
43
|
+
if debug == 0:
|
|
44
|
+
debug = -1
|
|
69
45
|
for k, v in log_config.get("logs", {}).items():
|
|
70
46
|
logger = logging.getLogger(k)
|
|
71
47
|
val = v.upper()
|
|
@@ -73,43 +49,3 @@ def configure_logger(log_config: dict, debug: int) -> None:
|
|
|
73
49
|
_LOGGER.info("Setting %s log level to %s", k, val)
|
|
74
50
|
logger.setLevel(_nameToLevel[val])
|
|
75
51
|
debug_logger()
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
async def async_run(
|
|
79
|
-
config: dict,
|
|
80
|
-
config_path: str,
|
|
81
|
-
mqttusername: str = "",
|
|
82
|
-
mqttpassword: str = "",
|
|
83
|
-
):
|
|
84
|
-
"""Run BoneIO."""
|
|
85
|
-
|
|
86
|
-
client = MQTTClient(
|
|
87
|
-
host=config[MQTT][HOST],
|
|
88
|
-
username=config[MQTT].get(USERNAME, mqttusername),
|
|
89
|
-
password=config[MQTT].get(PASSWORD, mqttpassword),
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
manager = Manager(
|
|
93
|
-
send_message=client.send_message,
|
|
94
|
-
topic_prefix=config[MQTT][TOPIC_PREFIX],
|
|
95
|
-
relay_pins=config.get(OUTPUT, []),
|
|
96
|
-
input_pins=config.get(INPUT, []),
|
|
97
|
-
state_manager=StateManager(state_file=f"{config_path[0]}state.json"),
|
|
98
|
-
ha_discovery=config[MQTT][HA_DISCOVERY][ENABLED],
|
|
99
|
-
ha_discovery_prefix=config[MQTT][HA_DISCOVERY][TOPIC_PREFIX],
|
|
100
|
-
sensors={
|
|
101
|
-
LM75: config.get(LM75),
|
|
102
|
-
MCP_TEMP_9808: config.get(MCP_TEMP_9808),
|
|
103
|
-
MODBUS: config.get("modbus_sensors"),
|
|
104
|
-
},
|
|
105
|
-
mcp23017=config.get(MCP23017, []),
|
|
106
|
-
modbus=config.get(MODBUS),
|
|
107
|
-
oled=config.get(OLED),
|
|
108
|
-
adc_list=config.get(ADC, []),
|
|
109
|
-
covers=config.get(COVER, []),
|
|
110
|
-
)
|
|
111
|
-
tasks = set()
|
|
112
|
-
tasks.update(manager.get_tasks())
|
|
113
|
-
_LOGGER.info("Connecting to MQTT.")
|
|
114
|
-
tasks.add(client.start_client(manager))
|
|
115
|
-
return await asyncio.gather(*tasks)
|
|
@@ -23,7 +23,7 @@ class GpioInputButton(GpioBaseClass):
|
|
|
23
23
|
def __init__(self, **kwargs) -> None:
|
|
24
24
|
"""Setup GPIO Input Button"""
|
|
25
25
|
super().__init__(**kwargs)
|
|
26
|
-
edge_detect(self._pin, callback=self._handle_press, bounce=
|
|
26
|
+
edge_detect(self._pin, callback=self._handle_press, bounce=self._bounce_time)
|
|
27
27
|
self._first_press_timestamp = None
|
|
28
28
|
self._is_long_press = False
|
|
29
29
|
self._second_press_timestamp = None
|
|
@@ -8,6 +8,7 @@ from busio import I2C
|
|
|
8
8
|
from boneio.const import (
|
|
9
9
|
ACTION,
|
|
10
10
|
BONEIO,
|
|
11
|
+
BUTTON,
|
|
11
12
|
CLOSE,
|
|
12
13
|
COVER,
|
|
13
14
|
HOMEASSISTANT,
|
|
@@ -38,7 +39,9 @@ from boneio.helper import (
|
|
|
38
39
|
HostData,
|
|
39
40
|
I2CError,
|
|
40
41
|
StateManager,
|
|
41
|
-
|
|
42
|
+
ha_switch_availabilty_message,
|
|
43
|
+
ha_light_availabilty_message,
|
|
44
|
+
ha_button_availabilty_message,
|
|
42
45
|
host_stats,
|
|
43
46
|
)
|
|
44
47
|
from boneio.helper.events import EventBus
|
|
@@ -49,7 +52,9 @@ from boneio.helper.loader import (
|
|
|
49
52
|
create_mcp23017,
|
|
50
53
|
create_temp_sensor,
|
|
51
54
|
)
|
|
55
|
+
from boneio.helper.yaml import load_config_from_file
|
|
52
56
|
from boneio.modbus import Modbus
|
|
57
|
+
from boneio.helper.logger import configure_logger
|
|
53
58
|
|
|
54
59
|
_LOGGER = logging.getLogger(__name__)
|
|
55
60
|
|
|
@@ -61,6 +66,7 @@ class Manager:
|
|
|
61
66
|
self,
|
|
62
67
|
send_message: Callable[[str, Union[str, dict], bool], None],
|
|
63
68
|
state_manager: StateManager,
|
|
69
|
+
config_file_path: str,
|
|
64
70
|
relay_pins: List = [],
|
|
65
71
|
input_pins: List = [],
|
|
66
72
|
sensors: dict = {},
|
|
@@ -78,6 +84,7 @@ class Manager:
|
|
|
78
84
|
self._loop = asyncio.get_event_loop()
|
|
79
85
|
self._host_data = None
|
|
80
86
|
self._ha_discovery = ha_discovery
|
|
87
|
+
self._config_file_path = config_file_path
|
|
81
88
|
self._state_manager = state_manager
|
|
82
89
|
self._event_bus = EventBus(self._loop)
|
|
83
90
|
|
|
@@ -154,7 +161,9 @@ class Manager:
|
|
|
154
161
|
name=out.name,
|
|
155
162
|
ha_type=out.output_type,
|
|
156
163
|
ha_discovery_prefix=ha_discovery_prefix,
|
|
157
|
-
availability_msg_func=
|
|
164
|
+
availability_msg_func=ha_light_availabilty_message
|
|
165
|
+
if out.is_light
|
|
166
|
+
else ha_switch_availabilty_message,
|
|
158
167
|
)
|
|
159
168
|
self._loop.call_soon_threadsafe(
|
|
160
169
|
self._loop.call_later,
|
|
@@ -224,13 +233,14 @@ class Manager:
|
|
|
224
233
|
)
|
|
225
234
|
except (GPIOInputException, I2CError) as err:
|
|
226
235
|
_LOGGER.error("Can't configure OLED display. %s", err)
|
|
227
|
-
|
|
236
|
+
self.prepare_button(ha_discovery_prefix=ha_discovery_prefix)
|
|
228
237
|
self.send_message(topic=f"{topic_prefix}/{STATE}", payload=ONLINE)
|
|
229
238
|
_LOGGER.info("BoneIO manager is ready.")
|
|
230
239
|
|
|
231
240
|
def _relay_callback(
|
|
232
241
|
self, relay_type: str, relay_id: str, restore_state: bool
|
|
233
242
|
) -> None:
|
|
243
|
+
"""Relay callback function."""
|
|
234
244
|
if restore_state:
|
|
235
245
|
self._state_manager.save_attribute(
|
|
236
246
|
attr_type=RELAY,
|
|
@@ -239,18 +249,38 @@ class Manager:
|
|
|
239
249
|
)
|
|
240
250
|
self._host_data_callback(type=relay_type)
|
|
241
251
|
|
|
252
|
+
def _logger_reload(self) -> None:
|
|
253
|
+
"""_Logger reload function."""
|
|
254
|
+
_config = load_config_from_file(config_file=self._config_file_path)
|
|
255
|
+
if not _config:
|
|
256
|
+
return
|
|
257
|
+
configure_logger(log_config=_config.get("logger"), debug=-1)
|
|
258
|
+
|
|
242
259
|
def _host_data_callback(self, type: str) -> None:
|
|
243
260
|
if self._oled:
|
|
244
261
|
self._oled.handle_data_update(type)
|
|
245
262
|
|
|
246
263
|
def get_tasks(self) -> Set[asyncio.Task]:
|
|
264
|
+
"""Retrieve asyncio tasks to run."""
|
|
247
265
|
return self._tasks
|
|
248
266
|
|
|
249
267
|
def append_task(self, task: asyncio.Task) -> None:
|
|
268
|
+
"""Add task to run with asyncio loop."""
|
|
250
269
|
self._tasks.append(task)
|
|
251
270
|
|
|
271
|
+
def prepare_button(self, ha_discovery_prefix: str) -> None:
|
|
272
|
+
"""Prepare buttons for reload."""
|
|
273
|
+
self.send_ha_autodiscovery(
|
|
274
|
+
id="Logger",
|
|
275
|
+
name="Logger",
|
|
276
|
+
ha_type=BUTTON,
|
|
277
|
+
ha_discovery_prefix=ha_discovery_prefix,
|
|
278
|
+
availability_msg_func=ha_button_availabilty_message,
|
|
279
|
+
)
|
|
280
|
+
|
|
252
281
|
@property
|
|
253
282
|
def mcp(self):
|
|
283
|
+
"""Get MCP by it's id."""
|
|
254
284
|
return self._mcp
|
|
255
285
|
|
|
256
286
|
def press_callback(
|
|
@@ -348,6 +378,11 @@ class Manager:
|
|
|
348
378
|
_LOGGER.warn(
|
|
349
379
|
"Positon cannot be set. Not number between 0-100. %s", message
|
|
350
380
|
)
|
|
381
|
+
elif msg_type == BUTTON:
|
|
382
|
+
if device_id == "logger" and command == "set":
|
|
383
|
+
if message == "reload":
|
|
384
|
+
_LOGGER.info("Reloading logger configuration.")
|
|
385
|
+
self._logger_reload()
|
|
351
386
|
|
|
352
387
|
@property
|
|
353
388
|
def output(self) -> dict:
|
|
@@ -47,13 +47,12 @@ class Oled:
|
|
|
47
47
|
self._output_groups = output_groups
|
|
48
48
|
self._current_screen = next(self._screen_order)
|
|
49
49
|
self._host_data = host_data
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
self._sleep_timeout = sleep_timeout
|
|
50
|
+
self._sleep = False
|
|
51
|
+
self._sleep_handle = None
|
|
52
|
+
self._sleep_timeout = sleep_timeout
|
|
54
53
|
configure_pin(OLED_PIN)
|
|
55
54
|
setup_input(OLED_PIN)
|
|
56
|
-
edge_detect(pin=OLED_PIN, callback=self._handle_press, bounce=
|
|
55
|
+
edge_detect(pin=OLED_PIN, callback=self._handle_press, bounce=120)
|
|
57
56
|
try:
|
|
58
57
|
serial = i2c(port=2, address=0x3C)
|
|
59
58
|
self._device = sh1106(serial)
|
|
@@ -4,7 +4,7 @@ import asyncio
|
|
|
4
4
|
import logging
|
|
5
5
|
from typing import Callable
|
|
6
6
|
|
|
7
|
-
from boneio.const import OFF, ON, RELAY, STATE, SWITCH, NONE
|
|
7
|
+
from boneio.const import LIGHT, OFF, ON, RELAY, STATE, SWITCH, NONE
|
|
8
8
|
from boneio.helper import BasicMqtt
|
|
9
9
|
|
|
10
10
|
_LOGGER = logging.getLogger(__name__)
|
|
@@ -38,6 +38,11 @@ class BasicRelay(BasicMqtt):
|
|
|
38
38
|
"""HA type."""
|
|
39
39
|
return self._output_type
|
|
40
40
|
|
|
41
|
+
@property
|
|
42
|
+
def is_light(self) -> bool:
|
|
43
|
+
"""Check if HA type is light"""
|
|
44
|
+
return self._output_type == LIGHT
|
|
45
|
+
|
|
41
46
|
@property
|
|
42
47
|
def id(self) -> bool:
|
|
43
48
|
"""Id of the relay.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Runner code for boneIO. Based on HA runner."""
|
|
2
|
+
import asyncio
|
|
3
|
+
import logging
|
|
4
|
+
import os
|
|
5
|
+
from boneio.const import (
|
|
6
|
+
ADC,
|
|
7
|
+
COVER,
|
|
8
|
+
ENABLED,
|
|
9
|
+
HA_DISCOVERY,
|
|
10
|
+
HOST,
|
|
11
|
+
INPUT,
|
|
12
|
+
LM75,
|
|
13
|
+
MCP23017,
|
|
14
|
+
MCP_TEMP_9808,
|
|
15
|
+
MODBUS,
|
|
16
|
+
MQTT,
|
|
17
|
+
OLED,
|
|
18
|
+
OUTPUT,
|
|
19
|
+
PASSWORD,
|
|
20
|
+
TOPIC_PREFIX,
|
|
21
|
+
USERNAME,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
_LOGGER = logging.getLogger(__name__)
|
|
25
|
+
from boneio.helper import StateManager
|
|
26
|
+
from boneio.manager import Manager
|
|
27
|
+
from boneio.mqtt_client import MQTTClient
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
async def async_run(
|
|
31
|
+
config: dict,
|
|
32
|
+
config_file: str,
|
|
33
|
+
mqttusername: str = "",
|
|
34
|
+
mqttpassword: str = "",
|
|
35
|
+
):
|
|
36
|
+
"""Run BoneIO."""
|
|
37
|
+
|
|
38
|
+
client = MQTTClient(
|
|
39
|
+
host=config[MQTT][HOST],
|
|
40
|
+
username=config[MQTT].get(USERNAME, mqttusername),
|
|
41
|
+
password=config[MQTT].get(PASSWORD, mqttpassword),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
manager = Manager(
|
|
45
|
+
send_message=client.send_message,
|
|
46
|
+
topic_prefix=config[MQTT][TOPIC_PREFIX],
|
|
47
|
+
relay_pins=config.get(OUTPUT, []),
|
|
48
|
+
input_pins=config.get(INPUT, []),
|
|
49
|
+
config_file_path=config_file,
|
|
50
|
+
state_manager=StateManager(
|
|
51
|
+
state_file=f"{os.path.split(config_file)[0]}state.json"
|
|
52
|
+
),
|
|
53
|
+
ha_discovery=config[MQTT][HA_DISCOVERY][ENABLED],
|
|
54
|
+
ha_discovery_prefix=config[MQTT][HA_DISCOVERY][TOPIC_PREFIX],
|
|
55
|
+
sensors={
|
|
56
|
+
LM75: config.get(LM75),
|
|
57
|
+
MCP_TEMP_9808: config.get(MCP_TEMP_9808),
|
|
58
|
+
MODBUS: config.get("modbus_sensors"),
|
|
59
|
+
},
|
|
60
|
+
mcp23017=config.get(MCP23017, []),
|
|
61
|
+
modbus=config.get(MODBUS),
|
|
62
|
+
oled=config.get(OLED),
|
|
63
|
+
adc_list=config.get(ADC, []),
|
|
64
|
+
covers=config.get(COVER, []),
|
|
65
|
+
)
|
|
66
|
+
tasks = set()
|
|
67
|
+
tasks.update(manager.get_tasks())
|
|
68
|
+
_LOGGER.info("Connecting to MQTT.")
|
|
69
|
+
tasks.add(client.start_client(manager))
|
|
70
|
+
return await asyncio.gather(*tasks)
|
|
@@ -246,6 +246,12 @@ input:
|
|
|
246
246
|
allowed: ["gpio", "gpio_pu", "gpio_pd", "gpio_input"]
|
|
247
247
|
meta:
|
|
248
248
|
label: What mode to use in config PIN.
|
|
249
|
+
bounce_time:
|
|
250
|
+
type: integer
|
|
251
|
+
required: True
|
|
252
|
+
default: 25
|
|
253
|
+
meta:
|
|
254
|
+
label: Bounce time for GPIO in miliseconds. Only for advanced usage.
|
|
249
255
|
show_in_ha:
|
|
250
256
|
type: boolean
|
|
251
257
|
required: True
|
|
@@ -14,7 +14,9 @@ class GpioInputSensor(GpioBaseClass):
|
|
|
14
14
|
def __init__(self, **kwargs) -> None:
|
|
15
15
|
"""Setup GPIO Input Button"""
|
|
16
16
|
super().__init__(**kwargs)
|
|
17
|
-
edge_detect(
|
|
17
|
+
edge_detect(
|
|
18
|
+
self._pin, callback=self._handle_press, bounce=self._bounce_time, edge=BOTH
|
|
19
|
+
)
|
|
18
20
|
_LOGGER.debug("Configured sensor pin %s", self._pin)
|
|
19
21
|
|
|
20
22
|
def _handle_press(self, pin: str) -> None:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: boneio
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Python App for BoneIO
|
|
5
5
|
Home-page: https://github.com/boneIO-eu/app_bbb
|
|
6
|
+
Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.2.1.zip
|
|
6
7
|
License: GNU General Public License v3.0
|
|
7
|
-
Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.2.0.dev9.zip
|
|
8
8
|
Platform: UNKNOWN
|
|
9
9
|
Classifier: Programming Language :: Python
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.7
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|