Skip to content

Commit

Permalink
HACS update - Mold, Alexa & Shellies discovery #16
Browse files Browse the repository at this point in the history
  • Loading branch information
BeardedTinker committed Nov 7, 2023
1 parent 4668b1a commit 3a760b1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
2 changes: 1 addition & 1 deletion custom_components/alexa_media/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
PERCENTAGE,
)

__version__ = "4.6.5"
__version__ = "4.7.9"
PROJECT_URL = "https://github.com/custom-components/alexa_media_player/"
ISSUE_URL = f"{PROJECT_URL}issues"
NOTIFY_URL = f"{PROJECT_URL}wiki/Configuration%3A-Notification-Component#use-the-notifyalexa_media-service"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/alexa_media/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/custom-components/alexa_media_player/issues",
"loggers": ["alexapy", "authcaptureproxy"],
"requirements": ["alexapy==1.27.6", "packaging>=20.3", "wrapt>=1.14.0"],
"version": "4.6.5"
"requirements": ["alexapy==1.27.8", "packaging>=20.3", "wrapt>=1.14.0"],
"version": "4.7.9"
}
2 changes: 1 addition & 1 deletion custom_components/mold_risk_index/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "calculated",
"issue_tracker": "https://github.com/Strixx76/mold_risk_index/issues",
"requirements": [],
"version": "1.0.1"
"version": "1.1.0"
}
29 changes: 10 additions & 19 deletions python_scripts/shellies_discovery.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""This script adds MQTT discovery support for Shellies devices."""
VERSION = "4.5.3"
VERSION = "4.5.4"

ATTR_ICON = "icon"
ATTR_MANUFACTURER = "Allterco Robotics"
Expand Down Expand Up @@ -1422,15 +1422,15 @@

OPTIONS_SENSOR_WINDOW_STATE_REPORTING = {
KEY_ENABLED_BY_DEFAULT: False,
KEY_ENTITY_CATEGORY: ENTITY_CATEGORY_CONFIG,
KEY_ENTITY_CATEGORY: ENTITY_CATEGORY_DIAGNOSTIC,
KEY_NAME: "Window state reporting",
KEY_STATE_TOPIC: TOPIC_SETTINGS,
KEY_VALUE_TEMPLATE: TPL_WINDOW_STATE_REPORTING,
}

OPTIONS_SENSOR_AUTOMATIC_TEMPERATURE_CONTROL = {
KEY_ENABLED_BY_DEFAULT: True,
KEY_ENTITY_CATEGORY: ENTITY_CATEGORY_CONFIG,
KEY_ENTITY_CATEGORY: ENTITY_CATEGORY_DIAGNOSTIC,
KEY_NAME: "Automatic temperature control",
KEY_STATE_TOPIC: TOPIC_STATUS,
KEY_VALUE_TEMPLATE: TPL_AUTOMATIC_TEMPERATURE_CONTROL,
Expand Down Expand Up @@ -1532,7 +1532,8 @@ def mqtt_publish(topic, payload, retain, json=False):
roller_mode = True

ignored = [
element.lower() for element in data.get(CONF_IGNORED_DEVICES, []) # noqa: F821
element.lower()
for element in data.get(CONF_IGNORED_DEVICES, []) # noqa: F821
]
mac = data.get(CONF_MAC) # noqa: F821

Expand Down Expand Up @@ -2838,9 +2839,7 @@ def mqtt_publish(topic, payload, retain, json=False):
for sensor, sensor_options in relay_binary_sensors.items():
config_topic = f"{disc_prefix}/binary_sensor/{dev_id}-{make_id(sensor)}-{relay_id}/config".encode(
"ascii", "ignore"
).decode(
"utf-8"
)
).decode("utf-8")
if device_config.get(f"relay-{relay_id}-name"):
sensor_name = f"{device_config[f'relay-{relay_id}-name']} {format_entity_name(sensor)}"
else:
Expand Down Expand Up @@ -2982,9 +2981,7 @@ def mqtt_publish(topic, payload, retain, json=False):
for input_id in range(inputs):
config_topic = f"{disc_prefix}/device_automation/{dev_id}-input-{input_id}/button_release/config".encode(
"ascii", "ignore"
).decode(
"utf-8"
)
).decode("utf-8")
topic = f"shellies/{dev_id}/input/{input_id}"
payload = {
KEY_AUTOMATION_TYPE: VALUE_TRIGGER,
Expand All @@ -3004,9 +3001,7 @@ def mqtt_publish(topic, payload, retain, json=False):
for event in inputs_types:
config_topic = f"{disc_prefix}/device_automation/{dev_id}-input-{input_id}/{event}/config".encode(
"ascii", "ignore"
).decode(
"utf-8"
)
).decode("utf-8")
payload = {
KEY_AUTOMATION_TYPE: VALUE_TRIGGER,
KEY_TOPIC: topic,
Expand Down Expand Up @@ -3239,9 +3234,7 @@ def mqtt_publish(topic, payload, retain, json=False):
for sensor, sensor_options in light_binary_sensors.items():
config_topic = f"{disc_prefix}/binary_sensor/{dev_id}-color-{sensor}-{light_id}/config".encode(
"ascii", "ignore"
).decode(
"utf-8"
)
).decode("utf-8")
if mode == LIGHT_COLOR:
payload = {
KEY_NAME: f"{format_entity_name(sensor)} {light_id}",
Expand Down Expand Up @@ -3370,9 +3363,7 @@ def mqtt_publish(topic, payload, retain, json=False):
for sensor, sensor_options in light_binary_sensors.items():
config_topic = f"{disc_prefix}/binary_sensor/{dev_id}-white-{sensor}-{light_id}/config".encode(
"ascii", "ignore"
).decode(
"utf-8"
)
).decode("utf-8")
if mode != LIGHT_COLOR:
payload = {
KEY_NAME: f"{format_entity_name(sensor)} {light_id}",
Expand Down

0 comments on commit 3a760b1

Please sign in to comment.