boneIO 0.8.0.dev11__tar.gz → 0.8.0.dev12__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.
Files changed (106) hide show
  1. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/PKG-INFO +1 -1
  2. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/const.py +1 -0
  3. boneIO-0.8.0.dev12/boneio/helper/gpiod.py +56 -0
  4. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/loader.py +4 -2
  5. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/mqtt.py +4 -2
  6. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/stats.py +33 -0
  7. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/yaml_util.py +33 -10
  8. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/manager.py +15 -3
  9. boneIO-0.8.0.dev12/boneio/modbus/orno-or-we-517.json +594 -0
  10. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/sensor.py +57 -74
  11. boneIO-0.8.0.dev12/boneio/modbus/single_sensor.py +150 -0
  12. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/oled.py +13 -5
  13. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/relay/basic.py +1 -1
  14. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/schema.yaml +27 -0
  15. boneIO-0.8.0.dev12/boneio/version.py +2 -0
  16. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/pyproject.toml +11 -1
  17. boneIO-0.8.0.dev11/boneio/modbus/orno-or-we-517.json +0 -44
  18. boneIO-0.8.0.dev11/boneio/version.py +0 -2
  19. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/LICENSE +0 -0
  20. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/README.md +0 -0
  21. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/__init__.py +0 -0
  22. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/bonecli.py +0 -0
  23. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/cover.py +0 -0
  24. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/__init__.py +0 -0
  25. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/adc.yaml +0 -0
  26. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/binary_sensor.yaml +0 -0
  27. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/binary_sensor_v_0_7.yaml +0 -0
  28. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/config.yaml +0 -0
  29. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/cover.yaml +0 -0
  30. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/event.yaml +0 -0
  31. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/event_all.yaml +0 -0
  32. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/event_v_0_7.yaml +0 -0
  33. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/led32x4A.yaml +0 -0
  34. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/output24x16A.yaml +0 -0
  35. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/output24x16A_v0.3.yaml +0 -0
  36. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/output32x10A.yaml +0 -0
  37. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/example_config/output32x5A.yaml +0 -0
  38. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/fonts/danube__.ttf +0 -0
  39. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/group/__init__.py +0 -0
  40. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/group/output.py +0 -0
  41. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/__init__.py +0 -0
  42. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/async_updater.py +0 -0
  43. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/click_timer.py +0 -0
  44. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/config.py +0 -0
  45. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/events.py +0 -0
  46. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/exceptions.py +0 -0
  47. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/filter.py +0 -0
  48. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/gpio.py +0 -0
  49. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/ha_discovery.py +0 -0
  50. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/logger.py +0 -0
  51. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/oled.py +0 -0
  52. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/onewire/W1ThermSensor.py +0 -0
  53. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/onewire/__init__.py +0 -0
  54. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/onewire/ds2482.py +0 -0
  55. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/onewire/onewire.py +0 -0
  56. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/pcf8575.py +0 -0
  57. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/queue.py +0 -0
  58. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/sensor/ina_219_smbus.py +0 -0
  59. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/state_manager.py +0 -0
  60. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/timeperiod.py +0 -0
  61. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/helper/util.py +0 -0
  62. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/input/__init__.py +0 -0
  63. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/input/gpio.py +0 -0
  64. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/input/gpio_new.py +0 -0
  65. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/__init__.py +0 -0
  66. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/client.py +0 -0
  67. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/cwt.json +0 -0
  68. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/dts1964_3f.json +0 -0
  69. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/liquid-sensor.json +0 -0
  70. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/modbuscli.py +0 -0
  71. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/pt100.json +0 -0
  72. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/r4dcb08.json +0 -0
  73. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/sdm120.json +0 -0
  74. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/sdm630.json +0 -0
  75. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/sht20.json +0 -0
  76. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/socomec_e03.json +0 -0
  77. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/socomec_e23.json +0 -0
  78. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/sofar.json +0 -0
  79. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/modbus/utils.py +0 -0
  80. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/mqtt_client.py +0 -0
  81. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/relay/__init__.py +0 -0
  82. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/relay/gpio.py +0 -0
  83. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/relay/mcp.py +0 -0
  84. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/relay/pca.py +0 -0
  85. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/relay/pcf.py +0 -0
  86. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/runner.py +0 -0
  87. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/actions.yaml +0 -0
  88. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/actions_sensor.yaml +0 -0
  89. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/actions_switch.yaml +0 -0
  90. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/filters.yaml +0 -0
  91. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/filters_adc.yaml +0 -0
  92. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/id.yaml +0 -0
  93. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/temp_unit.yaml +0 -0
  94. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/schema/update_interval.yaml +0 -0
  95. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/__init__.py +0 -0
  96. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/adc.py +0 -0
  97. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/gpio.py +0 -0
  98. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/gpio_new.py +0 -0
  99. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/ina219.py +0 -0
  100. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/temp/__init__.py +0 -0
  101. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/temp/dallas.py +0 -0
  102. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/temp/lm75.py +0 -0
  103. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/boneio/sensor/temp/mcp9808.py +0 -0
  104. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/tests/32_5_config.yaml +0 -0
  105. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/tests/bandit.yaml +0 -0
  106. {boneIO-0.8.0.dev11 → boneIO-0.8.0.dev12}/tests/relay_32_5.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boneIO
3
- Version: 0.8.0.dev11
3
+ Version: 0.8.0.dev12
4
4
  Summary: Python App for BoneIO
5
5
  License: GNU General Public License v3.0
6
6
  Author-email: Paweł Szafer <pszafer@gmail.com>
@@ -213,3 +213,4 @@ PINS = {
213
213
  "P9_27": {"chip": 3, "line": 19},
214
214
  "P9_25": {"chip": 3, "line": 21},
215
215
  }
216
+ NAME = "name"
@@ -0,0 +1,56 @@
1
+ from __future__ import annotations
2
+ import asyncio
3
+ import logging
4
+ from boneio.const import PINS
5
+ import gpiod
6
+ from gpiod.line import Direction, Bias, Edge, Value
7
+ from gpiod.line_settings import LineSettings
8
+ from datetime import timedelta
9
+ _LOGGER = logging.getLogger(__name__)
10
+
11
+
12
+
13
+ def _get_device(pin: str):
14
+ pin = PINS.get(pin, "P9_22")
15
+ return f"/dev/gpiochip{pin["chip"]}"
16
+
17
+ def _configure_line(device, port, **kwargs):
18
+ return gpiod.request_lines(
19
+ device,
20
+ consumer="gpio",
21
+ config={port: LineSettings(**kwargs)})
22
+
23
+ def setup_input(device, line, pull_mode):
24
+ """Set up a GPIO as input."""
25
+ _LOGGER.debug("Requesting input %s:%s", device, line)
26
+ return _configure_line(
27
+ device,
28
+ line,
29
+ direction=Direction.INPUT,
30
+ bias=(Bias.PULL_UP if pull_mode == "gpio_pu" else Bias.PULL_DOWN))
31
+
32
+ def enable_edge_detect(req, detect_edges, debounce_ms):
33
+ """Add detection for RISING and FALLING events."""
34
+ _LOGGER.debug("Detecting %s edges on %s:%s", detect_edges, req.chip_name, req.lines)
35
+ req.reconfigure_lines(
36
+ {port: LineSettings(edge_detection=getattr(Edge, detect_edges),
37
+ debounce_period=timedelta(milliseconds=debounce_ms))
38
+ for port in req.lines})
39
+
40
+ class GpioD:
41
+
42
+ def __init__(self, pin: str, pull_mode: str = "gpio"):
43
+ self._pin = pin
44
+ self._gpiod_pin = PINS.get(pin, {"chip": 0, "line": 2})
45
+ self._chip = self._gpiod_pin["chip"]
46
+ self._line = self._gpiod_pin["line"]
47
+ self._device = _get_device(self._pin)
48
+ self._line = setup_input(self._device, self._line, pull_mode)
49
+
50
+ def edge_detect(self, callback, bounce=0, edge=Edge.RISING):
51
+ enable_edge_detect(self._line, edge=Edge.BOTH, debounce_ms=bounce)
52
+
53
+
54
+
55
+
56
+
@@ -193,15 +193,16 @@ def create_expander(
193
193
  return grouped_outputs
194
194
 
195
195
 
196
- def create_modbus_sensors(manager: Manager, sensors, **kwargs) -> None:
196
+ def create_modbus_sensors(manager: Manager, sensors, **kwargs) -> dict:
197
197
  """Create Modbus sensor for each device."""
198
198
  from boneio.modbus.sensor import ModbusSensor
199
199
 
200
+ modbus_sensors = {}
200
201
  for sensor in sensors:
201
202
  name = sensor.get(ID)
202
203
  id = name.replace(" ", "")
203
204
  try:
204
- ModbusSensor(
205
+ modbus_sensors[id.lower()] = ModbusSensor(
205
206
  address=sensor[ADDRESS],
206
207
  id=id,
207
208
  name=name,
@@ -221,6 +222,7 @@ def create_modbus_sensors(manager: Manager, sensors, **kwargs) -> None:
221
222
  err,
222
223
  )
223
224
  pass
225
+ return modbus_sensors
224
226
 
225
227
 
226
228
  OutputEntry = namedtuple("OutputEntry", "OutputClass output_kind expander_id")
@@ -1,8 +1,10 @@
1
1
  """Class to help initialize classes which uses mqtt send."""
2
2
 
3
- from typing import Callable, Union
3
+ from __future__ import annotations
4
+
5
+
6
+ from typing import Callable, Union, Optional
4
7
  from boneio.helper.util import strip_accents
5
- from typing import Optional
6
8
 
7
9
 
8
10
  class BasicMqtt:
@@ -161,6 +161,7 @@ class HostData:
161
161
  ina219: INA219Class | None,
162
162
  manager: Manager,
163
163
  enabled_screens: List[str],
164
+ extra_sensors: List[dict],
164
165
  ) -> None:
165
166
  """Initialize HostData."""
166
167
  self._hostname = socket.gethostname()
@@ -244,6 +245,38 @@ class HostData:
244
245
  "f": get_ina_values,
245
246
  "update_interval": TimePeriod(seconds=60),
246
247
  }
248
+ if extra_sensors:
249
+
250
+ def get_extra_sensors_values():
251
+ output = {}
252
+ for sensor in extra_sensors[:3]:
253
+ sensor_type = sensor.get("sensor_type")
254
+ sensor_id = sensor.get("sensor_id")
255
+ if sensor_type == "modbus":
256
+ modbus_id = sensor.get("modbus_id")
257
+ _modbus_sensors = manager.modbus_sensors.get(modbus_id)
258
+ if _modbus_sensors:
259
+ single_sensor = _modbus_sensors.get_sensor_by_name(
260
+ sensor_id
261
+ )
262
+ short_name = "".join(
263
+ [x[:3] for x in single_sensor.name.split()]
264
+ )
265
+ output[short_name] = (
266
+ f"{round(single_sensor.state, 2)} {single_sensor.unit_of_measurement}"
267
+ )
268
+ elif sensor_type == "dallas":
269
+ for single_sensor in manager.temp_sensors:
270
+ if sensor_id == single_sensor.id:
271
+ output[single_sensor.name] = (
272
+ f"{round(single_sensor.state, 2)} C"
273
+ )
274
+ return output
275
+
276
+ host_stats["extra_sensors"] = {
277
+ "f": get_extra_sensors_values,
278
+ "update_interval": TimePeriod(seconds=60),
279
+ }
247
280
  self._data = {}
248
281
  for k, _v in host_stats.items():
249
282
  if k not in enabled_screens:
@@ -41,20 +41,28 @@ class BoneIOLoader(SafeLoader):
41
41
  def construct_secret(self, node):
42
42
  secrets = load_yaml_file(self._rel_path(SECRET_YAML))
43
43
  if node.value not in secrets:
44
- raise MarkedYAMLError(f"Secret '{node.value}' not defined", node.start_mark)
44
+ raise MarkedYAMLError(
45
+ f"Secret '{node.value}' not defined", node.start_mark
46
+ )
45
47
  val = secrets[node.value]
46
48
  _SECRET_VALUES[str(val)] = node.value
47
49
  return val
48
50
 
49
51
  def represent_stringify(self, value):
50
- return self.represent_scalar(tag="tag:yaml.org,2002:str", value=str(value))
52
+ return self.represent_scalar(
53
+ tag="tag:yaml.org,2002:str", value=str(value)
54
+ )
51
55
 
52
56
  def construct_include_dir_list(self, node):
53
- files = filter_yaml_files(_find_files(self._rel_path(node.value), "*.yaml"))
57
+ files = filter_yaml_files(
58
+ _find_files(self._rel_path(node.value), "*.yaml")
59
+ )
54
60
  return [load_yaml_file(f) for f in files]
55
61
 
56
62
  def construct_include_dir_merge_list(self, node):
57
- files = filter_yaml_files(_find_files(self._rel_path(node.value), "*.yaml"))
63
+ files = filter_yaml_files(
64
+ _find_files(self._rel_path(node.value), "*.yaml")
65
+ )
58
66
  merged_list = []
59
67
  for fname in files:
60
68
  loaded_yaml = load_yaml_file(fname)
@@ -63,7 +71,9 @@ class BoneIOLoader(SafeLoader):
63
71
  return merged_list
64
72
 
65
73
  def construct_include_dir_named(self, node):
66
- files = filter_yaml_files(_find_files(self._rel_path(node.value), "*.yaml"))
74
+ files = filter_yaml_files(
75
+ _find_files(self._rel_path(node.value), "*.yaml")
76
+ )
67
77
  mapping = OrderedDict()
68
78
  for fname in files:
69
79
  filename = os.path.splitext(os.path.basename(fname))[0]
@@ -71,7 +81,9 @@ class BoneIOLoader(SafeLoader):
71
81
  return mapping
72
82
 
73
83
  def construct_include_dir_merge_named(self, node):
74
- files = filter_yaml_files(_find_files(self._rel_path(node.value), "*.yaml"))
84
+ files = filter_yaml_files(
85
+ _find_files(self._rel_path(node.value), "*.yaml")
86
+ )
75
87
  mapping = OrderedDict()
76
88
  for fname in files:
77
89
  loaded_yaml = load_yaml_file(fname)
@@ -103,7 +115,9 @@ BoneIOLoader.add_constructor(
103
115
  BoneIOLoader.add_constructor(
104
116
  "!include_dir_merge_named", BoneIOLoader.construct_include_dir_merge_named
105
117
  )
106
- BoneIOLoader.add_constructor("!include_files", BoneIOLoader.construct_include_files)
118
+ BoneIOLoader.add_constructor(
119
+ "!include_files", BoneIOLoader.construct_include_files
120
+ )
107
121
 
108
122
 
109
123
  def filter_yaml_files(files):
@@ -240,6 +254,9 @@ class CustomValidator(Validator):
240
254
  def _normalize_coerce_lower(self, value):
241
255
  return str(value).lower()
242
256
 
257
+ def _normalize_coerce_remove_space(self, value):
258
+ return str(value).replace(" ", "")
259
+
243
260
  def _normalize_coerce_upper(self, value):
244
261
  return str(value).upper()
245
262
 
@@ -273,7 +290,9 @@ class CustomValidator(Validator):
273
290
  if isinstance(value, TimePeriod):
274
291
  value = str(value)
275
292
  if not isinstance(value, str):
276
- raise ConfigurationException("Expected string for time period with unit.")
293
+ raise ConfigurationException(
294
+ "Expected string for time period with unit."
295
+ )
277
296
 
278
297
  unit_to_kwarg = {
279
298
  "us": "microseconds",
@@ -295,12 +314,16 @@ class CustomValidator(Validator):
295
314
 
296
315
  match = re.match(r"^([-+]?[0-9]*\.?[0-9]*)\s*(\w*)$", value)
297
316
  if match is None:
298
- raise ConfigurationException(f"Expected time period with unit, got {value}")
317
+ raise ConfigurationException(
318
+ f"Expected time period with unit, got {value}"
319
+ )
299
320
  kwarg = unit_to_kwarg[one_of(*unit_to_kwarg)(match.group(2))]
300
321
  return TimePeriod(**{kwarg: float(match.group(1))})
301
322
 
302
323
  def _normalize_coerce_check_action_def(self, value):
303
- parent = self.root_document[self.document_path[0]][self.document_path[1]]
324
+ parent = self.root_document[self.document_path[0]][
325
+ self.document_path[1]
326
+ ]
304
327
  _schema = self.schema["actions"]
305
328
  keys = value.keys()
306
329
  out = {}
@@ -140,13 +140,14 @@ class Manager:
140
140
  self._covers = {}
141
141
  self._temp_sensors = []
142
142
  self._ina219_sensors = []
143
+ self._modbus_sensors = {}
143
144
  self._modbus = None
144
145
 
145
146
  self._configure_modbus(modbus=modbus)
146
147
 
147
148
  self._configure_temp_sensors(sensors=sensors)
148
149
 
149
- self._configure_modbus_sensors(sensors=sensors)
150
+ self._modbus_sensors = self._configure_modbus_sensors(sensors=sensors)
150
151
  self._configure_ina219_sensors(sensors=sensors)
151
152
  self._configure_sensors(
152
153
  dallas=dallas, ds2482=ds2482, sensors=sensors.get(ONEWIRE)
@@ -261,6 +262,7 @@ class Manager:
261
262
  from boneio.oled import Oled
262
263
 
263
264
  screens = oled.get("screens", [])
265
+ extra_sensors = oled.get("extra_screen_sensors", [])
264
266
 
265
267
  self._host_data = HostData(
266
268
  manager=self,
@@ -272,6 +274,7 @@ class Manager:
272
274
  ina219=(
273
275
  self._ina219_sensors[0] if self._ina219_sensors else None
274
276
  ),
277
+ extra_sensors=extra_sensors,
275
278
  callback=self._host_data_callback,
276
279
  )
277
280
  try:
@@ -291,6 +294,14 @@ class Manager:
291
294
  def mqtt_state(self) -> bool:
292
295
  return self._mqtt_state()
293
296
 
297
+ @property
298
+ def modbus_sensors(self) -> dict:
299
+ return self._modbus_sensors
300
+
301
+ @property
302
+ def temp_sensors(self) -> list:
303
+ return self._temp_sensors
304
+
294
305
  def _configure_output_group(self):
295
306
  def get_outputs(output_list):
296
307
  outputs = []
@@ -547,17 +558,18 @@ class Manager:
547
558
  if ina219:
548
559
  self._ina219_sensors.append(ina219)
549
560
 
550
- def _configure_modbus_sensors(self, sensors: dict) -> None:
561
+ def _configure_modbus_sensors(self, sensors: dict) -> dict:
551
562
  if sensors.get(MODBUS) and self._modbus:
552
563
  from boneio.helper.loader import create_modbus_sensors
553
564
 
554
- create_modbus_sensors(
565
+ return create_modbus_sensors(
555
566
  manager=self,
556
567
  event_bus=self._event_bus,
557
568
  sensors=sensors.get(MODBUS),
558
569
  modbus=self._modbus,
559
570
  config_helper=self._config_helper,
560
571
  )
572
+ return {}
561
573
 
562
574
  async def reconnect_callback(self) -> None:
563
575
  """Function to invoke when connection to MQTT is (re-)established."""