boneIO 0.3.0.dev1__tar.gz → 0.3.0.dev3__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.3.0.dev1/boneio.egg-info → boneio-0.3.0.dev3}/PKG-INFO +2 -2
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/cover.py +5 -4
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/gpio.py +0 -1
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/loader.py +8 -5
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/schema/schema.yaml +37 -12
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/sensor/adc.py +5 -2
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/sensor/modbus/__init__.py +6 -5
- boneio-0.3.0.dev3/boneio/version.py +2 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3/boneio.egg-info}/PKG-INFO +2 -2
- boneio-0.3.0.dev1/boneio/version.py +0 -2
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/LICENSE +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/MANIFEST.in +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/README.md +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/__init__.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/bonecli.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/const.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/example_config/__init__.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/example_config/adc.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/example_config/config.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/example_config/cover.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/example_config/input.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/example_config/output24x16A.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/example_config/output32x5A.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/fonts/danube__.ttf +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/__init__.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/events.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/exceptions.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/ha_discovery.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/logger.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/mqtt.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/oled.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/queue.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/state_manager.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/stats.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/timeperiod.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/helper/yaml_util.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/input/__init__.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/input/gpio.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/manager.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/modbus.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/mqtt_client.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/oled.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/relay/__init__.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/relay/basic.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/relay/gpio.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/relay/mcp.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/runner.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/schema/actions.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/schema/actions_sensor.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/schema/actions_switch.yaml +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/sensor/__init__.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/sensor/gpio.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/sensor/modbus/sdm120.json +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/sensor/modbus/sdm630.json +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/sensor/modbus/sofar.json +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio/sensor/temp/__init__.py +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio.egg-info/SOURCES.txt +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio.egg-info/dependency_links.txt +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio.egg-info/entry_points.txt +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio.egg-info/requires.txt +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/boneio.egg-info/top_level.txt +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/requirements.txt +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/setup.cfg +0 -0
- {boneio-0.3.0.dev1 → boneio-0.3.0.dev3}/setup.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: boneio
|
|
3
|
-
Version: 0.3.0.
|
|
3
|
+
Version: 0.3.0.dev3
|
|
4
4
|
Summary: Python App for BoneIO
|
|
5
5
|
Home-page: https://github.com/boneIO-eu/app_bbb
|
|
6
|
-
Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.3.0.
|
|
6
|
+
Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.3.0.dev3.zip
|
|
7
7
|
License: GNU General Public License v3.0
|
|
8
8
|
Platform: UNKNOWN
|
|
9
9
|
Classifier: Programming Language :: Python
|
|
@@ -5,6 +5,7 @@ from typing import Any, Callable
|
|
|
5
5
|
from boneio.const import CLOSE, COVER, IDLE, OPEN, OPENING, CLOSING, CLOSED, STOP
|
|
6
6
|
from boneio.helper.events import EventBus
|
|
7
7
|
from boneio.helper.mqtt import BasicMqtt
|
|
8
|
+
from boneio.helper.timeperiod import TimePeriod
|
|
8
9
|
from boneio.relay import MCPRelay
|
|
9
10
|
|
|
10
11
|
_LOGGER = logging.getLogger(__name__)
|
|
@@ -21,10 +22,10 @@ COVER_COMMANDS = {
|
|
|
21
22
|
class RelayHelper:
|
|
22
23
|
"""Relay helper for cover either open/close."""
|
|
23
24
|
|
|
24
|
-
def __init__(self, relay: MCPRelay, time:
|
|
25
|
+
def __init__(self, relay: MCPRelay, time: TimePeriod) -> None:
|
|
25
26
|
"""Initialize helper."""
|
|
26
27
|
self._relay = relay
|
|
27
|
-
self._steps = 100 / time
|
|
28
|
+
self._steps = 100 / time.total_seconds
|
|
28
29
|
|
|
29
30
|
@property
|
|
30
31
|
def relay(self) -> MCPRelay:
|
|
@@ -46,8 +47,8 @@ class Cover(BasicMqtt):
|
|
|
46
47
|
open_relay: Any,
|
|
47
48
|
close_relay: MCPRelay,
|
|
48
49
|
state_save: Callable,
|
|
49
|
-
open_time:
|
|
50
|
-
close_time:
|
|
50
|
+
open_time: TimePeriod,
|
|
51
|
+
close_time: TimePeriod,
|
|
51
52
|
event_bus: EventBus,
|
|
52
53
|
restored_state: int = 100,
|
|
53
54
|
**kwargs,
|
|
@@ -98,7 +98,6 @@ class GpioBaseClass:
|
|
|
98
98
|
gpio = kwargs.get("rest_pin", {GPIO_MODE: GPIO_STR})
|
|
99
99
|
gpio_mode = gpio.get(GPIO_MODE, GPIO_STR)
|
|
100
100
|
self._bounce_time = gpio.get("bounce_time", TimePeriod(milliseconds=25))
|
|
101
|
-
configure_pin(pin=pin, mode=gpio_mode)
|
|
102
101
|
self._loop = asyncio.get_running_loop()
|
|
103
102
|
self._press_callback = press_callback
|
|
104
103
|
setup_input(pin=self._pin, pull_mode=gpio_mode)
|
|
@@ -44,6 +44,7 @@ from boneio.helper import (
|
|
|
44
44
|
ha_sensor_temp_availabilty_message,
|
|
45
45
|
)
|
|
46
46
|
from boneio.helper.ha_discovery import ha_cover_availabilty_message
|
|
47
|
+
from boneio.helper.timeperiod import TimePeriod
|
|
47
48
|
from boneio.input.gpio import GpioInputButton
|
|
48
49
|
|
|
49
50
|
# Typing imports that create a circular dependency
|
|
@@ -77,7 +78,7 @@ def create_adc(
|
|
|
77
78
|
name=name,
|
|
78
79
|
send_message=manager.send_message,
|
|
79
80
|
topic_prefix=topic_prefix,
|
|
80
|
-
update_interval=gpio.get(UPDATE_INTERVAL, 60),
|
|
81
|
+
update_interval=gpio.get(UPDATE_INTERVAL, TimePeriod(seconds=60)),
|
|
81
82
|
)
|
|
82
83
|
if gpio.get(SHOW_HA, True):
|
|
83
84
|
manager.send_ha_autodiscovery(
|
|
@@ -145,9 +146,11 @@ def create_mcp23017(
|
|
|
145
146
|
id = mcp[ID] or mcp[ADDRESS]
|
|
146
147
|
try:
|
|
147
148
|
manager._mcp[id] = MCP23017(i2c=i2cbusio, address=mcp[ADDRESS], reset=False)
|
|
148
|
-
sleep_time = mcp.get(INIT_SLEEP, 0)
|
|
149
|
-
_LOGGER.debug(
|
|
150
|
-
|
|
149
|
+
sleep_time = mcp.get(INIT_SLEEP, TimePeriod(seconds=0))
|
|
150
|
+
_LOGGER.debug(
|
|
151
|
+
f"Sleeping for {sleep_time.total_seconds}s while MCP {id} is initializing."
|
|
152
|
+
)
|
|
153
|
+
time.sleep(sleep_time.total_seconds)
|
|
151
154
|
grouped_outputs[id] = {}
|
|
152
155
|
except TimeoutError as err:
|
|
153
156
|
_LOGGER.error("Can't connect to MCP %s. %s", id, err)
|
|
@@ -180,7 +183,7 @@ def create_modbus_sensors(
|
|
|
180
183
|
topic_prefix=topic_prefix,
|
|
181
184
|
ha_discovery=ha_discovery,
|
|
182
185
|
ha_discovery_prefix=ha_discovery_prefix,
|
|
183
|
-
update_interval=sensor.get(UPDATE_INTERVAL,
|
|
186
|
+
update_interval=sensor.get(UPDATE_INTERVAL, TimePeriod(seconds=60)),
|
|
184
187
|
)
|
|
185
188
|
manager.append_task(asyncio.create_task(sdm.send_state()))
|
|
186
189
|
except FileNotFoundError as err:
|
|
@@ -121,11 +121,16 @@ modbus_sensors:
|
|
|
121
121
|
meta:
|
|
122
122
|
label: Model to load from database.
|
|
123
123
|
update_interval:
|
|
124
|
-
type:
|
|
124
|
+
type:
|
|
125
|
+
- string
|
|
126
|
+
- timeperiod
|
|
127
|
+
coerce:
|
|
128
|
+
- str
|
|
129
|
+
- positive_time_period
|
|
125
130
|
required: True
|
|
126
|
-
default:
|
|
131
|
+
default: 30s
|
|
127
132
|
meta:
|
|
128
|
-
label: Update interval
|
|
133
|
+
label: Update interval.
|
|
129
134
|
lm75:
|
|
130
135
|
type: dict
|
|
131
136
|
required: False
|
|
@@ -178,9 +183,14 @@ mcp23017:
|
|
|
178
183
|
meta:
|
|
179
184
|
label: GPIO of I2C SDA
|
|
180
185
|
init_sleep:
|
|
181
|
-
type:
|
|
186
|
+
type:
|
|
187
|
+
- string
|
|
188
|
+
- timeperiod
|
|
189
|
+
coerce:
|
|
190
|
+
- str
|
|
191
|
+
- positive_time_period
|
|
182
192
|
required: True
|
|
183
|
-
default:
|
|
193
|
+
default: 0s
|
|
184
194
|
meta:
|
|
185
195
|
label: How long to sleep for MCP to initialize.
|
|
186
196
|
|
|
@@ -328,11 +338,16 @@ adc:
|
|
|
328
338
|
meta:
|
|
329
339
|
label: PIN to use.
|
|
330
340
|
update_interval:
|
|
331
|
-
type: integer
|
|
332
341
|
required: True
|
|
333
|
-
|
|
342
|
+
type:
|
|
343
|
+
- string
|
|
344
|
+
- timeperiod
|
|
345
|
+
coerce:
|
|
346
|
+
- str
|
|
347
|
+
- positive_time_period
|
|
348
|
+
default: 60s
|
|
334
349
|
meta:
|
|
335
|
-
label: Update interval
|
|
350
|
+
label: Update interval.
|
|
336
351
|
show_in_ha:
|
|
337
352
|
type: boolean
|
|
338
353
|
required: True
|
|
@@ -368,15 +383,25 @@ cover:
|
|
|
368
383
|
meta:
|
|
369
384
|
label: ID of close relay of output.
|
|
370
385
|
open_time:
|
|
371
|
-
type:
|
|
386
|
+
type:
|
|
387
|
+
- string
|
|
388
|
+
- timeperiod
|
|
389
|
+
coerce:
|
|
390
|
+
- str
|
|
391
|
+
- positive_time_period
|
|
372
392
|
required: True
|
|
373
393
|
meta:
|
|
374
|
-
label: Time to open cover
|
|
394
|
+
label: Time to open cover. Example 30s. Minimum is 1s.
|
|
375
395
|
close_time:
|
|
376
|
-
type:
|
|
396
|
+
type:
|
|
397
|
+
- string
|
|
398
|
+
- timeperiod
|
|
399
|
+
coerce:
|
|
400
|
+
- str
|
|
401
|
+
- positive_time_period
|
|
377
402
|
required: True
|
|
378
403
|
meta:
|
|
379
|
-
label: Time to close cover
|
|
404
|
+
label: Time to close cover. Example 30s. Minimum is 1s.
|
|
380
405
|
device_class:
|
|
381
406
|
type: string
|
|
382
407
|
required: False
|
|
@@ -4,6 +4,7 @@ import asyncio
|
|
|
4
4
|
|
|
5
5
|
from boneio.const import SENSOR
|
|
6
6
|
from boneio.helper import BasicMqtt
|
|
7
|
+
from boneio.helper.timeperiod import TimePeriod
|
|
7
8
|
|
|
8
9
|
try:
|
|
9
10
|
import Adafruit_BBIO.ADC as ADC
|
|
@@ -25,7 +26,9 @@ def initialize_adc():
|
|
|
25
26
|
class GpioADCSensor(BasicMqtt):
|
|
26
27
|
"""Represent Gpio ADC sensor."""
|
|
27
28
|
|
|
28
|
-
def __init__(
|
|
29
|
+
def __init__(
|
|
30
|
+
self, pin: str, update_interval: int = TimePeriod(seconds=60), **kwargs
|
|
31
|
+
) -> None:
|
|
29
32
|
"""Setup GPIO ADC Sensor"""
|
|
30
33
|
super().__init__(topic_type=SENSOR, **kwargs)
|
|
31
34
|
self._pin = pin
|
|
@@ -44,4 +47,4 @@ class GpioADCSensor(BasicMqtt):
|
|
|
44
47
|
topic=self._send_topic,
|
|
45
48
|
payload=self.state,
|
|
46
49
|
)
|
|
47
|
-
await asyncio.sleep(self._update_interval)
|
|
50
|
+
await asyncio.sleep(self._update_interval.total_seconds)
|
|
@@ -19,6 +19,7 @@ from boneio.const import (
|
|
|
19
19
|
)
|
|
20
20
|
from boneio.helper import BasicMqtt
|
|
21
21
|
from boneio.helper.ha_discovery import modbus_sensor_availabilty_message
|
|
22
|
+
from boneio.helper.timeperiod import TimePeriod
|
|
22
23
|
|
|
23
24
|
_LOGGER = logging.getLogger(__name__)
|
|
24
25
|
|
|
@@ -96,7 +97,7 @@ class ModbusSensor(BasicMqtt):
|
|
|
96
97
|
topic_prefix: str,
|
|
97
98
|
ha_discovery: bool = False,
|
|
98
99
|
id: str = DefaultName,
|
|
99
|
-
update_interval:
|
|
100
|
+
update_interval: TimePeriod = TimePeriod(seconds=60),
|
|
100
101
|
**kwargs,
|
|
101
102
|
):
|
|
102
103
|
"""Initialize Modbus sensor class."""
|
|
@@ -185,7 +186,7 @@ class ModbusSensor(BasicMqtt):
|
|
|
185
186
|
|
|
186
187
|
async def send_state(self) -> None:
|
|
187
188
|
"""Fetch state periodically and send to MQTT."""
|
|
188
|
-
update_interval = self._update_interval
|
|
189
|
+
update_interval = self._update_interval.total_seconds
|
|
189
190
|
payload_online = OFFLINE
|
|
190
191
|
while True:
|
|
191
192
|
await self.check_availability()
|
|
@@ -215,13 +216,13 @@ class ModbusSensor(BasicMqtt):
|
|
|
215
216
|
payload=payload_online,
|
|
216
217
|
)
|
|
217
218
|
_LOGGER.warn(
|
|
218
|
-
"Can't fetch data from modbus device. Will sleep for %s",
|
|
219
|
+
"Can't fetch data from modbus device. Will sleep for %s seconds",
|
|
219
220
|
update_interval,
|
|
220
221
|
)
|
|
221
222
|
self._discovery_sent = False
|
|
222
223
|
continue
|
|
223
|
-
elif update_interval != self._update_interval:
|
|
224
|
-
update_interval = self._update_interval
|
|
224
|
+
elif update_interval != self._update_interval.total_seconds:
|
|
225
|
+
update_interval = self._update_interval.total_seconds
|
|
225
226
|
output = {}
|
|
226
227
|
for register in data["registers"]:
|
|
227
228
|
output[register.get("name").replace(" ", "")] = CONVERT_METHODS[
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: boneio
|
|
3
|
-
Version: 0.3.0.
|
|
3
|
+
Version: 0.3.0.dev3
|
|
4
4
|
Summary: Python App for BoneIO
|
|
5
5
|
Home-page: https://github.com/boneIO-eu/app_bbb
|
|
6
|
-
Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.3.0.
|
|
6
|
+
Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.3.0.dev3.zip
|
|
7
7
|
License: GNU General Public License v3.0
|
|
8
8
|
Platform: UNKNOWN
|
|
9
9
|
Classifier: Programming Language :: Python
|
|
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
|