boneio 0.3.0.dev8__tar.gz → 0.9.0.dev5__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 (166) hide show
  1. {boneio-0.3.0.dev8/boneio.egg-info → boneio-0.9.0.dev5}/PKG-INFO +8 -11
  2. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/README.md +1 -1
  3. boneio-0.9.0.dev5/boneio/boards/0.7/output_32_10.yaml +17 -0
  4. boneio-0.9.0.dev5/boneio/boards/0.8/input.yaml +110 -0
  5. boneio-0.9.0.dev5/boneio/boards/0.8/output_32_10.yaml +137 -0
  6. boneio-0.9.0.dev5/boneio/bonecli.py +334 -0
  7. boneio-0.9.0.dev5/boneio/const.py +217 -0
  8. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/cover.py +44 -22
  9. boneio-0.9.0.dev5/boneio/example_config/binary_sensor.yaml +21 -0
  10. boneio-0.9.0.dev5/boneio/example_config/binary_sensor_v_0_7.yaml +11 -0
  11. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/example_config/config.yaml +3 -2
  12. boneio-0.3.0.dev8/boneio/example_config/input.yaml → boneio-0.9.0.dev5/boneio/example_config/event.yaml +2 -20
  13. boneio-0.9.0.dev5/boneio/example_config/event_all.yaml +186 -0
  14. boneio-0.9.0.dev5/boneio/example_config/event_v_0_7.yaml +292 -0
  15. boneio-0.9.0.dev5/boneio/example_config/led32x4A.yaml +226 -0
  16. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/example_config/output24x16A.yaml +2 -2
  17. boneio-0.9.0.dev5/boneio/example_config/output24x16A_v0.3.yaml +143 -0
  18. boneio-0.9.0.dev5/boneio/example_config/output32x10A.yaml +192 -0
  19. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/example_config/output32x5A.yaml +50 -51
  20. boneio-0.9.0.dev5/boneio/group/__init__.py +4 -0
  21. boneio-0.9.0.dev5/boneio/group/output.py +83 -0
  22. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/helper/__init__.py +31 -24
  23. boneio-0.9.0.dev5/boneio/helper/async_updater.py +39 -0
  24. boneio-0.9.0.dev5/boneio/helper/click_timer.py +40 -0
  25. boneio-0.9.0.dev5/boneio/helper/config.py +97 -0
  26. boneio-0.9.0.dev5/boneio/helper/events.py +395 -0
  27. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/helper/exceptions.py +8 -0
  28. boneio-0.9.0.dev5/boneio/helper/filter.py +37 -0
  29. boneio-0.9.0.dev5/boneio/helper/gpio.py +235 -0
  30. boneio-0.9.0.dev5/boneio/helper/gpiod.py +56 -0
  31. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/helper/ha_discovery.py +61 -17
  32. boneio-0.9.0.dev5/boneio/helper/loader.py +597 -0
  33. boneio-0.9.0.dev5/boneio/helper/logger.py +158 -0
  34. boneio-0.9.0.dev5/boneio/helper/message_bus.py +83 -0
  35. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/helper/mqtt.py +14 -5
  36. boneio-0.9.0.dev5/boneio/helper/onewire/W1ThermSensor.py +73 -0
  37. boneio-0.9.0.dev5/boneio/helper/onewire/__init__.py +20 -0
  38. boneio-0.9.0.dev5/boneio/helper/onewire/onewire.py +91 -0
  39. boneio-0.9.0.dev5/boneio/helper/pcf8575.py +13 -0
  40. boneio-0.9.0.dev5/boneio/helper/sensor/ina_219_smbus.py +167 -0
  41. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/helper/state_manager.py +23 -5
  42. boneio-0.9.0.dev5/boneio/helper/stats.py +338 -0
  43. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/helper/timeperiod.py +7 -3
  44. boneio-0.9.0.dev5/boneio/helper/util.py +35 -0
  45. boneio-0.9.0.dev5/boneio/helper/yaml_util.py +518 -0
  46. boneio-0.9.0.dev5/boneio/input/__init__.py +7 -0
  47. boneio-0.9.0.dev5/boneio/input/gpio.py +78 -0
  48. boneio-0.9.0.dev5/boneio/input/gpio_new.py +87 -0
  49. boneio-0.9.0.dev5/boneio/manager.py +916 -0
  50. boneio-0.9.0.dev5/boneio/modbus/__init__.py +5 -0
  51. boneio-0.9.0.dev5/boneio/modbus/client.py +250 -0
  52. boneio-0.9.0.dev5/boneio/modbus/cwt.json +37 -0
  53. boneio-0.3.0.dev8/boneio/sensor/modbus/sdm630.json → boneio-0.9.0.dev5/boneio/modbus/dts1964_3f.json +77 -141
  54. boneio-0.9.0.dev5/boneio/modbus/liquid-sensor.json +37 -0
  55. boneio-0.9.0.dev5/boneio/modbus/modbuscli.py +308 -0
  56. boneio-0.9.0.dev5/boneio/modbus/orno-or-we-517.json +590 -0
  57. boneio-0.9.0.dev5/boneio/modbus/pt100.json +21 -0
  58. boneio-0.9.0.dev5/boneio/modbus/r4dcb08.json +97 -0
  59. boneio-0.9.0.dev5/boneio/modbus/sdm630.json +299 -0
  60. boneio-0.9.0.dev5/boneio/modbus/sensor.py +255 -0
  61. boneio-0.9.0.dev5/boneio/modbus/sht20.json +37 -0
  62. boneio-0.9.0.dev5/boneio/modbus/sht30.json +37 -0
  63. boneio-0.9.0.dev5/boneio/modbus/single_sensor.py +161 -0
  64. boneio-0.9.0.dev5/boneio/modbus/socomec_e03.json +103 -0
  65. boneio-0.9.0.dev5/boneio/modbus/socomec_e23.json +164 -0
  66. boneio-0.9.0.dev5/boneio/modbus/utils.py +73 -0
  67. boneio-0.9.0.dev5/boneio/models/__init__.py +45 -0
  68. boneio-0.9.0.dev5/boneio/models/files.py +16 -0
  69. boneio-0.9.0.dev5/boneio/models/logs.py +12 -0
  70. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/mqtt_client.py +120 -42
  71. boneio-0.9.0.dev5/boneio/oled.py +253 -0
  72. boneio-0.9.0.dev5/boneio/relay/__init__.py +7 -0
  73. boneio-0.9.0.dev5/boneio/relay/basic.py +161 -0
  74. boneio-0.9.0.dev5/boneio/relay/mcp.py +74 -0
  75. boneio-0.9.0.dev5/boneio/relay/pca.py +88 -0
  76. boneio-0.9.0.dev5/boneio/relay/pcf.py +78 -0
  77. boneio-0.9.0.dev5/boneio/runner.py +173 -0
  78. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/schema/actions.yaml +24 -12
  79. boneio-0.9.0.dev5/boneio/schema/actions_sensor.yaml +3 -0
  80. boneio-0.9.0.dev5/boneio/schema/actions_switch.yaml +3 -0
  81. boneio-0.9.0.dev5/boneio/schema/filters.yaml +11 -0
  82. boneio-0.9.0.dev5/boneio/schema/filters_adc.yaml +12 -0
  83. boneio-0.9.0.dev5/boneio/schema/id.yaml +4 -0
  84. boneio-0.9.0.dev5/boneio/schema/schema.yaml +916 -0
  85. boneio-0.9.0.dev5/boneio/schema/temp_unit.yaml +4 -0
  86. boneio-0.9.0.dev5/boneio/schema/update_interval.yaml +10 -0
  87. boneio-0.9.0.dev5/boneio/sensor/__init__.py +19 -0
  88. boneio-0.9.0.dev5/boneio/sensor/adc.py +52 -0
  89. boneio-0.9.0.dev5/boneio/sensor/gpio.py +37 -0
  90. boneio-0.9.0.dev5/boneio/sensor/gpio_new.py +52 -0
  91. boneio-0.9.0.dev5/boneio/sensor/ina219.py +125 -0
  92. boneio-0.9.0.dev5/boneio/sensor/temp/__init__.py +97 -0
  93. boneio-0.9.0.dev5/boneio/sensor/temp/dallas.py +89 -0
  94. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/sensor/temp/lm75.py +3 -1
  95. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/sensor/temp/mcp9808.py +3 -1
  96. boneio-0.9.0.dev5/boneio/version.py +2 -0
  97. boneio-0.9.0.dev5/boneio/webui/app.py +880 -0
  98. boneio-0.9.0.dev5/boneio/webui/frontend-dist/assets/css.worker-YzWC8yAR.js +84 -0
  99. boneio-0.9.0.dev5/boneio/webui/frontend-dist/assets/editor.worker-D5ngByhL.js +12 -0
  100. boneio-0.9.0.dev5/boneio/webui/frontend-dist/assets/html.worker-D5NPIcdM.js +461 -0
  101. boneio-0.9.0.dev5/boneio/webui/frontend-dist/assets/index-ONryNrjG.js +72 -0
  102. boneio-0.9.0.dev5/boneio/webui/frontend-dist/assets/index-gnyFMRqm.css +1 -0
  103. boneio-0.9.0.dev5/boneio/webui/frontend-dist/assets/json.worker-F0ZGA5Zk.js +49 -0
  104. boneio-0.9.0.dev5/boneio/webui/frontend-dist/assets/ts.worker-BSchkg-h.js +51334 -0
  105. boneio-0.9.0.dev5/boneio/webui/frontend-dist/boneio.svg +1 -0
  106. boneio-0.9.0.dev5/boneio/webui/frontend-dist/boneio_fav.svg +40 -0
  107. boneio-0.9.0.dev5/boneio/webui/frontend-dist/index.html +14 -0
  108. boneio-0.9.0.dev5/boneio/webui/web_server.py +118 -0
  109. boneio-0.9.0.dev5/boneio/webui/websocket_manager.py +142 -0
  110. boneio-0.9.0.dev5/pyproject.toml +93 -0
  111. boneio-0.9.0.dev5/tests/32_5_config.yaml +11 -0
  112. boneio-0.9.0.dev5/tests/bandit.yaml +21 -0
  113. boneio-0.9.0.dev5/tests/relay_32_5.py +38 -0
  114. boneio-0.3.0.dev8/MANIFEST.in +0 -6
  115. boneio-0.3.0.dev8/PKG-INFO +0 -39
  116. boneio-0.3.0.dev8/boneio/bonecli.py +0 -110
  117. boneio-0.3.0.dev8/boneio/const.py +0 -137
  118. boneio-0.3.0.dev8/boneio/helper/config.py +0 -47
  119. boneio-0.3.0.dev8/boneio/helper/ds2482/__init__.py +0 -10
  120. boneio-0.3.0.dev8/boneio/helper/ds2482/onewire.py +0 -44
  121. boneio-0.3.0.dev8/boneio/helper/events.py +0 -176
  122. boneio-0.3.0.dev8/boneio/helper/gpio.py +0 -108
  123. boneio-0.3.0.dev8/boneio/helper/loader.py +0 -392
  124. boneio-0.3.0.dev8/boneio/helper/logger.py +0 -51
  125. boneio-0.3.0.dev8/boneio/helper/stats.py +0 -186
  126. boneio-0.3.0.dev8/boneio/helper/util.py +0 -15
  127. boneio-0.3.0.dev8/boneio/helper/yaml_util.py +0 -306
  128. boneio-0.3.0.dev8/boneio/input/__init__.py +0 -5
  129. boneio-0.3.0.dev8/boneio/input/gpio.py +0 -127
  130. boneio-0.3.0.dev8/boneio/manager.py +0 -461
  131. boneio-0.3.0.dev8/boneio/modbus.py +0 -117
  132. boneio-0.3.0.dev8/boneio/oled.py +0 -142
  133. boneio-0.3.0.dev8/boneio/relay/__init__.py +0 -5
  134. boneio-0.3.0.dev8/boneio/relay/basic.py +0 -97
  135. boneio-0.3.0.dev8/boneio/relay/mcp.py +0 -89
  136. boneio-0.3.0.dev8/boneio/runner.py +0 -82
  137. boneio-0.3.0.dev8/boneio/schema/actions_sensor.yaml +0 -6
  138. boneio-0.3.0.dev8/boneio/schema/actions_switch.yaml +0 -6
  139. boneio-0.3.0.dev8/boneio/schema/schema.yaml +0 -497
  140. boneio-0.3.0.dev8/boneio/sensor/__init__.py +0 -15
  141. boneio-0.3.0.dev8/boneio/sensor/adc.py +0 -50
  142. boneio-0.3.0.dev8/boneio/sensor/gpio.py +0 -37
  143. boneio-0.3.0.dev8/boneio/sensor/modbus/__init__.py +0 -238
  144. boneio-0.3.0.dev8/boneio/sensor/temp/__init__.py +0 -76
  145. boneio-0.3.0.dev8/boneio/sensor/temp/dallas.py +0 -43
  146. boneio-0.3.0.dev8/boneio/version.py +0 -2
  147. boneio-0.3.0.dev8/boneio.egg-info/SOURCES.txt +0 -69
  148. boneio-0.3.0.dev8/boneio.egg-info/dependency_links.txt +0 -1
  149. boneio-0.3.0.dev8/boneio.egg-info/entry_points.txt +0 -2
  150. boneio-0.3.0.dev8/boneio.egg-info/requires.txt +0 -23
  151. boneio-0.3.0.dev8/boneio.egg-info/top_level.txt +0 -1
  152. boneio-0.3.0.dev8/requirements.txt +0 -41
  153. boneio-0.3.0.dev8/setup.cfg +0 -4
  154. boneio-0.3.0.dev8/setup.py +0 -57
  155. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/LICENSE +0 -0
  156. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/__init__.py +0 -0
  157. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/example_config/__init__.py +0 -0
  158. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/example_config/adc.yaml +6 -6
  159. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/example_config/cover.yaml +0 -0
  160. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/fonts/danube__.ttf +0 -0
  161. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/helper/oled.py +0 -0
  162. {boneio-0.3.0.dev8/boneio/helper/ds2482 → boneio-0.9.0.dev5/boneio/helper/onewire}/ds2482.py +0 -0
  163. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/helper/queue.py +0 -0
  164. {boneio-0.3.0.dev8/boneio/sensor → boneio-0.9.0.dev5/boneio}/modbus/sdm120.json +0 -0
  165. {boneio-0.3.0.dev8/boneio/sensor → boneio-0.9.0.dev5/boneio}/modbus/sofar.json +0 -0
  166. {boneio-0.3.0.dev8 → boneio-0.9.0.dev5}/boneio/relay/gpio.py +1 -1
@@ -1,17 +1,15 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boneio
3
- Version: 0.3.0.dev8
3
+ Version: 0.9.0.dev5
4
4
  Summary: Python App for BoneIO
5
- Home-page: https://github.com/boneIO-eu/app_bbb
6
- Download-URL: https://github.com/boneIO-eu/app_bbb/archive/0.3.0.dev8.zip
7
5
  License: GNU General Public License v3.0
8
- Platform: UNKNOWN
9
- Classifier: Programming Language :: Python
10
- Classifier: Programming Language :: Python :: 3.7
11
- Classifier: Programming Language :: Python :: 3.8
12
- Classifier: Programming Language :: Python :: 3.9
6
+ Author-email: Paweł Szafer <pszafer@gmail.com>
7
+ Requires-Python: >=3.7
8
+ Project-URL: Changelog, https://github.com/boneIO-eu/app_bbb/releases
9
+ Project-URL: Documentation, https://boneio.eu/docs/intro/
10
+ Project-URL: Homepage, https://boneio.eu
11
+ Project-URL: Repository, https://github.com/boneIO-eu/app_bbb
13
12
  Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
13
 
16
14
  Example usage:
17
15
  boneio run -dd -c config.yaml
@@ -19,7 +17,7 @@ boneio run -dd -c config.yaml
19
17
  # Installation instructions
20
18
 
21
19
  ```
22
- sudo apt-get install libopenjp2-7-dev libatlas-base-dev python3-venv
20
+ sudo apt-get install libopenjp2-7-dev libatlas-base-dev python3-venv libjpeg-dev zlib1g-dev
23
21
  mkdir ~/boneio
24
22
  python3 -m venv ~/boneio/venv
25
23
  source ~/boneio/venv/bin/activate
@@ -36,4 +34,3 @@ source ~/boneio/venv/bin/activate
36
34
  boneio run -c ~/boneio/config.yaml -dd
37
35
  ```
38
36
 
39
-
@@ -4,7 +4,7 @@ boneio run -dd -c config.yaml
4
4
  # Installation instructions
5
5
 
6
6
  ```
7
- sudo apt-get install libopenjp2-7-dev libatlas-base-dev python3-venv
7
+ sudo apt-get install libopenjp2-7-dev libatlas-base-dev python3-venv libjpeg-dev zlib1g-dev
8
8
  mkdir ~/boneio
9
9
  python3 -m venv ~/boneio/venv
10
10
  source ~/boneio/venv/bin/activate
@@ -0,0 +1,17 @@
1
+ mcp23017:
2
+ - id: mcp1
3
+ address: 0x20
4
+ - id: mcp2
5
+ address: 0x21
6
+
7
+ output_mapping:
8
+ out_01:
9
+ kind: mcp
10
+ mcp_id: mcp2
11
+ pin: 7
12
+ output_type: light
13
+ out_02:
14
+ kind: mcp
15
+ mcp_id: mcp2
16
+ pin: 6
17
+ output_type: light
@@ -0,0 +1,110 @@
1
+ input_mapping:
2
+ in_01:
3
+ pin: P8_37
4
+ gpio_mode: gpio_pu
5
+ in_02:
6
+ pin: P8_38
7
+ gpio_mode: gpio_pu
8
+ in_03:
9
+ pin: P8_39
10
+ in_04:
11
+ pin: P8_40
12
+ in_05:
13
+ pin: P8_41
14
+ in_06:
15
+ pin: P8_42
16
+ in_07:
17
+ pin: P8_43
18
+ in_08:
19
+ pin: P8_44
20
+ in_09:
21
+ pin: P8_45
22
+ in_10:
23
+ pin: P8_46
24
+ gpio_mode: gpio_pu
25
+ in_11:
26
+ pin: P9_42
27
+ in_12:
28
+ pin: P9_31
29
+ in_13:
30
+ pin: P9_30
31
+ in_14:
32
+ pin: P9_29
33
+ in_15:
34
+ pin: P9_28
35
+ in_16:
36
+ pin: P9_27
37
+ in_17:
38
+ pin: P9_25
39
+ in_18:
40
+ pin: P9_23
41
+ in_19:
42
+ pin: P9_22
43
+ gpio_mode: gpio_pu
44
+ in_20:
45
+ pin: P9_21
46
+ gpio_mode: gpio_pu
47
+ in_21:
48
+ pin: P9_18
49
+ in_22:
50
+ pin: P9_17
51
+ in_23:
52
+ pin: P9_16
53
+ in_24:
54
+ pin: P9_15
55
+ in_25:
56
+ pin: P9_14
57
+ in_26:
58
+ pin: P8_7
59
+ in_27:
60
+ pin: P8_8
61
+ in_28:
62
+ pin: P8_9
63
+ in_29:
64
+ pin: P8_36
65
+ gpio_mode: gpio_pu
66
+ in_30:
67
+ pin: P8_35
68
+ gpio_mode: gpio_pu
69
+ in_31:
70
+ pin: P8_34
71
+ gpio_mode: gpio_pu
72
+ in_32:
73
+ pin: P8_33
74
+ gpio_mode: gpio_pu
75
+ in_33:
76
+ pin: P8_32
77
+ gpio_mode: gpio_pu
78
+ in_34:
79
+ pin: P8_31
80
+ gpio_mode: gpio_pu
81
+ in_35:
82
+ pin: P8_30
83
+ in_36:
84
+ pin: P8_29
85
+ in_37:
86
+ pin: P8_28
87
+ in_38:
88
+ pin: P8_27
89
+ in_39:
90
+ pin: P8_26
91
+ in_40:
92
+ pin: P8_19
93
+ in_41:
94
+ pin: P8_18
95
+ in_42:
96
+ pin: P8_17
97
+ in_43:
98
+ pin: P8_16
99
+ in_44:
100
+ pin: P8_15
101
+ in_45:
102
+ pin: P8_14
103
+ in_46:
104
+ pin: P8_13
105
+ in_47:
106
+ pin: P8_12
107
+ in_48:
108
+ pin: P8_11
109
+ in_49:
110
+ pin: P8_10
@@ -0,0 +1,137 @@
1
+ mcp23017:
2
+ - id: mcp1
3
+ address: 0x23
4
+ - id: mcp2
5
+ address: 0x24
6
+
7
+ output_mapping:
8
+ out_01:
9
+ kind: mcp
10
+ mcp_id: mcp2
11
+ pin: 7
12
+ out_02:
13
+ kind: mcp
14
+ mcp_id: mcp2
15
+ pin: 6
16
+ out_03:
17
+ kind: mcp
18
+ mcp_id: mcp2
19
+ pin: 5
20
+ out_04:
21
+ kind: mcp
22
+ mcp_id: mcp2
23
+ pin: 4
24
+ out_05:
25
+ kind: mcp
26
+ mcp_id: mcp2
27
+ pin: 3
28
+ out_06:
29
+ kind: mcp
30
+ mcp_id: mcp2
31
+ pin: 2
32
+ out_07:
33
+ kind: mcp
34
+ mcp_id: mcp2
35
+ pin: 1
36
+ out_08:
37
+ kind: mcp
38
+ mcp_id: mcp2
39
+ pin: 0
40
+ out_09:
41
+ kind: mcp
42
+ mcp_id: mcp1
43
+ pin: 7
44
+ out_10:
45
+ kind: mcp
46
+ mcp_id: mcp1
47
+ pin: 6
48
+ out_11:
49
+ kind: mcp
50
+ mcp_id: mcp1
51
+ pin: 5
52
+ out_12:
53
+ kind: mcp
54
+ mcp_id: mcp1
55
+ pin: 4
56
+ out_13:
57
+ kind: mcp
58
+ mcp_id: mcp1
59
+ pin: 3
60
+ out_14:
61
+ kind: mcp
62
+ mcp_id: mcp1
63
+ pin: 2
64
+ out_15:
65
+ kind: mcp
66
+ mcp_id: mcp1
67
+ pin: 1
68
+ out_16:
69
+ kind: mcp
70
+ mcp_id: mcp1
71
+ pin: 0
72
+ out_17:
73
+ kind: mcp
74
+ mcp_id: mcp2
75
+ pin: 8
76
+ out_18:
77
+ kind: mcp
78
+ mcp_id: mcp2
79
+ pin: 9
80
+ out_19:
81
+ kind: mcp
82
+ mcp_id: mcp2
83
+ pin: 10
84
+ out_20:
85
+ kind: mcp
86
+ mcp_id: mcp2
87
+ pin: 11
88
+ out_21:
89
+ kind: mcp
90
+ mcp_id: mcp2
91
+ pin: 12
92
+ out_22:
93
+ kind: mcp
94
+ mcp_id: mcp2
95
+ pin: 13
96
+ out_23:
97
+ kind: mcp
98
+ mcp_id: mcp2
99
+ pin: 14
100
+ out_24:
101
+ kind: mcp
102
+ mcp_id: mcp2
103
+ pin: 15
104
+ out_25:
105
+ kind: mcp
106
+ mcp_id: mcp1
107
+ pin: 8
108
+ out_26:
109
+ kind: mcp
110
+ mcp_id: mcp1
111
+ pin: 9
112
+ out_27:
113
+ kind: mcp
114
+ mcp_id: mcp1
115
+ pin: 10
116
+ out_28:
117
+ kind: mcp
118
+ mcp_id: mcp1
119
+ pin: 11
120
+ out_29:
121
+ kind: mcp
122
+ mcp_id: mcp1
123
+ pin: 12
124
+ out_30:
125
+ kind: mcp
126
+ mcp_id: mcp1
127
+ pin: 13
128
+ out_31:
129
+ kind: mcp
130
+ mcp_id: mcp1
131
+ pin: 14
132
+ out_32:
133
+ kind: mcp
134
+ mcp_id: mcp1
135
+ pin: 15
136
+
137
+
@@ -0,0 +1,334 @@
1
+ """Bonecli script."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ import os
7
+
8
+ os.environ["W1THERMSENSOR_NO_KERNEL_MODULE"] = "1"
9
+
10
+ import argparse
11
+ import asyncio
12
+ import sys
13
+
14
+ from yaml import MarkedYAMLError
15
+
16
+ from boneio.const import ACTION
17
+ from boneio.helper import load_config_from_file
18
+ from boneio.helper.events import GracefulExit
19
+ from boneio.helper.exceptions import (
20
+ ConfigurationException,
21
+ RestartRequestException,
22
+ )
23
+ from boneio.helper.logger import configure_logger, setup_logging
24
+ from boneio.modbus.client import VALUE_TYPES
25
+ from boneio.modbus.modbuscli import (
26
+ async_run_modbus_get,
27
+ async_run_modbus_search,
28
+ async_run_modbus_set,
29
+ )
30
+ from boneio.runner import async_run
31
+ from boneio.version import __version__
32
+
33
+ TASK_CANCELATION_TIMEOUT = 1
34
+
35
+ _LOGGER = logging.getLogger(__name__)
36
+
37
+
38
+
39
+
40
+
41
+ def get_arguments() -> argparse.Namespace:
42
+ """Get parsed passed in arguments."""
43
+
44
+ parser = argparse.ArgumentParser(
45
+ description="boneIO app for BeagleBone Black.",
46
+ )
47
+ subparsers = parser.add_subparsers(dest=ACTION, required=True)
48
+ run_parser = subparsers.add_parser("run")
49
+ run_parser.add_argument(
50
+ "--debug",
51
+ "-d",
52
+ action="count",
53
+ help="Start boneIO in debug mode",
54
+ default=0,
55
+ )
56
+ run_parser.add_argument(
57
+ "-c",
58
+ "--config",
59
+ metavar="path_to_config_dir",
60
+ default="./config.yaml",
61
+ help="File which contains boneIO configuration",
62
+ )
63
+ run_parser.add_argument(
64
+ "--mqttusername",
65
+ help="Mqtt username to use if you don't want provide in file.",
66
+ )
67
+ run_parser.add_argument(
68
+ "--mqttpassword",
69
+ help="Mqtt password to use if you don't want provide in file.",
70
+ )
71
+ modbus_parser = subparsers.add_parser("modbus")
72
+ modbus_parser.add_argument(
73
+ "--debug",
74
+ "-d",
75
+ action="count",
76
+ help="Start boneIO in debug mode",
77
+ default=0,
78
+ )
79
+ modbus_parser.add_argument(
80
+ "--uart",
81
+ type=str,
82
+ choices=["uart1", "uart4"],
83
+ help="Choose UART",
84
+ required=True,
85
+ )
86
+ modbus_parser.add_argument(
87
+ "--address",
88
+ type=lambda x: int(x, 0),
89
+ required=False,
90
+ default=1,
91
+ help="Current device address (hex or integer)",
92
+ )
93
+ modbus_parser.add_argument(
94
+ "--baudrate",
95
+ type=int,
96
+ choices=[1200, 2400, 4800, 9600, 14400, 19200],
97
+ required=True,
98
+ help="Current baudrate",
99
+ )
100
+
101
+ modbus_parser.add_argument(
102
+ "--bytesize",
103
+ type=int,
104
+ required=False,
105
+ default=8,
106
+ help="Bytesize",
107
+ )
108
+
109
+ modbus_parser.add_argument(
110
+ "--stopbits",
111
+ type=int,
112
+ required=False,
113
+ default=1,
114
+ help="stopbits",
115
+ )
116
+
117
+ modbus_parser.add_argument(
118
+ "--parity",
119
+ type=str,
120
+ choices=["P", "E", "N"],
121
+ default="N",
122
+ required=False,
123
+ help="Parity",
124
+ )
125
+
126
+ modbus_sub_parser = modbus_parser.add_subparsers(
127
+ dest="modbus_action", required=True
128
+ )
129
+ set_modbus_parser = modbus_sub_parser.add_parser("set")
130
+ set_modbus_parser.add_argument(
131
+ "--custom-value",
132
+ type=int,
133
+ help="Set Custom value",
134
+ )
135
+ set_modbus_parser.add_argument(
136
+ "--custom-register-address",
137
+ type=int,
138
+ help="Register address for custom value",
139
+ )
140
+ set_modbus_parser.add_argument(
141
+ "--device",
142
+ type=str,
143
+ choices=["cwt", "r4dcb08", "liquid-sensor", "sht20", "sht30", "custom"],
144
+ help="Choose device to set modbus address/baudrate. For custom you must provide --custom-value and --custom-register-address",
145
+ required=True,
146
+ )
147
+ set_modbus_parser_group = set_modbus_parser.add_mutually_exclusive_group()
148
+ set_modbus_parser_group.add_argument(
149
+ "--new-address",
150
+ type=lambda x: int(x, 0),
151
+ help="Set new address (hex or integer / 1 - 253/)",
152
+ )
153
+
154
+ set_modbus_parser_group.add_argument(
155
+ "--new-baudrate",
156
+ type=int,
157
+ choices=[1200, 2400, 4800, 9600, 19200],
158
+ help="Choose new baudrate to set. CWT doesn't work on 1200.",
159
+ )
160
+
161
+ get_modbus_parser = modbus_sub_parser.add_parser("get")
162
+ register_group = get_modbus_parser.add_mutually_exclusive_group(required=True)
163
+ register_group.add_argument(
164
+ "--register-address",
165
+ type=int,
166
+ help="Single register address to read",
167
+ )
168
+ register_group.add_argument(
169
+ "--register-range",
170
+ type=str,
171
+ help="Register address range in format 'start-stop' (e.g., '1-230')",
172
+ )
173
+ get_modbus_parser.add_argument(
174
+ "--register-type",
175
+ type=str,
176
+ choices=["input", "holding"],
177
+ help="Register type",
178
+ required=True,
179
+ )
180
+ get_modbus_parser.add_argument(
181
+ "--value-type",
182
+ type=str,
183
+ choices=VALUE_TYPES.keys(),
184
+ help="Value types",
185
+ required=True,
186
+ )
187
+ search_modbus_parser = modbus_sub_parser.add_parser(
188
+ name="search",
189
+ help="Search for device. Iterate over every address 1-253 with provided register address",
190
+ )
191
+ search_modbus_parser.add_argument(
192
+ "--register-address",
193
+ type=int,
194
+ help="Register address",
195
+ required=True,
196
+ )
197
+ search_modbus_parser.add_argument(
198
+ "--register-type",
199
+ type=str,
200
+ choices=["input", "holding"],
201
+ help="Register type",
202
+ required=True,
203
+ )
204
+ parser.add_argument("--version", action="version", version=__version__)
205
+ arguments = parser.parse_args()
206
+
207
+ return arguments
208
+
209
+
210
+ def run(
211
+ config: str, debug: int, mqttusername: str = "", mqttpassword: str = ""
212
+ ) -> int:
213
+ """Run BoneIO."""
214
+ setup_logging(debug_level=debug)
215
+ _LOGGER.info("BoneIO %s starting.", __version__)
216
+ try:
217
+ _config = load_config_from_file(config_file=config)
218
+ if not _config:
219
+ _LOGGER.error("Config not loaded. Exiting.")
220
+ return 1
221
+ configure_logger(log_config=_config.get("logger"), debug=debug)
222
+ ret = asyncio.run(
223
+ async_run(
224
+ config=_config,
225
+ config_file=config,
226
+ mqttusername=mqttusername,
227
+ mqttpassword=mqttpassword,
228
+ debug=debug,
229
+ ),
230
+ )
231
+ _LOGGER.info("BoneIO %s exiting.", __version__)
232
+ return ret
233
+ except KeyboardInterrupt:
234
+ return 0
235
+ except GracefulExit as err:
236
+ if err is not None:
237
+ _LOGGER.info("Message: %s", err)
238
+ return 0
239
+ except (ConfigurationException, MarkedYAMLError) as err:
240
+ _LOGGER.error("Failed to load config. %s Exiting.", err)
241
+ return 1
242
+
243
+
244
+ def run_modbus_command(
245
+ args: argparse.Namespace,
246
+ ) -> int:
247
+ """Run BoneIO."""
248
+ setup_logging(debug_level=args.debug)
249
+ _LOGGER.info("BoneIO %s starting.", __version__)
250
+ try:
251
+ configure_logger(log_config={}, debug=args.debug)
252
+ ret = 0
253
+ if args.modbus_action == "set":
254
+ ret = asyncio.run(
255
+ async_run_modbus_set(
256
+ device=args.device,
257
+ uart=args.uart,
258
+ address=args.address,
259
+ baudrate=args.baudrate,
260
+ parity=args.parity,
261
+ bytesize=args.bytesize,
262
+ stopbits=args.stopbits,
263
+ new_baudrate=args.new_baudrate,
264
+ new_address=args.new_address,
265
+ custom_address=args.custom_register_address,
266
+ custom_value=args.custom_value,
267
+ ),
268
+ )
269
+ elif args.modbus_action == "get":
270
+ ret = asyncio.run(
271
+ async_run_modbus_get(
272
+ uart=args.uart,
273
+ device_address=args.address,
274
+ baudrate=args.baudrate,
275
+ register_address=args.register_address,
276
+ register_type=args.register_type,
277
+ parity=args.parity,
278
+ bytesize=args.bytesize,
279
+ stopbits=args.stopbits,
280
+ value_type=args.value_type,
281
+ register_range=args.register_range,
282
+ ),
283
+ )
284
+ else:
285
+ ret = asyncio.run(
286
+ async_run_modbus_search(
287
+ uart=args.uart,
288
+ baudrate=args.baudrate,
289
+ register_address=args.register_address,
290
+ register_type=args.register_type,
291
+ stopbits=args.stopbits,
292
+ bytesize=args.bytesize,
293
+ parity=args.parity,
294
+ ),
295
+ )
296
+ return ret
297
+ except (RestartRequestException, GracefulExit) as err:
298
+ if err is not None:
299
+ _LOGGER.info(err)
300
+ return 0
301
+ except (ConfigurationException, MarkedYAMLError) as err:
302
+ _LOGGER.error("Failed to load config. %s Exiting.", err)
303
+ return 1
304
+
305
+
306
+ def main() -> int:
307
+ """Start boneIO."""
308
+
309
+ args = get_arguments()
310
+ debug = args.debug
311
+
312
+ exit_code = 0
313
+ if args.action == "run":
314
+ exit_code = run(
315
+ config=args.config,
316
+ mqttusername=args.mqttusername,
317
+ mqttpassword=args.mqttpassword,
318
+ debug=debug,
319
+ )
320
+ elif args.action == "modbus":
321
+ _LOGGER.info("BoneIO Modbus helper %s .", __version__)
322
+ exit_code = run_modbus_command(
323
+ args=args,
324
+ )
325
+
326
+ if exit_code == 0:
327
+ _LOGGER.info("Exiting with exit code %s", exit_code)
328
+ else:
329
+ _LOGGER.error("Exiting with exit code %s", exit_code)
330
+ return exit_code
331
+
332
+
333
+ if __name__ == "__main__":
334
+ sys.exit(main())