boneIO 0.5.0.dev5__tar.gz → 0.5.0.dev7__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.5.0.dev5 → boneIO-0.5.0.dev7}/PKG-INFO +1 -1
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/bonecli.py +3 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/gpio.py +2 -3
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/manager.py +24 -9
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/schema/schema.yaml +6 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/gpio.py +10 -10
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/modbus/__init__.py +7 -2
- boneIO-0.5.0.dev7/boneio/version.py +2 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/pyproject.toml +1 -1
- boneIO-0.5.0.dev5/boneio/version.py +0 -2
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/LICENSE +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/README.md +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/__init__.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/const.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/cover.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/example_config/__init__.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/example_config/adc.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/example_config/config.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/example_config/cover.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/example_config/input.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/example_config/output24x16A.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/example_config/output32x5A.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/fonts/danube__.ttf +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/__init__.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/async_updater.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/config.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/events.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/exceptions.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/filter.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/ha_discovery.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/loader.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/logger.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/mqtt.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/oled.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/onewire/W1ThermSensor.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/onewire/__init__.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/onewire/ds2482.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/onewire/onewire.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/queue.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/state_manager.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/stats.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/timeperiod.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/util.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/helper/yaml_util.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/input/__init__.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/input/gpio.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/modbus.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/mqtt_client.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/oled.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/relay/__init__.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/relay/basic.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/relay/gpio.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/relay/mcp.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/runner.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/schema/actions.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/schema/actions_sensor.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/schema/actions_switch.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/schema/filters.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/schema/filters_adc.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/schema/update_interval.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/__init__.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/adc.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/modbus/sdm120.json +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/modbus/sdm630.json +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/modbus/sofar.json +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/temp/__init__.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/temp/dallas.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/temp/lm75.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/boneio/sensor/temp/mcp9808.py +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/tests/32_5_config.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/tests/bandit.yaml +0 -0
- {boneIO-0.5.0.dev5 → boneIO-0.5.0.dev7}/tests/relay_32_5.py +0 -0
|
@@ -90,9 +90,8 @@ class GpioBaseClass:
|
|
|
90
90
|
) -> None:
|
|
91
91
|
"""Setup GPIO Input Button"""
|
|
92
92
|
self._pin = pin
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
self._bounce_time = gpio.get("bounce_time", TimePeriod(milliseconds=10))
|
|
93
|
+
gpio_mode = kwargs.get(GPIO_MODE, GPIO_STR)
|
|
94
|
+
self._bounce_time = kwargs.get("bounce_time", TimePeriod(milliseconds=10))
|
|
96
95
|
self._loop = asyncio.get_running_loop()
|
|
97
96
|
self._press_callback = press_callback
|
|
98
97
|
setup_input(pin=self._pin, pull_mode=gpio_mode)
|
|
@@ -2,7 +2,6 @@ import asyncio
|
|
|
2
2
|
import logging
|
|
3
3
|
from collections import deque
|
|
4
4
|
from typing import Callable, Coroutine, List, Optional, Set, Union
|
|
5
|
-
|
|
6
5
|
from board import SCL, SDA
|
|
7
6
|
from busio import I2C
|
|
8
7
|
|
|
@@ -60,6 +59,8 @@ from boneio.helper.logger import configure_logger
|
|
|
60
59
|
from boneio.helper.yaml_util import load_config_from_file
|
|
61
60
|
from boneio.modbus import Modbus
|
|
62
61
|
|
|
62
|
+
from w1thermsensor.errors import KernelModuleLoadError
|
|
63
|
+
|
|
63
64
|
_LOGGER = logging.getLogger(__name__)
|
|
64
65
|
|
|
65
66
|
|
|
@@ -253,6 +254,7 @@ class Manager:
|
|
|
253
254
|
from boneio.helper.loader import (
|
|
254
255
|
configure_ds2482,
|
|
255
256
|
)
|
|
257
|
+
from boneio.sensor import DallasSensorDS2482
|
|
256
258
|
|
|
257
259
|
_ds_onewire_bus[_single_ds[ID]] = configure_ds2482(
|
|
258
260
|
i2cbusio=self._i2cbusio, address=_single_ds[ADDRESS]
|
|
@@ -268,22 +270,35 @@ class Manager:
|
|
|
268
270
|
_LOGGER.debug("Preparing Dallas bus.")
|
|
269
271
|
from boneio.helper.loader import configure_dallas
|
|
270
272
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
try:
|
|
274
|
+
from w1thermsensor.kernel import load_kernel_modules
|
|
275
|
+
|
|
276
|
+
load_kernel_modules()
|
|
277
|
+
from boneio.sensor.temp.dallas_w1 import DallasSensorW1
|
|
278
|
+
|
|
279
|
+
_one_wire_devices.update(
|
|
280
|
+
find_onewire_devices(
|
|
281
|
+
ow_bus=configure_dallas(),
|
|
282
|
+
bus_id=dallas[ID],
|
|
283
|
+
bus_type=DALLAS,
|
|
284
|
+
)
|
|
276
285
|
)
|
|
277
|
-
|
|
286
|
+
except KernelModuleLoadError as err:
|
|
287
|
+
_LOGGER.error("Can't configure Dallas W1 device %s", err)
|
|
288
|
+
pass
|
|
289
|
+
|
|
278
290
|
for sensor in sensors:
|
|
279
291
|
address = _one_wire_devices.get(sensor[ADDRESS])
|
|
280
292
|
if not address:
|
|
281
293
|
continue
|
|
282
294
|
ds2482_bus_id = sensor.get("bus_id")
|
|
283
295
|
if ds2482_bus_id and ds2482_bus_id in _ds_onewire_bus:
|
|
284
|
-
kwargs = {
|
|
296
|
+
kwargs = {
|
|
297
|
+
"bus": _ds_onewire_bus[ds2482_bus_id],
|
|
298
|
+
"cls": DallasSensorDS2482,
|
|
299
|
+
}
|
|
285
300
|
else:
|
|
286
|
-
kwargs = {}
|
|
301
|
+
kwargs = {"cls": DallasSensorW1}
|
|
287
302
|
_LOGGER.debug("Configuring sensor %s for boneIO", address)
|
|
288
303
|
self._temp_sensors.append(
|
|
289
304
|
create_dallas_sensor(
|
|
@@ -326,6 +326,12 @@ input:
|
|
|
326
326
|
required: True
|
|
327
327
|
meta:
|
|
328
328
|
label: Either switch or sensor. If sensor then no clicks are detected, just simple on/off on gpio.
|
|
329
|
+
inverted:
|
|
330
|
+
type: boolean
|
|
331
|
+
default: False
|
|
332
|
+
required: True
|
|
333
|
+
meta:
|
|
334
|
+
label: Check if sensor type is inverted. Only aplicable for sensor kind.
|
|
329
335
|
actions:
|
|
330
336
|
required: False
|
|
331
337
|
type: dict
|
|
@@ -14,6 +14,11 @@ class GpioInputSensor(GpioBaseClass):
|
|
|
14
14
|
def __init__(self, **kwargs) -> None:
|
|
15
15
|
"""Setup GPIO Input Button"""
|
|
16
16
|
super().__init__(**kwargs)
|
|
17
|
+
self._click_type = (
|
|
18
|
+
(PRESSED, RELEASED)
|
|
19
|
+
if kwargs.get("inverted", False)
|
|
20
|
+
else (PRESSED, RELEASED)
|
|
21
|
+
)
|
|
17
22
|
edge_detect(
|
|
18
23
|
self._pin,
|
|
19
24
|
callback=self._handle_press,
|
|
@@ -25,13 +30,8 @@ class GpioInputSensor(GpioBaseClass):
|
|
|
25
30
|
def _handle_press(self, pin: str) -> None:
|
|
26
31
|
"""Handle the button press callback"""
|
|
27
32
|
# Ignore if we are in a long press
|
|
28
|
-
if self.is_pressed
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
else:
|
|
34
|
-
_LOGGER.debug("Released event on pin %s", self._pin)
|
|
35
|
-
self._loop.call_soon_threadsafe(
|
|
36
|
-
partial(self._press_callback, RELEASED, self._pin)
|
|
37
|
-
)
|
|
33
|
+
click_type = self._click_type[0] if self.is_pressed else self._click_type[1]
|
|
34
|
+
_LOGGER.debug("%s event on pin %s", click_type, self._pin)
|
|
35
|
+
self._loop.call_soon_threadsafe(
|
|
36
|
+
partial(self._press_callback, click_type, self._pin)
|
|
37
|
+
)
|
|
@@ -123,7 +123,9 @@ class ModbusSensor(BasicMqtt, AsyncUpdater):
|
|
|
123
123
|
self, id: str, sdm_name: str, sensor_id: str, **kwargs
|
|
124
124
|
) -> None:
|
|
125
125
|
"""Send HA autodiscovery information for each Modbus sensor."""
|
|
126
|
-
_LOGGER.debug(
|
|
126
|
+
_LOGGER.debug(
|
|
127
|
+
"Sending HA discovery for modbus sensor %s %s.", sdm_name, sensor_id
|
|
128
|
+
)
|
|
127
129
|
topic = (
|
|
128
130
|
f"{self._config_helper.ha_discovery_prefix}/{SENSOR}/{self._config_helper.topic_prefix}{id}"
|
|
129
131
|
f"/{id}{sensor_id.replace('_', '').replace(' ', '').lower()}/config"
|
|
@@ -164,6 +166,9 @@ class ModbusSensor(BasicMqtt, AsyncUpdater):
|
|
|
164
166
|
**kwargs,
|
|
165
167
|
)
|
|
166
168
|
return datetime.now()
|
|
169
|
+
_LOGGER.error(
|
|
170
|
+
"Discovery for %s not sent. First register not available.", self._id
|
|
171
|
+
)
|
|
167
172
|
return False
|
|
168
173
|
|
|
169
174
|
async def check_availability(self) -> None:
|
|
@@ -182,7 +187,7 @@ class ModbusSensor(BasicMqtt, AsyncUpdater):
|
|
|
182
187
|
address=first_register_base[REGISTERS][0][ADDRESS],
|
|
183
188
|
method=register_method,
|
|
184
189
|
)
|
|
185
|
-
if register:
|
|
190
|
+
if register is not None:
|
|
186
191
|
self._discovery_sent = self._send_discovery_for_all_registers(
|
|
187
192
|
register
|
|
188
193
|
)
|
|
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
|
|
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
|