boneIO 0.3.0.dev6__tar.gz → 0.3.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.
Files changed (72) hide show
  1. {boneio-0.3.0.dev6/boneio.egg-info → boneio-0.3.0.dev7}/PKG-INFO +2 -2
  2. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/const.py +2 -7
  3. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/example_config/config.yaml +2 -2
  4. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/example_config/cover.yaml +2 -2
  5. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/config.py +11 -0
  6. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/gpio.py +1 -1
  7. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/input/gpio.py +8 -7
  8. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/manager.py +4 -4
  9. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/modbus/__init__.py +13 -13
  10. boneio-0.3.0.dev7/boneio/version.py +2 -0
  11. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7/boneio.egg-info}/PKG-INFO +2 -2
  12. boneio-0.3.0.dev6/boneio/version.py +0 -2
  13. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/LICENSE +0 -0
  14. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/MANIFEST.in +0 -0
  15. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/README.md +0 -0
  16. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/__init__.py +0 -0
  17. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/bonecli.py +0 -0
  18. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/cover.py +0 -0
  19. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/example_config/__init__.py +0 -0
  20. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/example_config/adc.yaml +0 -0
  21. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/example_config/input.yaml +0 -0
  22. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/example_config/output24x16A.yaml +0 -0
  23. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/example_config/output32x5A.yaml +0 -0
  24. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/fonts/danube__.ttf +0 -0
  25. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/__init__.py +0 -0
  26. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/ds2482/__init__.py +0 -0
  27. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/ds2482/ds2482.py +0 -0
  28. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/ds2482/onewire.py +0 -0
  29. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/events.py +0 -0
  30. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/exceptions.py +0 -0
  31. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/ha_discovery.py +0 -0
  32. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/loader.py +0 -0
  33. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/logger.py +0 -0
  34. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/mqtt.py +0 -0
  35. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/oled.py +0 -0
  36. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/queue.py +0 -0
  37. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/state_manager.py +0 -0
  38. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/stats.py +0 -0
  39. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/timeperiod.py +0 -0
  40. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/util.py +0 -0
  41. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/helper/yaml_util.py +0 -0
  42. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/input/__init__.py +0 -0
  43. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/modbus.py +0 -0
  44. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/mqtt_client.py +0 -0
  45. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/oled.py +0 -0
  46. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/relay/__init__.py +0 -0
  47. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/relay/basic.py +0 -0
  48. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/relay/gpio.py +0 -0
  49. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/relay/mcp.py +0 -0
  50. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/runner.py +0 -0
  51. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/schema/actions.yaml +0 -0
  52. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/schema/actions_sensor.yaml +0 -0
  53. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/schema/actions_switch.yaml +0 -0
  54. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/schema/schema.yaml +0 -0
  55. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/__init__.py +0 -0
  56. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/adc.py +0 -0
  57. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/gpio.py +0 -0
  58. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/modbus/sdm120.json +0 -0
  59. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/modbus/sdm630.json +0 -0
  60. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/modbus/sofar.json +0 -0
  61. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/temp/__init__.py +0 -0
  62. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/temp/dallas.py +0 -0
  63. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/temp/lm75.py +0 -0
  64. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio/sensor/temp/mcp9808.py +0 -0
  65. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio.egg-info/SOURCES.txt +0 -0
  66. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio.egg-info/dependency_links.txt +0 -0
  67. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio.egg-info/entry_points.txt +0 -0
  68. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio.egg-info/requires.txt +0 -0
  69. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/boneio.egg-info/top_level.txt +0 -0
  70. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/requirements.txt +0 -0
  71. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/setup.cfg +0 -0
  72. {boneio-0.3.0.dev6 → boneio-0.3.0.dev7}/setup.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boneio
3
- Version: 0.3.0.dev6
3
+ Version: 0.3.0.dev7
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.dev6.zip
6
+ Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.3.0.dev7.zip
7
7
  License: GNU General Public License v3.0
8
8
  Platform: UNKNOWN
9
9
  Classifier: Programming Language :: Python
@@ -2,12 +2,13 @@
2
2
  from datetime import timedelta
3
3
 
4
4
  try:
5
- from Adafruit_BBIO.GPIO import HIGH, LOW, BOTH, FALLING
5
+ from Adafruit_BBIO.GPIO import HIGH, LOW, BOTH, FALLING, RISING
6
6
  except ModuleNotFoundError:
7
7
  HIGH = "high"
8
8
  LOW = "low"
9
9
  BOTH = "both"
10
10
  FALLING = "falling"
11
+ RISING = "rising"
11
12
  pass
12
13
  from typing_extensions import Literal
13
14
 
@@ -50,12 +51,6 @@ UARTS = {
50
51
  "uart4": {ID: "/dev/ttyS4", TX: "P9.13", RX: "P9.11"},
51
52
  }
52
53
 
53
- # TIMINGS FOR BUTTONS
54
- DEBOUNCE_DURATION = timedelta(seconds=0.2)
55
- LONG_PRESS_DURATION = timedelta(seconds=0.7)
56
- DELAY_DURATION = 0.1
57
- SECOND_DELAY_DURATION = 0.3
58
-
59
54
  # HA CONSTS
60
55
  HOMEASSISTANT = "homeassistant"
61
56
  HA_DISCOVERY = "ha_discovery"
@@ -9,8 +9,8 @@ mqtt:
9
9
  oled:
10
10
 
11
11
  lm75:
12
- id: temp
13
- address: 0x48
12
+ - id: temp
13
+ address: 0x48
14
14
 
15
15
  mcp23017:
16
16
  - id: mcp1
@@ -2,7 +2,7 @@ cover:
2
2
  - id: kitchen
3
3
  open_relay: test1
4
4
  close_relay: test2
5
- open_time: 20
6
- close_time: 22
5
+ open_time: 20s
6
+ close_time: 22s
7
7
  show_in_ha: yes
8
8
  restore_state: yes
@@ -2,6 +2,7 @@
2
2
  Module to provide basic config options.
3
3
  """
4
4
  from boneio.const import BONEIO, HOMEASSISTANT
5
+ from _collections_abc import dict_values
5
6
 
6
7
 
7
8
  class ConfigHelper:
@@ -14,6 +15,7 @@ class ConfigHelper:
14
15
  self._topic_prefix = topic_prefix
15
16
  self._ha_discovery = ha_discovery
16
17
  self._ha_discovery_prefix = ha_discovery_prefix
18
+ self._autodiscovery_messages = {}
17
19
 
18
20
  @property
19
21
  def topic_prefix(self) -> str:
@@ -34,3 +36,12 @@ class ConfigHelper:
34
36
  @property
35
37
  def subscribe_topic(self) -> str:
36
38
  return f"{self.cmd_topic_prefix}+/+/#"
39
+
40
+ def add_autodiscovery_msg(self, topic: str, payload: str):
41
+ """Add autodiscovery message."""
42
+ self._autodiscovery_messages[topic] = {"topic": topic, "payload": payload}
43
+
44
+ @property
45
+ def autodiscovery_msgs(self) -> dict_values:
46
+ """Get autodiscovery messages"""
47
+ return self._autodiscovery_messages.values()
@@ -97,7 +97,7 @@ class GpioBaseClass:
97
97
  self._pin = pin
98
98
  gpio = kwargs.get("rest_pin", {GPIO_MODE: GPIO_STR})
99
99
  gpio_mode = gpio.get(GPIO_MODE, GPIO_STR)
100
- self._bounce_time = gpio.get("bounce_time", TimePeriod(milliseconds=25))
100
+ self._bounce_time = gpio.get("bounce_time", TimePeriod(milliseconds=10))
101
101
  self._loop = asyncio.get_running_loop()
102
102
  self._press_callback = press_callback
103
103
  setup_input(pin=self._pin, pull_mode=gpio_mode)
@@ -1,19 +1,21 @@
1
1
  """GPIOInputButton to receive signals."""
2
2
  import logging
3
- from datetime import datetime
3
+ from datetime import datetime, timedelta
4
4
  from functools import partial
5
5
 
6
6
  from boneio.const import (
7
- DEBOUNCE_DURATION,
8
- DELAY_DURATION,
9
7
  DOUBLE,
10
8
  LONG,
11
- LONG_PRESS_DURATION,
12
- SECOND_DELAY_DURATION,
13
9
  SINGLE,
14
10
  )
15
11
  from boneio.helper import edge_detect, GpioBaseClass
16
12
 
13
+ # TIMINGS FOR BUTTONS
14
+ DEBOUNCE_DURATION = timedelta(microseconds=150000)
15
+ LONG_PRESS_DURATION = timedelta(microseconds=700000)
16
+ DELAY_DURATION = 0.08
17
+ SECOND_DELAY_DURATION = 0.14
18
+
17
19
  _LOGGER = logging.getLogger(__name__)
18
20
 
19
21
 
@@ -54,7 +56,6 @@ class GpioInputButton(GpioBaseClass):
54
56
  and now - self._second_press_timestamp < DEBOUNCE_DURATION
55
57
  ):
56
58
  return
57
-
58
59
  if not self._first_press_timestamp:
59
60
  self._first_press_timestamp = now
60
61
  elif not self._second_press_timestamp:
@@ -105,7 +106,7 @@ class GpioInputButton(GpioBaseClass):
105
106
  if self._second_check:
106
107
  if self._second_press_timestamp:
107
108
  _LOGGER.debug(
108
- "Double click event on pin %s, roznica %s",
109
+ "Double click event on pin %s, diff %s",
109
110
  self._pin,
110
111
  self._second_press_timestamp - self._first_press_timestamp,
111
112
  )
@@ -374,14 +374,14 @@ class Manager:
374
374
  if not self._config_helper.ha_discovery:
375
375
  return
376
376
  topic_prefix = topic_prefix or self._config_helper.topic_prefix
377
- msg = availability_msg_func(topic=topic_prefix, id=id, name=name, **kwargs)
377
+ payload = availability_msg_func(topic=topic_prefix, id=id, name=name, **kwargs)
378
378
  topic = f"{self._config_helper.ha_discovery_prefix}/{ha_type}/{topic_prefix}/{id}/config"
379
379
  _LOGGER.debug("Sending HA discovery for %s, %s.", ha_type, name)
380
- self._autodiscovery_messages.append({"topic": topic, "payload": msg})
381
- self.send_message(topic=topic, payload=msg, retain=True)
380
+ self._config_helper.add_autodiscovery_msg(topic=topic, payload=payload)
381
+ self.send_message(topic=topic, payload=payload, retain=True)
382
382
 
383
383
  def resend_autodiscovery(self):
384
- for msg in self._autodiscovery_messages:
384
+ for msg in self._config_helper.autodiscovery_msgs:
385
385
  self.send_message(**msg, retain=True)
386
386
 
387
387
  async def receive_message(self, topic: str, message: str) -> None:
@@ -122,20 +122,20 @@ class ModbusSensor(BasicMqtt):
122
122
  ) -> None:
123
123
  """Send HA autodiscovery information for each Modbus sensor."""
124
124
  _LOGGER.debug("Sending HA discovery for sensor %s %s.", sdm_name, sensor_id)
125
- self._send_message(
126
- topic=(
127
- f"{self._config_helper.ha_discovery_prefix}/{SENSOR}/{self._config_helper.topic_prefix}{id}"
128
- f"/{id}{sensor_id.replace('_', '').replace(' ', '').lower()}/config"
129
- ),
130
- payload=modbus_sensor_availabilty_message(
131
- topic=self._config_helper.topic_prefix,
132
- id=id,
133
- name=sdm_name,
134
- model=self._model,
135
- sensor_id=sensor_id,
136
- **kwargs,
137
- ),
125
+ topic = (
126
+ f"{self._config_helper.ha_discovery_prefix}/{SENSOR}/{self._config_helper.topic_prefix}{id}"
127
+ f"/{id}{sensor_id.replace('_', '').replace(' ', '').lower()}/config"
138
128
  )
129
+ payload = modbus_sensor_availabilty_message(
130
+ topic=self._config_helper.topic_prefix,
131
+ id=id,
132
+ name=sdm_name,
133
+ model=self._model,
134
+ sensor_id=sensor_id,
135
+ **kwargs,
136
+ )
137
+ self._config_helper.add_autodiscovery_msg(topic=topic, payload=payload)
138
+ self._send_message(topic=topic, payload=payload)
139
139
 
140
140
  def _send_discovery_for_all_registers(self, register: int = 0) -> bool:
141
141
  """Send discovery message to HA for each register."""
@@ -0,0 +1,2 @@
1
+ # flake8: noqa
2
+ __version__ = "0.3.0.dev7"
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boneio
3
- Version: 0.3.0.dev6
3
+ Version: 0.3.0.dev7
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.dev6.zip
6
+ Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.3.0.dev7.zip
7
7
  License: GNU General Public License v3.0
8
8
  Platform: UNKNOWN
9
9
  Classifier: Programming Language :: Python
@@ -1,2 +0,0 @@
1
- # flake8: noqa
2
- __version__ = "0.3.0.dev6"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes