Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 6, 2024
1 parent 68fa5c2 commit 4e1b4c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion HADiscovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

from HCSocket import now


def decamelcase(str):
split = re.findall(r"[A-Z](?:[a-z]+|[A-Z]*(?=[A-Z]|$))", str)
return f"{split[0]} {' '.join(split[1:]).lower()}".strip()


HA_DISCOVERY_PREFIX = "homeassistant"

# These "magic overrides" provide HA MQTT autodiscovery data that is injected
Expand Down Expand Up @@ -179,7 +181,7 @@ def publish_ha_discovery(device, client, mqtt_topic):
for feature in device["features"].values():
name_parts = feature["name"].split(".")
name = feature["name"]
feature_id = name.lower().replace('.','_')
feature_id = name.lower().replace(".", "_")
feature_type = name_parts[-2]
access = feature.get("access", "none")
available = feature.get("available", False)
Expand Down

0 comments on commit 4e1b4c4

Please sign in to comment.