boneIO 0.8.0.dev7__tar.gz → 0.8.0.dev9__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.8.0.dev7 → boneIO-0.8.0.dev9}/PKG-INFO +1 -1
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/bonecli.py +57 -7
- boneIO-0.8.0.dev9/boneio/example_config/binary_sensor_v_0_7.yaml +11 -0
- boneIO-0.8.0.dev9/boneio/example_config/event_v_0_7.yaml +292 -0
- boneIO-0.8.0.dev9/boneio/example_config/output32x10A.yaml +192 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/filter.py +3 -2
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/loader.py +1 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/client.py +2 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/cwt.json +1 -1
- boneIO-0.8.0.dev9/boneio/modbus/liquid-sensor.json +37 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/modbuscli.py +91 -18
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/r4dcb08.json +7 -1
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/sensor.py +16 -2
- boneIO-0.8.0.dev9/boneio/modbus/sht20.json +37 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/schema.yaml +8 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/ina219.py +3 -3
- boneIO-0.8.0.dev9/boneio/version.py +2 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/pyproject.toml +1 -1
- boneIO-0.8.0.dev7/boneio/version.py +0 -2
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/LICENSE +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/README.md +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/const.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/cover.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/adc.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/binary_sensor.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/config.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/cover.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/event.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/event_all.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/led32x4A.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/output24x16A.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/output24x16A_v0.3.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/example_config/output32x5A.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/fonts/danube__.ttf +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/group/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/group/output.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/async_updater.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/click_timer.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/config.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/events.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/exceptions.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/gpio.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/ha_discovery.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/logger.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/mqtt.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/oled.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/onewire/W1ThermSensor.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/onewire/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/onewire/ds2482.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/onewire/onewire.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/pcf8575.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/queue.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/sensor/ina_219_smbus.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/state_manager.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/stats.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/timeperiod.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/util.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/helper/yaml_util.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/input/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/input/gpio.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/input/gpio_new.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/manager.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/dts1964_3f.json +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/orno-or-we-517.json +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/pt100.json +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/sdm120.json +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/sdm630.json +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/socomec_e23.json +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/sofar.json +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/modbus/utils.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/mqtt_client.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/oled.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/relay/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/relay/basic.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/relay/gpio.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/relay/mcp.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/relay/pca.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/relay/pcf.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/runner.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/actions.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/actions_sensor.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/actions_switch.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/filters.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/filters_adc.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/id.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/temp_unit.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/schema/update_interval.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/adc.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/gpio.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/gpio_new.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/temp/__init__.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/temp/dallas.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/temp/lm75.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/boneio/sensor/temp/mcp9808.py +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/tests/32_5_config.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/tests/bandit.yaml +0 -0
- {boneIO-0.8.0.dev7 → boneIO-0.8.0.dev9}/tests/relay_32_5.py +0 -0
|
@@ -13,7 +13,11 @@ import sys
|
|
|
13
13
|
from colorlog import ColoredFormatter
|
|
14
14
|
from yaml import MarkedYAMLError
|
|
15
15
|
|
|
16
|
-
from boneio.modbus.modbuscli import
|
|
16
|
+
from boneio.modbus.modbuscli import (
|
|
17
|
+
async_run_modbus_set,
|
|
18
|
+
async_run_modbus_get,
|
|
19
|
+
async_run_modbus_search,
|
|
20
|
+
)
|
|
17
21
|
from boneio.modbus.client import VALUE_TYPES
|
|
18
22
|
|
|
19
23
|
|
|
@@ -99,13 +103,14 @@ def get_arguments() -> argparse.Namespace:
|
|
|
99
103
|
modbus_parser.add_argument(
|
|
100
104
|
"--address",
|
|
101
105
|
type=lambda x: int(x, 0),
|
|
102
|
-
required=
|
|
106
|
+
required=False,
|
|
107
|
+
default=1,
|
|
103
108
|
help="Current device address (hex or integer)",
|
|
104
109
|
)
|
|
105
110
|
modbus_parser.add_argument(
|
|
106
111
|
"--baudrate",
|
|
107
112
|
type=int,
|
|
108
|
-
choices=[2400, 4800, 9600, 19200],
|
|
113
|
+
choices=[2400, 4800, 9600, 14400, 19200],
|
|
109
114
|
required=True,
|
|
110
115
|
help="Current baudrate",
|
|
111
116
|
)
|
|
@@ -139,11 +144,21 @@ def get_arguments() -> argparse.Namespace:
|
|
|
139
144
|
dest="modbus_action", required=True
|
|
140
145
|
)
|
|
141
146
|
set_modbus_parser = modbus_sub_parser.add_parser("set")
|
|
147
|
+
set_modbus_parser.add_argument(
|
|
148
|
+
"--custom-value",
|
|
149
|
+
type=int,
|
|
150
|
+
help="Set Custom value",
|
|
151
|
+
)
|
|
152
|
+
set_modbus_parser.add_argument(
|
|
153
|
+
"--custom-register-address",
|
|
154
|
+
type=int,
|
|
155
|
+
help="Register address for custom value",
|
|
156
|
+
)
|
|
142
157
|
set_modbus_parser.add_argument(
|
|
143
158
|
"--device",
|
|
144
159
|
type=str,
|
|
145
|
-
choices=["cwt", "r4dcb08"],
|
|
146
|
-
help="Choose device to set modbus address/baudrate",
|
|
160
|
+
choices=["cwt", "r4dcb08", "liquid-sensor", "sht20", "custom"],
|
|
161
|
+
help="Choose device to set modbus address/baudrate. For custom you must provide --custom-value and --custom-register-address",
|
|
147
162
|
required=True,
|
|
148
163
|
)
|
|
149
164
|
set_modbus_parser_group = set_modbus_parser.add_mutually_exclusive_group()
|
|
@@ -182,6 +197,23 @@ def get_arguments() -> argparse.Namespace:
|
|
|
182
197
|
required=True,
|
|
183
198
|
)
|
|
184
199
|
parser.add_argument("--version", action="version", version=__version__)
|
|
200
|
+
search_modbus_parser = modbus_sub_parser.add_parser(
|
|
201
|
+
name="search",
|
|
202
|
+
help="Search for device. Iterate over every address 1-253 with provided register address",
|
|
203
|
+
)
|
|
204
|
+
search_modbus_parser.add_argument(
|
|
205
|
+
"--register-address",
|
|
206
|
+
type=int,
|
|
207
|
+
help="Register address",
|
|
208
|
+
required=True,
|
|
209
|
+
)
|
|
210
|
+
search_modbus_parser.add_argument(
|
|
211
|
+
"--register-type",
|
|
212
|
+
type=str,
|
|
213
|
+
choices=["input", "holding"],
|
|
214
|
+
help="Register type",
|
|
215
|
+
required=True,
|
|
216
|
+
)
|
|
185
217
|
arguments = parser.parse_args()
|
|
186
218
|
|
|
187
219
|
return arguments
|
|
@@ -223,6 +255,7 @@ def run_modbus_command(
|
|
|
223
255
|
_LOGGER.info("BoneIO %s starting.", __version__)
|
|
224
256
|
try:
|
|
225
257
|
configure_logger(log_config={}, debug=args.debug)
|
|
258
|
+
ret = 0
|
|
226
259
|
if args.modbus_action == "set":
|
|
227
260
|
ret = asyncio.run(
|
|
228
261
|
async_run_modbus_set(
|
|
@@ -235,9 +268,11 @@ def run_modbus_command(
|
|
|
235
268
|
stopbits=args.stopbits,
|
|
236
269
|
new_baudrate=args.new_baudrate,
|
|
237
270
|
new_address=args.new_address,
|
|
271
|
+
custom_address=args.custom_register_address,
|
|
272
|
+
custom_value=args.custom_value,
|
|
238
273
|
),
|
|
239
274
|
)
|
|
240
|
-
|
|
275
|
+
elif args.modbus_action == "get":
|
|
241
276
|
ret = asyncio.run(
|
|
242
277
|
async_run_modbus_get(
|
|
243
278
|
uart=args.uart,
|
|
@@ -251,6 +286,18 @@ def run_modbus_command(
|
|
|
251
286
|
value_type=args.value_type,
|
|
252
287
|
),
|
|
253
288
|
)
|
|
289
|
+
else:
|
|
290
|
+
ret = asyncio.run(
|
|
291
|
+
async_run_modbus_search(
|
|
292
|
+
uart=args.uart,
|
|
293
|
+
baudrate=args.baudrate,
|
|
294
|
+
register_address=args.register_address,
|
|
295
|
+
register_type=args.register_type,
|
|
296
|
+
parity=args.parity,
|
|
297
|
+
bytesize=args.bytesize,
|
|
298
|
+
stopbits=args.stopbits,
|
|
299
|
+
),
|
|
300
|
+
)
|
|
254
301
|
return ret
|
|
255
302
|
except (RestartRequestException, GracefulExit) as err:
|
|
256
303
|
if err is not None:
|
|
@@ -281,7 +328,10 @@ def main() -> int:
|
|
|
281
328
|
args=args,
|
|
282
329
|
)
|
|
283
330
|
|
|
284
|
-
|
|
331
|
+
if exit_code == 0:
|
|
332
|
+
_LOGGER.info("Exiting with exit code %s", exit_code)
|
|
333
|
+
else:
|
|
334
|
+
_LOGGER.error("Exiting with exit code %s", exit_code)
|
|
285
335
|
return exit_code
|
|
286
336
|
|
|
287
337
|
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
- id: IN_01
|
|
2
|
+
pin: P8_37
|
|
3
|
+
gpio_mode: gpio_pu
|
|
4
|
+
detection_type: new
|
|
5
|
+
actions:
|
|
6
|
+
single:
|
|
7
|
+
- action: output
|
|
8
|
+
pin: OUT_01
|
|
9
|
+
- id: IN_02
|
|
10
|
+
pin: P8_38
|
|
11
|
+
gpio_mode: gpio_pu
|
|
12
|
+
actions:
|
|
13
|
+
single:
|
|
14
|
+
- action: output
|
|
15
|
+
pin: OUT_02
|
|
16
|
+
- id: IN_03
|
|
17
|
+
pin: P8_39
|
|
18
|
+
detection_type: new
|
|
19
|
+
actions:
|
|
20
|
+
single:
|
|
21
|
+
- action: output
|
|
22
|
+
pin: OUT_03
|
|
23
|
+
- id: IN_04
|
|
24
|
+
pin: P8_40
|
|
25
|
+
detection_type: new
|
|
26
|
+
actions:
|
|
27
|
+
single:
|
|
28
|
+
- action: output
|
|
29
|
+
pin: OUT_04
|
|
30
|
+
- id: IN_05
|
|
31
|
+
pin: P8_41
|
|
32
|
+
detection_type: new
|
|
33
|
+
actions:
|
|
34
|
+
single:
|
|
35
|
+
- action: output
|
|
36
|
+
pin: OUT_05
|
|
37
|
+
- id: IN_06
|
|
38
|
+
pin: P8_42
|
|
39
|
+
detection_type: new
|
|
40
|
+
actions:
|
|
41
|
+
single:
|
|
42
|
+
- action: output
|
|
43
|
+
pin: OUT_06
|
|
44
|
+
- id: IN_07
|
|
45
|
+
detection_type: new
|
|
46
|
+
pin: P8_43
|
|
47
|
+
actions:
|
|
48
|
+
single:
|
|
49
|
+
- action: output
|
|
50
|
+
pin: OUT_07
|
|
51
|
+
- id: IN_08
|
|
52
|
+
pin: P8_44
|
|
53
|
+
detection_type: new
|
|
54
|
+
actions:
|
|
55
|
+
single:
|
|
56
|
+
- action: output
|
|
57
|
+
pin: OUT_08
|
|
58
|
+
- id: IN_09
|
|
59
|
+
pin: P8_45
|
|
60
|
+
detection_type: new
|
|
61
|
+
gpio_mode: gpio_pu
|
|
62
|
+
actions:
|
|
63
|
+
single:
|
|
64
|
+
- action: output
|
|
65
|
+
pin: OUT_09
|
|
66
|
+
- id: IN_10
|
|
67
|
+
pin: P8_46
|
|
68
|
+
gpio_mode: gpio_pu
|
|
69
|
+
detection_type: new
|
|
70
|
+
actions:
|
|
71
|
+
single:
|
|
72
|
+
- action: output
|
|
73
|
+
pin: OUT_10
|
|
74
|
+
- id: IN_11
|
|
75
|
+
pin: P9_42
|
|
76
|
+
detection_type: new
|
|
77
|
+
actions:
|
|
78
|
+
single:
|
|
79
|
+
- action: output
|
|
80
|
+
pin: OUT_11
|
|
81
|
+
- id: IN_12
|
|
82
|
+
detection_type: new
|
|
83
|
+
pin: P9_31
|
|
84
|
+
actions:
|
|
85
|
+
single:
|
|
86
|
+
- action: output
|
|
87
|
+
pin: OUT_12
|
|
88
|
+
# double:
|
|
89
|
+
# - action: mqtt
|
|
90
|
+
# topic: beagle2/cmd/relay/OUT_12/set
|
|
91
|
+
# action_mqtt_msg: 'toggle'
|
|
92
|
+
- id: IN_13
|
|
93
|
+
detection_type: new
|
|
94
|
+
pin: P9_30
|
|
95
|
+
actions:
|
|
96
|
+
single:
|
|
97
|
+
- action: output
|
|
98
|
+
pin: OUT_13
|
|
99
|
+
# long:
|
|
100
|
+
# - action: mqtt
|
|
101
|
+
# topic: beagle2/cmd/relay/OUT_13/set
|
|
102
|
+
# action_mqtt_msg: 'toggle'
|
|
103
|
+
- id: IN_14
|
|
104
|
+
detection_type: new
|
|
105
|
+
pin: P9_29
|
|
106
|
+
actions:
|
|
107
|
+
single:
|
|
108
|
+
- action: output
|
|
109
|
+
pin: OUT_14
|
|
110
|
+
|
|
111
|
+
- id: IN_15
|
|
112
|
+
detection_type: new
|
|
113
|
+
pin: P9_28
|
|
114
|
+
actions:
|
|
115
|
+
single:
|
|
116
|
+
- action: output
|
|
117
|
+
pin: OUT_15
|
|
118
|
+
- id: IN_16
|
|
119
|
+
detection_type: new
|
|
120
|
+
pin: P9_27
|
|
121
|
+
actions:
|
|
122
|
+
single:
|
|
123
|
+
- action: output
|
|
124
|
+
pin: OUT_16
|
|
125
|
+
- id: IN_17
|
|
126
|
+
detection_type: new
|
|
127
|
+
pin: P9_25
|
|
128
|
+
actions:
|
|
129
|
+
single:
|
|
130
|
+
- action: output
|
|
131
|
+
pin: OUT_17
|
|
132
|
+
- id: IN_18
|
|
133
|
+
detection_type: new
|
|
134
|
+
pin: P9_23
|
|
135
|
+
actions:
|
|
136
|
+
single:
|
|
137
|
+
- action: output
|
|
138
|
+
pin: OUT_18
|
|
139
|
+
- id: IN_19
|
|
140
|
+
detection_type: new
|
|
141
|
+
pin: P9_22
|
|
142
|
+
gpio_mode: gpio_pu
|
|
143
|
+
actions:
|
|
144
|
+
single:
|
|
145
|
+
- action: output
|
|
146
|
+
pin: OUT_19
|
|
147
|
+
- id: IN_20
|
|
148
|
+
detection_type: new
|
|
149
|
+
pin: P9_21
|
|
150
|
+
gpio_mode: gpio_pu
|
|
151
|
+
actions:
|
|
152
|
+
single:
|
|
153
|
+
- action: output
|
|
154
|
+
pin: OUT_20
|
|
155
|
+
- id: IN_21
|
|
156
|
+
detection_type: new
|
|
157
|
+
pin: P9_18
|
|
158
|
+
actions:
|
|
159
|
+
single:
|
|
160
|
+
- action: output
|
|
161
|
+
pin: OUT_21
|
|
162
|
+
- id: IN_22
|
|
163
|
+
detection_type: new
|
|
164
|
+
pin: P9_17
|
|
165
|
+
actions:
|
|
166
|
+
single:
|
|
167
|
+
- action: output
|
|
168
|
+
pin: OUT_22
|
|
169
|
+
- id: IN_23
|
|
170
|
+
detection_type: new
|
|
171
|
+
pin: P9_16
|
|
172
|
+
actions:
|
|
173
|
+
single:
|
|
174
|
+
- action: output
|
|
175
|
+
pin: OUT_23
|
|
176
|
+
- id: IN_24
|
|
177
|
+
detection_type: new
|
|
178
|
+
pin: P9_15
|
|
179
|
+
actions:
|
|
180
|
+
single:
|
|
181
|
+
- action: output
|
|
182
|
+
pin: OUT_24
|
|
183
|
+
- id: IN_25
|
|
184
|
+
detection_type: new
|
|
185
|
+
pin: P9_14
|
|
186
|
+
actions:
|
|
187
|
+
single:
|
|
188
|
+
- action: output
|
|
189
|
+
pin: OUT_25
|
|
190
|
+
|
|
191
|
+
#- id: IN_26_binary_sensor!
|
|
192
|
+
# detection_type: new
|
|
193
|
+
# pin: P8_07
|
|
194
|
+
|
|
195
|
+
- id: IN_27
|
|
196
|
+
detection_type: new
|
|
197
|
+
pin: P8_8
|
|
198
|
+
actions:
|
|
199
|
+
single:
|
|
200
|
+
- action: output
|
|
201
|
+
pin: OUT_27
|
|
202
|
+
- id: IN_28
|
|
203
|
+
detection_type: new
|
|
204
|
+
pin: P8_9
|
|
205
|
+
actions:
|
|
206
|
+
single:
|
|
207
|
+
- action: output
|
|
208
|
+
pin: OUT_28
|
|
209
|
+
- id: IN_29
|
|
210
|
+
detection_type: new
|
|
211
|
+
pin: P8_36
|
|
212
|
+
gpio_mode: gpio_pu
|
|
213
|
+
actions:
|
|
214
|
+
single:
|
|
215
|
+
- action: output
|
|
216
|
+
pin: OUT_29
|
|
217
|
+
- id: IN_30
|
|
218
|
+
detection_type: new
|
|
219
|
+
pin: P8_35
|
|
220
|
+
gpio_mode: gpio_pu
|
|
221
|
+
actions:
|
|
222
|
+
single:
|
|
223
|
+
- action: output
|
|
224
|
+
pin: OUT_30
|
|
225
|
+
- id: IN_31
|
|
226
|
+
detection_type: new
|
|
227
|
+
pin: P8_34
|
|
228
|
+
gpio_mode: gpio_pu
|
|
229
|
+
actions:
|
|
230
|
+
single:
|
|
231
|
+
- action: output
|
|
232
|
+
pin: OUT_31
|
|
233
|
+
- id: IN_32
|
|
234
|
+
detection_type: new
|
|
235
|
+
pin: P8_33
|
|
236
|
+
gpio_mode: gpio_pu
|
|
237
|
+
actions:
|
|
238
|
+
single:
|
|
239
|
+
- action: output
|
|
240
|
+
pin: OUT_32
|
|
241
|
+
- id: IN_33
|
|
242
|
+
detection_type: new
|
|
243
|
+
pin: P8_32
|
|
244
|
+
gpio_mode: gpio_pu
|
|
245
|
+
- id: IN_34
|
|
246
|
+
detection_type: new
|
|
247
|
+
pin: P8_31
|
|
248
|
+
- id: IN_35
|
|
249
|
+
detection_type: new
|
|
250
|
+
pin: P8_30
|
|
251
|
+
- id: IN_36
|
|
252
|
+
detection_type: new
|
|
253
|
+
pin: P8_29
|
|
254
|
+
- id: IN_37
|
|
255
|
+
detection_type: new
|
|
256
|
+
pin: P8_28
|
|
257
|
+
- id: IN_38
|
|
258
|
+
detection_type: new
|
|
259
|
+
pin: P8_27
|
|
260
|
+
- id: IN_39
|
|
261
|
+
detection_type: new
|
|
262
|
+
pin: P8_26
|
|
263
|
+
- id: IN_40
|
|
264
|
+
detection_type: new
|
|
265
|
+
pin: P8_19
|
|
266
|
+
- id: IN_41
|
|
267
|
+
detection_type: new
|
|
268
|
+
pin: P8_18
|
|
269
|
+
- id: IN_42
|
|
270
|
+
detection_type: new
|
|
271
|
+
pin: P8_17
|
|
272
|
+
- id: IN_43
|
|
273
|
+
detection_type: new
|
|
274
|
+
pin: P8_16
|
|
275
|
+
- id: IN_44
|
|
276
|
+
detection_type: new
|
|
277
|
+
pin: P8_15
|
|
278
|
+
- id: IN_45
|
|
279
|
+
detection_type: new
|
|
280
|
+
pin: P8_14
|
|
281
|
+
- id: IN_46
|
|
282
|
+
detection_type: new
|
|
283
|
+
pin: P8_13
|
|
284
|
+
- id: IN_47
|
|
285
|
+
detection_type: new
|
|
286
|
+
pin: P8_12
|
|
287
|
+
- id: IN_48
|
|
288
|
+
detection_type: new
|
|
289
|
+
pin: P8_11
|
|
290
|
+
- id: IN_49
|
|
291
|
+
detection_type: new
|
|
292
|
+
pin: P8_10
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# config to Relay board 32x10 v0.4
|
|
2
|
+
- id: OUT_01
|
|
3
|
+
kind: mcp
|
|
4
|
+
mcp_id: mcp2
|
|
5
|
+
pin: 7
|
|
6
|
+
output_type: light
|
|
7
|
+
|
|
8
|
+
- id: OUT_02
|
|
9
|
+
kind: mcp
|
|
10
|
+
mcp_id: mcp2
|
|
11
|
+
pin: 6
|
|
12
|
+
output_type: light
|
|
13
|
+
|
|
14
|
+
- id: OUT_03
|
|
15
|
+
kind: mcp
|
|
16
|
+
mcp_id: mcp2
|
|
17
|
+
pin: 5
|
|
18
|
+
output_type: light
|
|
19
|
+
|
|
20
|
+
- id: OUT_04
|
|
21
|
+
kind: mcp
|
|
22
|
+
mcp_id: mcp2
|
|
23
|
+
pin: 4
|
|
24
|
+
output_type: light
|
|
25
|
+
|
|
26
|
+
- id: OUT_05
|
|
27
|
+
kind: mcp
|
|
28
|
+
mcp_id: mcp2
|
|
29
|
+
pin: 3
|
|
30
|
+
output_type: light
|
|
31
|
+
|
|
32
|
+
- id: OUT_06
|
|
33
|
+
kind: mcp
|
|
34
|
+
mcp_id: mcp2
|
|
35
|
+
pin: 2
|
|
36
|
+
output_type: light
|
|
37
|
+
|
|
38
|
+
- id: OUT_07
|
|
39
|
+
kind: mcp
|
|
40
|
+
mcp_id: mcp2
|
|
41
|
+
pin: 1
|
|
42
|
+
output_type: light
|
|
43
|
+
|
|
44
|
+
- id: OUT_08
|
|
45
|
+
kind: mcp
|
|
46
|
+
mcp_id: mcp2
|
|
47
|
+
pin: 0
|
|
48
|
+
output_type: light
|
|
49
|
+
|
|
50
|
+
- id: OUT_09
|
|
51
|
+
kind: mcp
|
|
52
|
+
mcp_id: mcp1
|
|
53
|
+
pin: 7
|
|
54
|
+
output_type: light
|
|
55
|
+
|
|
56
|
+
- id: OUT_10
|
|
57
|
+
kind: mcp
|
|
58
|
+
mcp_id: mcp1
|
|
59
|
+
pin: 6
|
|
60
|
+
output_type: light
|
|
61
|
+
|
|
62
|
+
- id: OUT_11
|
|
63
|
+
kind: mcp
|
|
64
|
+
mcp_id: mcp1
|
|
65
|
+
pin: 5
|
|
66
|
+
output_type: light
|
|
67
|
+
|
|
68
|
+
- id: OUT_12
|
|
69
|
+
kind: mcp
|
|
70
|
+
mcp_id: mcp1
|
|
71
|
+
pin: 4
|
|
72
|
+
output_type: light
|
|
73
|
+
|
|
74
|
+
- id: OUT_13
|
|
75
|
+
kind: mcp
|
|
76
|
+
mcp_id: mcp1
|
|
77
|
+
pin: 3
|
|
78
|
+
output_type: light
|
|
79
|
+
|
|
80
|
+
- id: OUT_14
|
|
81
|
+
kind: mcp
|
|
82
|
+
mcp_id: mcp1
|
|
83
|
+
pin: 2
|
|
84
|
+
output_type: light
|
|
85
|
+
|
|
86
|
+
- id: OUT_15
|
|
87
|
+
kind: mcp
|
|
88
|
+
mcp_id: mcp1
|
|
89
|
+
pin: 1
|
|
90
|
+
output_type: light
|
|
91
|
+
|
|
92
|
+
- id: OUT_16
|
|
93
|
+
kind: mcp
|
|
94
|
+
mcp_id: mcp1
|
|
95
|
+
pin: 0
|
|
96
|
+
output_type: light
|
|
97
|
+
|
|
98
|
+
- id: OUT_17
|
|
99
|
+
kind: mcp
|
|
100
|
+
mcp_id: mcp2
|
|
101
|
+
pin: 8
|
|
102
|
+
output_type: light
|
|
103
|
+
|
|
104
|
+
- id: OUT_18
|
|
105
|
+
kind: mcp
|
|
106
|
+
mcp_id: mcp2
|
|
107
|
+
pin: 9
|
|
108
|
+
output_type: light
|
|
109
|
+
|
|
110
|
+
- id: OUT_19
|
|
111
|
+
kind: mcp
|
|
112
|
+
mcp_id: mcp2
|
|
113
|
+
pin: 10
|
|
114
|
+
output_type: light
|
|
115
|
+
|
|
116
|
+
- id: OUT_20
|
|
117
|
+
kind: mcp
|
|
118
|
+
mcp_id: mcp2
|
|
119
|
+
pin: 11
|
|
120
|
+
output_type: light
|
|
121
|
+
|
|
122
|
+
- id: OUT_21
|
|
123
|
+
kind: mcp
|
|
124
|
+
mcp_id: mcp2
|
|
125
|
+
pin: 12
|
|
126
|
+
output_type: light
|
|
127
|
+
|
|
128
|
+
- id: OUT_22
|
|
129
|
+
kind: mcp
|
|
130
|
+
mcp_id: mcp2
|
|
131
|
+
pin: 13
|
|
132
|
+
output_type: light
|
|
133
|
+
|
|
134
|
+
- id: OUT_23
|
|
135
|
+
kind: mcp
|
|
136
|
+
mcp_id: mcp2
|
|
137
|
+
pin: 14
|
|
138
|
+
output_type: light
|
|
139
|
+
|
|
140
|
+
- id: OUT_24
|
|
141
|
+
kind: mcp
|
|
142
|
+
mcp_id: mcp2
|
|
143
|
+
pin: 15
|
|
144
|
+
output_type: light
|
|
145
|
+
|
|
146
|
+
- id: OUT_25
|
|
147
|
+
kind: mcp
|
|
148
|
+
mcp_id: mcp1
|
|
149
|
+
pin: 8
|
|
150
|
+
output_type: light
|
|
151
|
+
|
|
152
|
+
- id: OUT_26
|
|
153
|
+
kind: mcp
|
|
154
|
+
mcp_id: mcp1
|
|
155
|
+
pin: 9
|
|
156
|
+
output_type: light
|
|
157
|
+
|
|
158
|
+
- id: OUT_27
|
|
159
|
+
kind: mcp
|
|
160
|
+
mcp_id: mcp1
|
|
161
|
+
pin: 10
|
|
162
|
+
output_type: light
|
|
163
|
+
|
|
164
|
+
- id: OUT_28
|
|
165
|
+
kind: mcp
|
|
166
|
+
mcp_id: mcp1
|
|
167
|
+
pin: 11
|
|
168
|
+
output_type: light
|
|
169
|
+
|
|
170
|
+
- id: OUT_29
|
|
171
|
+
kind: mcp
|
|
172
|
+
mcp_id: mcp1
|
|
173
|
+
pin: 12
|
|
174
|
+
output_type: light
|
|
175
|
+
|
|
176
|
+
- id: OUT_30
|
|
177
|
+
kind: mcp
|
|
178
|
+
mcp_id: mcp1
|
|
179
|
+
pin: 13
|
|
180
|
+
output_type: light
|
|
181
|
+
|
|
182
|
+
- id: OUT_31
|
|
183
|
+
kind: mcp
|
|
184
|
+
mcp_id: mcp1
|
|
185
|
+
pin: 14
|
|
186
|
+
output_type: light
|
|
187
|
+
|
|
188
|
+
- id: OUT_32
|
|
189
|
+
kind: mcp
|
|
190
|
+
mcp_id: mcp1
|
|
191
|
+
pin: 15
|
|
192
|
+
output_type: light
|
|
@@ -19,8 +19,9 @@ FILTERS = {
|
|
|
19
19
|
class Filter:
|
|
20
20
|
_filters = []
|
|
21
21
|
|
|
22
|
-
def _apply_filters(self, value: float) -> float | None:
|
|
23
|
-
|
|
22
|
+
def _apply_filters(self, value: float, filters: list = []) -> float | None:
|
|
23
|
+
filters = filters if filters else self._filters
|
|
24
|
+
for filter in filters:
|
|
24
25
|
for k, v in filter.items():
|
|
25
26
|
if k not in FILTERS:
|
|
26
27
|
_LOGGER.warning(
|
|
@@ -211,6 +211,7 @@ def create_modbus_sensors(manager: Manager, sensors, **kwargs) -> None:
|
|
|
211
211
|
update_interval=sensor.get(
|
|
212
212
|
UPDATE_INTERVAL, TimePeriod(seconds=60)
|
|
213
213
|
),
|
|
214
|
+
sensors_filters=sensor.get("sensors_filters", {}),
|
|
214
215
|
**kwargs,
|
|
215
216
|
)
|
|
216
217
|
except FileNotFoundError as err:
|
|
@@ -43,6 +43,7 @@ class Modbus:
|
|
|
43
43
|
stopbits: int = 1,
|
|
44
44
|
bytesize: int = 8,
|
|
45
45
|
parity: str = "N",
|
|
46
|
+
timeout: float = 3,
|
|
46
47
|
) -> None:
|
|
47
48
|
"""Initialize the Modbus hub."""
|
|
48
49
|
rx = uart.get(RX)
|
|
@@ -68,6 +69,7 @@ class Modbus:
|
|
|
68
69
|
stopbits=stopbits,
|
|
69
70
|
bytesize=bytesize,
|
|
70
71
|
parity=parity,
|
|
72
|
+
timeout=timeout,
|
|
71
73
|
)
|
|
72
74
|
self._read_methods = {
|
|
73
75
|
"input": self._client.read_input_registers,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"model": "Liquid sensor",
|
|
3
|
+
"set_base": {
|
|
4
|
+
"set_address_address": 0,
|
|
5
|
+
"set_baudrate": {
|
|
6
|
+
"address": 1,
|
|
7
|
+
"possible_baudrates": {
|
|
8
|
+
"1200": 0,
|
|
9
|
+
"2400": 1,
|
|
10
|
+
"4800": 2,
|
|
11
|
+
"9600": 3,
|
|
12
|
+
"19200": 4,
|
|
13
|
+
"38400": 5,
|
|
14
|
+
"57600": 6,
|
|
15
|
+
"115200": 7
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"registers_base": [
|
|
20
|
+
{
|
|
21
|
+
"base": 0,
|
|
22
|
+
"length": 2,
|
|
23
|
+
"register_type": "holding",
|
|
24
|
+
"registers": [
|
|
25
|
+
{
|
|
26
|
+
"name": "Immersion depth",
|
|
27
|
+
"address": 0,
|
|
28
|
+
"unit_of_measurement": "mm",
|
|
29
|
+
"state_class": "measurement",
|
|
30
|
+
"device_class": "humidity",
|
|
31
|
+
"value_type": "S_WORD",
|
|
32
|
+
"filters": [{ "multiply": 0.1 }]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|