boneIO 0.5.0dev7__tar.gz → 0.5.0dev8__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.
Potentially problematic release.
This version of boneIO might be problematic. Click here for more details.
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/PKG-INFO +1 -1
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/modbus/__init__.py +25 -27
- boneIO-0.5.0.dev8/boneio/sensor/modbus/pt100.json +21 -0
- boneIO-0.5.0.dev8/boneio/version.py +2 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/pyproject.toml +1 -1
- boneIO-0.5.0.dev7/boneio/version.py +0 -2
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/LICENSE +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/README.md +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/__init__.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/bonecli.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/const.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/cover.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/example_config/__init__.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/example_config/adc.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/example_config/config.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/example_config/cover.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/example_config/input.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/example_config/output24x16A.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/example_config/output32x5A.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/fonts/danube__.ttf +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/__init__.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/async_updater.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/config.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/events.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/exceptions.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/filter.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/gpio.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/ha_discovery.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/loader.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/logger.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/mqtt.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/oled.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/onewire/W1ThermSensor.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/onewire/__init__.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/onewire/ds2482.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/onewire/onewire.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/queue.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/state_manager.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/stats.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/timeperiod.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/util.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/helper/yaml_util.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/input/__init__.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/input/gpio.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/manager.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/modbus.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/mqtt_client.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/oled.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/relay/__init__.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/relay/basic.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/relay/gpio.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/relay/mcp.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/runner.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/schema/actions.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/schema/actions_sensor.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/schema/actions_switch.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/schema/filters.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/schema/filters_adc.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/schema/schema.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/schema/update_interval.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/__init__.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/adc.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/gpio.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/modbus/sdm120.json +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/modbus/sdm630.json +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/modbus/sofar.json +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/temp/__init__.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/temp/dallas.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/temp/lm75.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/boneio/sensor/temp/mcp9808.py +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/tests/32_5_config.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/tests/bandit.yaml +0 -0
- {boneIO-0.5.0.dev7 → boneIO-0.5.0.dev8}/tests/relay_32_5.py +0 -0
|
@@ -143,33 +143,28 @@ class ModbusSensor(BasicMqtt, AsyncUpdater):
|
|
|
143
143
|
|
|
144
144
|
def _send_discovery_for_all_registers(self, register: int = 0) -> bool:
|
|
145
145
|
"""Send discovery message to HA for each register."""
|
|
146
|
-
|
|
147
|
-
for
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
self.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return datetime.now()
|
|
169
|
-
_LOGGER.error(
|
|
170
|
-
"Discovery for %s not sent. First register not available.", self._id
|
|
171
|
-
)
|
|
172
|
-
return False
|
|
146
|
+
for data in self._db[REGISTERS_BASE]:
|
|
147
|
+
for register in data[REGISTERS]:
|
|
148
|
+
value_template = (
|
|
149
|
+
f'{{{{ value_json.{register.get("name").replace(" ", "")} | '
|
|
150
|
+
f'{register.get("ha_filter", "round(2)")} }}}}'
|
|
151
|
+
)
|
|
152
|
+
kwargs = {
|
|
153
|
+
"unit_of_measurement": register.get("unit_of_measurement"),
|
|
154
|
+
"state_class": register.get("state_class"),
|
|
155
|
+
"value_template": value_template,
|
|
156
|
+
"sensor_id": register.get("name"),
|
|
157
|
+
}
|
|
158
|
+
device_class = register.get("device_class")
|
|
159
|
+
if device_class:
|
|
160
|
+
kwargs["device_class"] = device_class
|
|
161
|
+
self._send_ha_autodiscovery(
|
|
162
|
+
id=self._id,
|
|
163
|
+
sdm_name=self._name,
|
|
164
|
+
state_topic_base=data[BASE],
|
|
165
|
+
**kwargs,
|
|
166
|
+
)
|
|
167
|
+
return datetime.now()
|
|
173
168
|
|
|
174
169
|
async def check_availability(self) -> None:
|
|
175
170
|
"""Get first register and check if it's available."""
|
|
@@ -193,6 +188,9 @@ class ModbusSensor(BasicMqtt, AsyncUpdater):
|
|
|
193
188
|
)
|
|
194
189
|
await asyncio.sleep(2)
|
|
195
190
|
break
|
|
191
|
+
_LOGGER.error(
|
|
192
|
+
"Discovery for %s not sent. First register not available.", self._id
|
|
193
|
+
)
|
|
196
194
|
|
|
197
195
|
async def async_update(self, time: datetime) -> None:
|
|
198
196
|
"""Fetch state periodically and send to MQTT."""
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"model": "PT100",
|
|
3
|
+
"registers_base": [
|
|
4
|
+
{
|
|
5
|
+
"base": 1,
|
|
6
|
+
"length": 1,
|
|
7
|
+
"register_type": "holding",
|
|
8
|
+
"registers": [
|
|
9
|
+
{
|
|
10
|
+
"name": "Temperature1 PT100",
|
|
11
|
+
"address": 1,
|
|
12
|
+
"unit_of_measurement": "°C",
|
|
13
|
+
"state_class": "measurement",
|
|
14
|
+
"device_class": "temperature",
|
|
15
|
+
"return_type": "multiply0_1"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
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
|