boneIO 0.8.2__tar.gz → 0.8.3__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.2 → boneIO-0.8.3}/PKG-INFO +1 -1
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/gpio.py +6 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/loader.py +2 -2
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/stats.py +24 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/input/gpio_new.py +13 -4
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/manager.py +11 -4
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/oled.py +73 -7
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/schema.yaml +1 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/gpio_new.py +9 -3
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/temp/dallas.py +7 -1
- boneIO-0.8.3/boneio/version.py +2 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/pyproject.toml +1 -1
- boneIO-0.8.2/boneio/version.py +0 -2
- {boneIO-0.8.2 → boneIO-0.8.3}/LICENSE +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/README.md +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/bonecli.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/const.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/cover.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/adc.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/binary_sensor.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/binary_sensor_v_0_7.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/config.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/cover.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/event.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/event_all.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/event_v_0_7.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/led32x4A.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/output24x16A.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/output24x16A_v0.3.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/output32x10A.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/example_config/output32x5A.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/fonts/danube__.ttf +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/group/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/group/output.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/async_updater.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/click_timer.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/config.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/events.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/exceptions.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/filter.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/gpiod.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/ha_discovery.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/logger.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/mqtt.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/oled.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/onewire/W1ThermSensor.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/onewire/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/onewire/ds2482.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/onewire/onewire.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/pcf8575.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/queue.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/sensor/ina_219_smbus.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/state_manager.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/timeperiod.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/util.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/helper/yaml_util.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/input/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/input/gpio.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/client.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/cwt.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/dts1964_3f.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/liquid-sensor.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/modbuscli.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/orno-or-we-517.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/pt100.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/r4dcb08.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/sdm120.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/sdm630.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/sensor.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/sht20.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/single_sensor.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/socomec_e03.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/socomec_e23.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/sofar.json +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/modbus/utils.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/mqtt_client.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/relay/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/relay/basic.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/relay/gpio.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/relay/mcp.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/relay/pca.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/relay/pcf.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/runner.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/actions.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/actions_sensor.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/actions_switch.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/filters.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/filters_adc.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/id.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/temp_unit.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/schema/update_interval.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/adc.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/gpio.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/ina219.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/temp/__init__.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/temp/lm75.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/boneio/sensor/temp/mcp9808.py +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/tests/32_5_config.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/tests/bandit.yaml +0 -0
- {boneIO-0.8.2 → boneIO-0.8.3}/tests/relay_32_5.py +0 -0
|
@@ -141,6 +141,7 @@ class GpioBaseClass:
|
|
|
141
141
|
self._actions = actions
|
|
142
142
|
self._input_type = input_type
|
|
143
143
|
self._empty_message_after = empty_message_after
|
|
144
|
+
self._pressed_state = ""
|
|
144
145
|
|
|
145
146
|
def press_callback(
|
|
146
147
|
self, click_type: ClickTypes, duration: float | None = None
|
|
@@ -174,6 +175,11 @@ class GpioBaseClass:
|
|
|
174
175
|
"""Is button pressed."""
|
|
175
176
|
return read_input(self._pin)
|
|
176
177
|
|
|
178
|
+
@property
|
|
179
|
+
def pressed_state(self) -> str:
|
|
180
|
+
"""Pressed state for"""
|
|
181
|
+
return self._pressed_state
|
|
182
|
+
|
|
177
183
|
@property
|
|
178
184
|
def name(self) -> str:
|
|
179
185
|
"""Name of the GPIO visible in HA/MQTT."""
|
|
@@ -372,8 +372,8 @@ def configure_event_sensor(
|
|
|
372
372
|
name = gpio.pop(ID, pin)
|
|
373
373
|
if input:
|
|
374
374
|
if not isinstance(input, GpioEventButtonClass):
|
|
375
|
-
_LOGGER.
|
|
376
|
-
"You
|
|
375
|
+
_LOGGER.warning(
|
|
376
|
+
"You reconfigured type of input. It's forbidden. Please restart boneIO."
|
|
377
377
|
)
|
|
378
378
|
return input
|
|
379
379
|
input.set_actions(actions=gpio.get(ACTIONS, {}))
|
|
@@ -30,6 +30,8 @@ from boneio.const import (
|
|
|
30
30
|
# Typing imports that create a circular dependency
|
|
31
31
|
from typing import TYPE_CHECKING
|
|
32
32
|
|
|
33
|
+
from boneio.helper.gpio import GpioBaseClass
|
|
34
|
+
|
|
33
35
|
if TYPE_CHECKING:
|
|
34
36
|
from boneio.manager import Manager
|
|
35
37
|
|
|
@@ -158,6 +160,7 @@ class HostData:
|
|
|
158
160
|
def __init__(
|
|
159
161
|
self,
|
|
160
162
|
output: dict,
|
|
163
|
+
inputs: dict[str, GpioBaseClass],
|
|
161
164
|
callback: Callable,
|
|
162
165
|
temp_sensor: Callable[[LM75Sensor, MCP9808Sensor], None] | None,
|
|
163
166
|
ina219: INA219Class | None,
|
|
@@ -298,6 +301,12 @@ class HostData:
|
|
|
298
301
|
update_interval=_v["update_interval"],
|
|
299
302
|
)
|
|
300
303
|
self._output = output
|
|
304
|
+
self._inputs = {
|
|
305
|
+
f"Inputs screen {i + 1}": list(inputs.values())[
|
|
306
|
+
i * 25 : (i + 1) * 25
|
|
307
|
+
]
|
|
308
|
+
for i in range((len(inputs) + 24) // 25)
|
|
309
|
+
}
|
|
301
310
|
self._callback = callback
|
|
302
311
|
self._loop = asyncio.get_running_loop()
|
|
303
312
|
|
|
@@ -305,6 +314,8 @@ class HostData:
|
|
|
305
314
|
"""Get saved stats."""
|
|
306
315
|
if type in self._output:
|
|
307
316
|
return self._get_output(type)
|
|
317
|
+
if type in self._inputs:
|
|
318
|
+
return self._get_input(type)
|
|
308
319
|
return self._data[type].state
|
|
309
320
|
|
|
310
321
|
def _get_output(self, type: str) -> dict:
|
|
@@ -313,3 +324,16 @@ class HostData:
|
|
|
313
324
|
for output in self._output[type].values():
|
|
314
325
|
out[output.id] = output.state
|
|
315
326
|
return out
|
|
327
|
+
|
|
328
|
+
def _get_input(self, type: str) -> dict:
|
|
329
|
+
"""Get stats for input."""
|
|
330
|
+
inputs = {}
|
|
331
|
+
for input in self._inputs[type]:
|
|
332
|
+
inputs[input.name] = (
|
|
333
|
+
input.pressed_state[0].upper() if input.pressed_state else ""
|
|
334
|
+
)
|
|
335
|
+
return inputs
|
|
336
|
+
|
|
337
|
+
@property
|
|
338
|
+
def inputs_length(self) -> int:
|
|
339
|
+
return len(self._inputs)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"""GpioEventButtonNew to receive signals."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
import time
|
|
4
5
|
import logging
|
|
5
|
-
from boneio.const import DOUBLE, LONG, SINGLE, BOTH
|
|
6
|
+
from boneio.const import DOUBLE, LONG, SINGLE, BOTH, PRESSED, RELEASED
|
|
6
7
|
from boneio.helper import GpioBaseClass, ClickTimer
|
|
7
8
|
from boneio.helper.gpio import edge_detect
|
|
8
9
|
from boneio.helper.timeperiod import TimePeriod
|
|
10
|
+
|
|
9
11
|
_LOGGER = logging.getLogger(__name__)
|
|
10
12
|
|
|
11
13
|
# TIMINGS FOR BUTTONS
|
|
@@ -20,6 +22,7 @@ class GpioEventButtonNew(GpioBaseClass):
|
|
|
20
22
|
"""Setup GPIO Input Button"""
|
|
21
23
|
super().__init__(**kwargs)
|
|
22
24
|
self._state = self.is_pressed
|
|
25
|
+
self._pressed_state = PRESSED if self._state else RELEASED
|
|
23
26
|
self.button_pressed_time = 0.0
|
|
24
27
|
self.last_click_time = 0.0
|
|
25
28
|
self._double_test = None
|
|
@@ -35,7 +38,9 @@ class GpioEventButtonNew(GpioBaseClass):
|
|
|
35
38
|
)
|
|
36
39
|
self._double_click_ran = False
|
|
37
40
|
self._long_press_ran = False
|
|
38
|
-
edge_detect(
|
|
41
|
+
edge_detect(
|
|
42
|
+
pin=self._pin, callback=self.check_state, bounce=0, edge=BOTH
|
|
43
|
+
)
|
|
39
44
|
_LOGGER.debug("Configured NEW listening for input pin %s", self._pin)
|
|
40
45
|
|
|
41
46
|
def single_click_callback(self):
|
|
@@ -55,6 +60,7 @@ class GpioEventButtonNew(GpioBaseClass):
|
|
|
55
60
|
time_now = time.time()
|
|
56
61
|
self._state = self.is_pressed
|
|
57
62
|
if self._state:
|
|
63
|
+
self._pressed_state = PRESSED
|
|
58
64
|
if time_now - self.button_pressed_time >= self._bounce_time:
|
|
59
65
|
self.button_pressed_time = time_now
|
|
60
66
|
self._timer_long.start_timer()
|
|
@@ -66,9 +72,12 @@ class GpioEventButtonNew(GpioBaseClass):
|
|
|
66
72
|
self._timer_double.start_timer()
|
|
67
73
|
|
|
68
74
|
else:
|
|
69
|
-
|
|
75
|
+
self._pressed_state = RELEASED
|
|
76
|
+
if (
|
|
77
|
+
not self._timer_double.is_waiting()
|
|
78
|
+
and not self._double_click_ran
|
|
79
|
+
):
|
|
70
80
|
if self._timer_long.is_waiting():
|
|
71
81
|
self.press_callback(click_type=SINGLE, duration=None)
|
|
72
82
|
self._timer_long.reset()
|
|
73
83
|
self._double_click_ran = False
|
|
74
|
-
|
|
@@ -142,6 +142,7 @@ class Manager:
|
|
|
142
142
|
self._ina219_sensors = []
|
|
143
143
|
self._modbus_sensors = {}
|
|
144
144
|
self._modbus = None
|
|
145
|
+
self._screens = []
|
|
145
146
|
|
|
146
147
|
self._configure_modbus(modbus=modbus)
|
|
147
148
|
|
|
@@ -261,13 +262,14 @@ class Manager:
|
|
|
261
262
|
if oled.get("enabled", False):
|
|
262
263
|
from boneio.oled import Oled
|
|
263
264
|
|
|
264
|
-
|
|
265
|
+
self._screens = oled.get("screens", [])
|
|
265
266
|
extra_sensors = oled.get("extra_screen_sensors", [])
|
|
266
267
|
|
|
267
268
|
self._host_data = HostData(
|
|
268
269
|
manager=self,
|
|
269
|
-
enabled_screens=
|
|
270
|
+
enabled_screens=self._screens,
|
|
270
271
|
output=self.grouped_outputs,
|
|
272
|
+
inputs=self._inputs,
|
|
271
273
|
temp_sensor=(
|
|
272
274
|
self._temp_sensors[0] if self._temp_sensors else None
|
|
273
275
|
),
|
|
@@ -280,7 +282,7 @@ class Manager:
|
|
|
280
282
|
try:
|
|
281
283
|
self._oled = Oled(
|
|
282
284
|
host_data=self._host_data,
|
|
283
|
-
screen_order=
|
|
285
|
+
screen_order=self._screens,
|
|
284
286
|
output_groups=list(self.grouped_outputs),
|
|
285
287
|
sleep_timeout=oled.get("screensaver_timeout", 60),
|
|
286
288
|
)
|
|
@@ -387,7 +389,7 @@ class Manager:
|
|
|
387
389
|
pin=pin,
|
|
388
390
|
press_callback=self.press_callback,
|
|
389
391
|
send_ha_autodiscovery=self.send_ha_autodiscovery,
|
|
390
|
-
input=self._inputs.get(pin, None),
|
|
392
|
+
input=self._inputs.get(pin, None), # for reload actions.
|
|
391
393
|
)
|
|
392
394
|
if input:
|
|
393
395
|
self._inputs[input.pin] = input
|
|
@@ -728,6 +730,11 @@ class Manager:
|
|
|
728
730
|
self._loop.call_soon_threadsafe(
|
|
729
731
|
self._loop.call_later, 0.2, self.send_message, topic, ""
|
|
730
732
|
)
|
|
733
|
+
if (
|
|
734
|
+
"Inputs screen 1" in self._screens
|
|
735
|
+
or "Inputs screen 2" in self._screens
|
|
736
|
+
):
|
|
737
|
+
self._host_data_callback(type="inputs")
|
|
731
738
|
|
|
732
739
|
def send_ha_autodiscovery(
|
|
733
740
|
self,
|
|
@@ -35,7 +35,9 @@ fonts = {
|
|
|
35
35
|
START_ROW = 17
|
|
36
36
|
UPTIME_ROWS = list(range(22, 60, 10))
|
|
37
37
|
OUTPUT_ROWS = list(range(14, 60, 6))
|
|
38
|
+
INPUT_ROWS = list(range(12, 60, 6))
|
|
38
39
|
OUTPUT_COLS = range(0, 113, 56)
|
|
40
|
+
INPUT_COLS = range(0, 113, 30)
|
|
39
41
|
|
|
40
42
|
|
|
41
43
|
def shorten_name(name: str) -> str:
|
|
@@ -57,15 +59,47 @@ class Oled:
|
|
|
57
59
|
"""Initialize OLED screen."""
|
|
58
60
|
self._loop = asyncio.get_running_loop()
|
|
59
61
|
self._output_groups = None
|
|
62
|
+
self._input_groups = []
|
|
63
|
+
self._host_data = host_data
|
|
64
|
+
|
|
65
|
+
def configure_outputs() -> None:
|
|
66
|
+
try:
|
|
67
|
+
_ind_screen = screen_order.index("outputs")
|
|
68
|
+
if not output_groups:
|
|
69
|
+
_LOGGER.debug("No outputs configured. Omitting in screen.")
|
|
70
|
+
return
|
|
71
|
+
screen_order.pop(_ind_screen)
|
|
72
|
+
screen_order[_ind_screen:_ind_screen] = output_groups
|
|
73
|
+
self._output_groups = output_groups
|
|
74
|
+
except ValueError:
|
|
75
|
+
pass
|
|
76
|
+
|
|
77
|
+
def configure_inputs() -> None:
|
|
78
|
+
try:
|
|
79
|
+
_inputs_screen = screen_order.index("inputs")
|
|
80
|
+
input_groups = [
|
|
81
|
+
f"Inputs screen {i + 1}"
|
|
82
|
+
for i in range(
|
|
83
|
+
0, self._host_data.inputs_length, 1
|
|
84
|
+
) # self._host_data.inputs_length
|
|
85
|
+
]
|
|
86
|
+
if not _inputs_screen:
|
|
87
|
+
_LOGGER.debug("No inputs configured. Omitting in screen.")
|
|
88
|
+
return
|
|
89
|
+
screen_order.pop(_inputs_screen)
|
|
90
|
+
screen_order[_inputs_screen:_inputs_screen] = input_groups
|
|
91
|
+
self._input_groups = input_groups
|
|
92
|
+
except ValueError:
|
|
93
|
+
pass
|
|
94
|
+
|
|
60
95
|
try:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
_LOGGER.debug("No outputs configured. Omitting in screen.")
|
|
64
|
-
screen_order.pop(_ind_screen)
|
|
65
|
-
screen_order[_ind_screen:_ind_screen] = output_groups
|
|
66
|
-
self._output_groups = output_groups
|
|
96
|
+
_ina219_screen = screen_order.index("ina219")
|
|
97
|
+
screen_order.pop(_ina219_screen)
|
|
67
98
|
except ValueError:
|
|
68
99
|
pass
|
|
100
|
+
|
|
101
|
+
configure_outputs()
|
|
102
|
+
configure_inputs()
|
|
69
103
|
self._screen_order = cycle(screen_order)
|
|
70
104
|
self._current_screen = next(self._screen_order)
|
|
71
105
|
self._host_data = host_data
|
|
@@ -143,6 +177,29 @@ class Oled:
|
|
|
143
177
|
)
|
|
144
178
|
i += 1
|
|
145
179
|
|
|
180
|
+
def _draw_input(self, data: dict, draw: ImageDraw) -> None:
|
|
181
|
+
"Draw inputs of boneIO Black."
|
|
182
|
+
cols = cycle(INPUT_COLS)
|
|
183
|
+
draw.text(
|
|
184
|
+
(1, 1),
|
|
185
|
+
f"{self._current_screen}",
|
|
186
|
+
font=fonts["small"],
|
|
187
|
+
fill=WHITE,
|
|
188
|
+
)
|
|
189
|
+
i = 0
|
|
190
|
+
j = next(cols)
|
|
191
|
+
for k in data:
|
|
192
|
+
if len(INPUT_ROWS) == i:
|
|
193
|
+
j = next(cols)
|
|
194
|
+
i = 0
|
|
195
|
+
draw.text(
|
|
196
|
+
(j, INPUT_ROWS[i]),
|
|
197
|
+
f"{shorten_name(k)} {data[k]}",
|
|
198
|
+
font=fonts["extraSmall"],
|
|
199
|
+
fill=WHITE,
|
|
200
|
+
)
|
|
201
|
+
i += 1
|
|
202
|
+
|
|
146
203
|
def render_display(self) -> None:
|
|
147
204
|
"""Render display."""
|
|
148
205
|
data = self._host_data.get(self._current_screen)
|
|
@@ -155,6 +212,11 @@ class Oled:
|
|
|
155
212
|
self._draw_output(data, draw)
|
|
156
213
|
elif self._current_screen == UPTIME:
|
|
157
214
|
self._draw_uptime(data, draw)
|
|
215
|
+
elif (
|
|
216
|
+
self._input_groups
|
|
217
|
+
and self._current_screen in self._input_groups
|
|
218
|
+
):
|
|
219
|
+
self._draw_input(data, draw)
|
|
158
220
|
else:
|
|
159
221
|
self._draw_standard(data, draw)
|
|
160
222
|
else:
|
|
@@ -168,7 +230,11 @@ class Oled:
|
|
|
168
230
|
|
|
169
231
|
def handle_data_update(self, type: str):
|
|
170
232
|
"""Callback to handle new data present into screen."""
|
|
171
|
-
if
|
|
233
|
+
if (
|
|
234
|
+
type == "inputs"
|
|
235
|
+
and self._current_screen in self._input_groups
|
|
236
|
+
or type == self._current_screen
|
|
237
|
+
) and not self._sleep:
|
|
172
238
|
self.render_display()
|
|
173
239
|
|
|
174
240
|
def _handle_press(self, pin: any) -> None:
|
|
@@ -8,6 +8,7 @@ from boneio.helper.gpio import add_event_callback, add_event_detect
|
|
|
8
8
|
|
|
9
9
|
_LOGGER = logging.getLogger(__name__)
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
class GpioInputBinarySensorNew(GpioBaseClass):
|
|
12
13
|
"""Represent Gpio sensor on input boards."""
|
|
13
14
|
|
|
@@ -21,6 +22,9 @@ class GpioInputBinarySensorNew(GpioBaseClass):
|
|
|
21
22
|
if kwargs.get("inverted", False)
|
|
22
23
|
else (PRESSED, RELEASED)
|
|
23
24
|
)
|
|
25
|
+
self._pressed_state = (
|
|
26
|
+
self._click_type[0] if self._state else self._click_type[1]
|
|
27
|
+
)
|
|
24
28
|
self._initial_send = kwargs.get("initial_send", False)
|
|
25
29
|
_LOGGER.debug("Configured sensor pin %s", self._pin)
|
|
26
30
|
add_event_detect(pin=self._pin, edge=BOTH)
|
|
@@ -36,11 +40,13 @@ class GpioInputBinarySensorNew(GpioBaseClass):
|
|
|
36
40
|
):
|
|
37
41
|
return
|
|
38
42
|
self._state = state
|
|
39
|
-
|
|
43
|
+
self._pressed_state = (
|
|
44
|
+
self._click_type[0] if state else self._click_type[1]
|
|
45
|
+
)
|
|
40
46
|
_LOGGER.debug(
|
|
41
47
|
"Binary sensor: %s event on pin %s - %s",
|
|
42
|
-
|
|
48
|
+
self._pressed_state,
|
|
43
49
|
self._pin,
|
|
44
50
|
self.name,
|
|
45
51
|
)
|
|
46
|
-
self.press_callback(click_type=
|
|
52
|
+
self.press_callback(click_type=self._pressed_state, duration=None)
|
|
@@ -5,7 +5,11 @@ import logging
|
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
|
|
7
7
|
from adafruit_ds18x20 import DS18X20
|
|
8
|
-
from w1thermsensor import
|
|
8
|
+
from w1thermsensor import (
|
|
9
|
+
SensorNotReadyError,
|
|
10
|
+
NoSensorFoundError,
|
|
11
|
+
W1ThermSensorError,
|
|
12
|
+
)
|
|
9
13
|
|
|
10
14
|
from boneio.const import SENSOR, STATE, TEMPERATURE
|
|
11
15
|
from boneio.helper import AsyncUpdater, BasicMqtt
|
|
@@ -81,3 +85,5 @@ class DallasSensorW1(TempSensor, AsyncUpdater):
|
|
|
81
85
|
_LOGGER.error("Sensor not ready, can't update %s", err)
|
|
82
86
|
except NoSensorFoundError as err:
|
|
83
87
|
_LOGGER.error("Sensor not found, can't update %s", err)
|
|
88
|
+
except W1ThermSensorError as err:
|
|
89
|
+
_LOGGER.error("Sensor not working, can't update %s", err)
|
boneIO-0.8.2/boneio/version.py
DELETED
|
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
|