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.
Files changed (105) hide show
  1. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/PKG-INFO +1 -1
  2. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/filter.py +6 -3
  3. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/gpio.py +0 -1
  4. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/stats.py +7 -0
  5. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sensor.py +13 -1
  6. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/single_sensor.py +1 -5
  7. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/socomec_e03.json +1 -1
  8. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/pcf.py +3 -8
  9. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/schema.yaml +9 -1
  10. boneIO-0.8.2/boneio/version.py +2 -0
  11. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/pyproject.toml +1 -1
  12. boneIO-0.8.0.dev18/boneio/version.py +0 -2
  13. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/LICENSE +0 -0
  14. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/README.md +0 -0
  15. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/__init__.py +0 -0
  16. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/bonecli.py +0 -0
  17. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/const.py +0 -0
  18. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/cover.py +0 -0
  19. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/__init__.py +0 -0
  20. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/adc.yaml +0 -0
  21. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/binary_sensor.yaml +0 -0
  22. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/binary_sensor_v_0_7.yaml +0 -0
  23. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/config.yaml +0 -0
  24. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/cover.yaml +0 -0
  25. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/event.yaml +0 -0
  26. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/event_all.yaml +0 -0
  27. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/event_v_0_7.yaml +0 -0
  28. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/led32x4A.yaml +0 -0
  29. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/output24x16A.yaml +0 -0
  30. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/output24x16A_v0.3.yaml +0 -0
  31. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/output32x10A.yaml +0 -0
  32. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/example_config/output32x5A.yaml +0 -0
  33. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/fonts/danube__.ttf +0 -0
  34. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/group/__init__.py +0 -0
  35. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/group/output.py +0 -0
  36. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/__init__.py +0 -0
  37. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/async_updater.py +0 -0
  38. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/click_timer.py +0 -0
  39. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/config.py +0 -0
  40. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/events.py +0 -0
  41. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/exceptions.py +0 -0
  42. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/gpiod.py +0 -0
  43. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/ha_discovery.py +0 -0
  44. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/loader.py +0 -0
  45. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/logger.py +0 -0
  46. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/mqtt.py +0 -0
  47. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/oled.py +0 -0
  48. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/onewire/W1ThermSensor.py +0 -0
  49. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/onewire/__init__.py +0 -0
  50. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/onewire/ds2482.py +0 -0
  51. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/onewire/onewire.py +0 -0
  52. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/pcf8575.py +0 -0
  53. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/queue.py +0 -0
  54. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/sensor/ina_219_smbus.py +0 -0
  55. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/state_manager.py +0 -0
  56. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/timeperiod.py +0 -0
  57. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/util.py +0 -0
  58. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/helper/yaml_util.py +0 -0
  59. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/input/__init__.py +0 -0
  60. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/input/gpio.py +0 -0
  61. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/input/gpio_new.py +0 -0
  62. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/manager.py +0 -0
  63. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/__init__.py +0 -0
  64. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/client.py +0 -0
  65. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/cwt.json +0 -0
  66. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/dts1964_3f.json +0 -0
  67. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/liquid-sensor.json +0 -0
  68. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/modbuscli.py +0 -0
  69. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/orno-or-we-517.json +0 -0
  70. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/pt100.json +0 -0
  71. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/r4dcb08.json +0 -0
  72. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sdm120.json +0 -0
  73. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sdm630.json +0 -0
  74. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sht20.json +0 -0
  75. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/socomec_e23.json +0 -0
  76. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/sofar.json +0 -0
  77. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/modbus/utils.py +0 -0
  78. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/mqtt_client.py +0 -0
  79. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/oled.py +0 -0
  80. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/__init__.py +0 -0
  81. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/basic.py +0 -0
  82. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/gpio.py +0 -0
  83. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/mcp.py +0 -0
  84. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/relay/pca.py +0 -0
  85. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/runner.py +0 -0
  86. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/actions.yaml +0 -0
  87. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/actions_sensor.yaml +0 -0
  88. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/actions_switch.yaml +0 -0
  89. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/filters.yaml +0 -0
  90. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/filters_adc.yaml +0 -0
  91. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/id.yaml +0 -0
  92. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/temp_unit.yaml +0 -0
  93. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/schema/update_interval.yaml +0 -0
  94. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/__init__.py +0 -0
  95. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/adc.py +0 -0
  96. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/gpio.py +0 -0
  97. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/gpio_new.py +0 -0
  98. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/ina219.py +0 -0
  99. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/temp/__init__.py +0 -0
  100. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/temp/dallas.py +0 -0
  101. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/temp/lm75.py +0 -0
  102. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/boneio/sensor/temp/mcp9808.py +0 -0
  103. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/tests/32_5_config.yaml +0 -0
  104. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/tests/bandit.yaml +0 -0
  105. {boneIO-0.8.0.dev18 → boneIO-0.8.2}/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.dev18
3
+ Version: 0.8.2
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>
@@ -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(self, value: float, filters: list = []) -> float | None:
23
- filters = filters if filters else self._filters
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:
@@ -157,7 +157,6 @@ class GpioBaseClass:
157
157
  actions: List = [],
158
158
  ) -> None:
159
159
 
160
- _LOGGER.warning("press callback %s", datetime.now())
161
160
  await self._press_callback(
162
161
  click_type,
163
162
  self._pin,
@@ -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
- return sensors.get(name)
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
- for filter in self._filters:
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,
@@ -71,7 +71,7 @@
71
71
  "unit_of_measurement": "W",
72
72
  "state_class": "measurement",
73
73
  "value_type": "S_DWORD",
74
- "filters": [{ "multiply": 0.001 }]
74
+ "filters": [{ "multiply": 10 }]
75
75
  }
76
76
  ]
77
77
  },
@@ -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.execute_momentary_turn_on()
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
- if self._momentary_turn_off:
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
- ['sdm630', 'sdm120', 'sofar', 'socomec_e23', 'cwt', 'orno-or-we-517']
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:
@@ -0,0 +1,2 @@
1
+ # flake8: noqa
2
+ __version__ = "0.8.2"
@@ -30,7 +30,7 @@ dependencies = [
30
30
  "Adafruit-BBIO>=1.2.0",
31
31
  ]
32
32
  requires-python = ">=3.7"
33
- version = "0.8.0.dev18"
33
+ version = "0.8.2"
34
34
 
35
35
  [project.license]
36
36
  text = "GNU General Public License v3.0"
@@ -1,2 +0,0 @@
1
- # flake8: noqa
2
- __version__ = "0.8.0dev18"
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