boneIO 0.8.0.dev18__tar.gz → 0.8.2__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.dev18 → boneIO-0.8.2}/PKG-INFO +1 -1
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/filter.py +6 -3
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/gpio.py +0 -1
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/stats.py +7 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sensor.py +13 -1
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/single_sensor.py +1 -5
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/socomec_e03.json +1 -1
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/pcf.py +3 -8
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/schema.yaml +9 -1
- boneIO-0.8.2/boneio/version.py +2 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/pyproject.toml +1 -1
- boneIO-0.8.0.dev18/boneio/version.py +0 -2
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/LICENSE +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/README.md +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/bonecli.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/const.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/cover.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/adc.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/binary_sensor.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/binary_sensor_v_0_7.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/config.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/cover.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/event.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/event_all.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/event_v_0_7.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/led32x4A.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/output24x16A.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/output24x16A_v0.3.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/output32x10A.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/output32x5A.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/fonts/danube__.ttf +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/group/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/group/output.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/async_updater.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/click_timer.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/config.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/events.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/exceptions.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/gpiod.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/ha_discovery.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/loader.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/logger.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/mqtt.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/oled.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/onewire/W1ThermSensor.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/onewire/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/onewire/ds2482.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/onewire/onewire.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/pcf8575.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/queue.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/sensor/ina_219_smbus.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/state_manager.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/timeperiod.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/util.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/yaml_util.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/input/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/input/gpio.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/input/gpio_new.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/manager.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/client.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/cwt.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/dts1964_3f.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/liquid-sensor.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/modbuscli.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/orno-or-we-517.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/pt100.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/r4dcb08.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sdm120.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sdm630.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sht20.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/socomec_e23.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sofar.json +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/utils.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/mqtt_client.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/oled.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/basic.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/gpio.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/mcp.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/pca.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/runner.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/actions.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/actions_sensor.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/actions_switch.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/filters.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/filters_adc.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/id.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/temp_unit.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/update_interval.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/adc.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/gpio.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/gpio_new.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/ina219.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/temp/__init__.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/temp/dallas.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/temp/lm75.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/temp/mcp9808.py +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/tests/32_5_config.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/tests/bandit.yaml +0 -0
- {boneIO-0.8.0.dev18 → boneIO-0.8.2}/tests/relay_32_5.py +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Filter class to adjust sensor values."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from typing import Optional
|
|
4
5
|
import logging
|
|
5
6
|
|
|
6
7
|
_LOGGER = logging.getLogger(__name__)
|
|
@@ -9,7 +10,7 @@ _LOGGER = logging.getLogger(__name__)
|
|
|
9
10
|
FILTERS = {
|
|
10
11
|
"offset": lambda x, y: x + y,
|
|
11
12
|
"round": lambda x, y: round(x, y),
|
|
12
|
-
"multiply": lambda x, y: x * y,
|
|
13
|
+
"multiply": lambda x, y: x * y if x else x,
|
|
13
14
|
"filter_out": lambda x, y: None if x == y else x,
|
|
14
15
|
"filter_out_greater": lambda x, y: None if x > y else x,
|
|
15
16
|
"filter_out_lower": lambda x, y: None if x < y else x,
|
|
@@ -19,8 +20,10 @@ FILTERS = {
|
|
|
19
20
|
class Filter:
|
|
20
21
|
_filters = []
|
|
21
22
|
|
|
22
|
-
def _apply_filters(
|
|
23
|
-
|
|
23
|
+
def _apply_filters(
|
|
24
|
+
self, value: float | None, filters: Optional[list] = None
|
|
25
|
+
) -> float | None:
|
|
26
|
+
filters = filters if filters is not None else self._filters
|
|
24
27
|
for filter in filters:
|
|
25
28
|
for k, v in filter.items():
|
|
26
29
|
if k not in FILTERS:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
import asyncio
|
|
3
|
+
import logging
|
|
3
4
|
from datetime import datetime
|
|
4
5
|
import socket
|
|
5
6
|
import time
|
|
@@ -37,6 +38,7 @@ from boneio.helper.timeperiod import TimePeriod
|
|
|
37
38
|
from boneio.sensor import LM75Sensor, MCP9808Sensor, INA219 as INA219Class
|
|
38
39
|
from boneio.version import __version__
|
|
39
40
|
|
|
41
|
+
_LOGGER = logging.getLogger(__name__)
|
|
40
42
|
intervals = (("d", 86400), ("h", 3600), ("m", 60))
|
|
41
43
|
|
|
42
44
|
|
|
@@ -259,6 +261,11 @@ class HostData:
|
|
|
259
261
|
single_sensor = _modbus_sensors.get_sensor_by_name(
|
|
260
262
|
sensor_id
|
|
261
263
|
)
|
|
264
|
+
if not single_sensor:
|
|
265
|
+
_LOGGER.warning(
|
|
266
|
+
"Sensor %s not found", sensor_id
|
|
267
|
+
)
|
|
268
|
+
continue
|
|
262
269
|
short_name = "".join(
|
|
263
270
|
[x[:3] for x in single_sensor.name.split()]
|
|
264
271
|
)
|
|
@@ -94,13 +94,25 @@ class ModbusSensor(BasicMqtt, AsyncUpdater, Filter):
|
|
|
94
94
|
self._modbus_sensors[index][
|
|
95
95
|
single_sensor.decoded_name
|
|
96
96
|
] = single_sensor
|
|
97
|
+
_LOGGER.info(
|
|
98
|
+
"Available single sensors for %s: %s",
|
|
99
|
+
self._name,
|
|
100
|
+
", ".join(
|
|
101
|
+
[
|
|
102
|
+
s.name
|
|
103
|
+
for sensors in self._modbus_sensors
|
|
104
|
+
for s in sensors.values()
|
|
105
|
+
]
|
|
106
|
+
),
|
|
107
|
+
)
|
|
97
108
|
event_bus.add_haonline_listener(target=self.set_payload_offline)
|
|
98
109
|
AsyncUpdater.__init__(self, **kwargs)
|
|
99
110
|
|
|
100
111
|
def get_sensor_by_name(self, name: str) -> Optional[SingleSensor]:
|
|
101
112
|
"""Return sensor by name."""
|
|
102
113
|
for sensors in self._modbus_sensors:
|
|
103
|
-
|
|
114
|
+
if name in sensors:
|
|
115
|
+
return sensors.get(name)
|
|
104
116
|
return None
|
|
105
117
|
|
|
106
118
|
def set_payload_offline(self):
|
|
@@ -71,11 +71,7 @@ class SingleSensor(Filter):
|
|
|
71
71
|
self._user_filters = user_filters
|
|
72
72
|
|
|
73
73
|
def set_value(self, value):
|
|
74
|
-
|
|
75
|
-
for key, _v in filter.items():
|
|
76
|
-
if key in allowed_operations:
|
|
77
|
-
lamda_function = allowed_operations[key]
|
|
78
|
-
value = lamda_function(value, _v)
|
|
74
|
+
value = self._apply_filters(value=value)
|
|
79
75
|
value = self._apply_filters(
|
|
80
76
|
value=value,
|
|
81
77
|
filters=self._user_filters,
|
|
@@ -4,7 +4,7 @@ import logging
|
|
|
4
4
|
|
|
5
5
|
from adafruit_pcf8575 import DigitalInOut
|
|
6
6
|
|
|
7
|
-
from boneio.const import NONE, SWITCH, PCF
|
|
7
|
+
from boneio.const import NONE, SWITCH, PCF, ON, OFF
|
|
8
8
|
from boneio.helper.events import async_track_point_in_time, utcnow
|
|
9
9
|
from boneio.helper.pcf8575 import PCF8575
|
|
10
10
|
from boneio.relay.basic import BasicRelay
|
|
@@ -66,18 +66,13 @@ class PCFRelay(BasicRelay):
|
|
|
66
66
|
def turn_on(self) -> None:
|
|
67
67
|
"""Call turn on action."""
|
|
68
68
|
self.pin.value = self._active_state
|
|
69
|
-
self.
|
|
69
|
+
self._execute_momentary_turn(momentary_type=ON)
|
|
70
70
|
self._loop.call_soon_threadsafe(self.send_state)
|
|
71
71
|
self._loop.call_soon_threadsafe(self._callback)
|
|
72
72
|
|
|
73
73
|
def turn_off(self) -> None:
|
|
74
74
|
"""Call turn off action."""
|
|
75
75
|
self.pin.value = not self._active_state
|
|
76
|
-
|
|
77
|
-
async_track_point_in_time(
|
|
78
|
-
loop=self._loop,
|
|
79
|
-
action=lambda x: self._momentary_callback(time=x, action=self.turn_on),
|
|
80
|
-
point_in_time=utcnow() + self._momentary_turn_off.as_timedelta,
|
|
81
|
-
)
|
|
76
|
+
self._execute_momentary_turn(momentary_type=OFF)
|
|
82
77
|
self._loop.call_soon_threadsafe(self.send_state)
|
|
83
78
|
self._loop.call_soon_threadsafe(self._callback)
|
|
@@ -183,7 +183,15 @@ modbus_sensors:
|
|
|
183
183
|
type: string
|
|
184
184
|
required: True
|
|
185
185
|
allowed:
|
|
186
|
-
[
|
|
186
|
+
[
|
|
187
|
+
'sdm630',
|
|
188
|
+
'sdm120',
|
|
189
|
+
'sofar',
|
|
190
|
+
'socomec_e03',
|
|
191
|
+
'socomec_e23',
|
|
192
|
+
'cwt',
|
|
193
|
+
'orno-or-we-517',
|
|
194
|
+
]
|
|
187
195
|
meta:
|
|
188
196
|
label: Model to load from database.
|
|
189
197
|
update_interval:
|
|
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
|
|
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
|