1234567891011 |
- # https://github.com/fphammerle/wireless-sensor-mqtt/blob/v0.3.0/wireless_sensor_mqtt/_homeassistant.py
- # https://github.com/fphammerle/systemctl-mqtt/blob/v0.5.0/systemctl_mqtt/_homeassistant.py
- import re
- # https://www.home-assistant.io/docs/mqtt/discovery/#discovery_prefix
- OBJECT_ID_ALLOWED_CHARS = r"a-zA-Z0-9_-"
- def validate_object_id(object_id: str) -> bool:
- return re.match(r"^[{}]+$".format(OBJECT_ID_ALLOWED_CHARS), object_id) is not None
|