Skip to content

Commit

Permalink
fix: fix doorbell entity name when device is called 'Doorbell'
Browse files Browse the repository at this point in the history
  • Loading branch information
dchesterton committed Dec 31, 2021
1 parent cfa7b00 commit bd18f74
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/amcrest2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ def signal_handler(sig, frame):
}

if is_doorbell:
doorbell_name = "Doorbell" if device_name == "Doorbell" else f"{device_name} Doorbell"

mqtt_publish(topics["home_assistant_legacy"]["doorbell"], "")
mqtt_publish(
topics["home_assistant"]["doorbell"],
Expand All @@ -271,7 +273,7 @@ def signal_handler(sig, frame):
"payload_on": "on",
"payload_off": "off",
"icon": "mdi:doorbell",
"name": f"{device_name} Doorbell",
"name": doorbell_name,
"unique_id": f"{serial_number}.doorbell",
},
json=True,
Expand Down

0 comments on commit bd18f74

Please sign in to comment.