From 90a47b814076ca9dc570a490f5f5aa0164328ce0 Mon Sep 17 00:00:00 2001 From: mrlt8 <67088095+mrlt8@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:35:03 -0700 Subject: [PATCH] only show pan_tilt for pan_cam --- app/wyzebridge/mqtt.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/wyzebridge/mqtt.py b/app/wyzebridge/mqtt.py index 524cfc35..64e1fa8a 100644 --- a/app/wyzebridge/mqtt.py +++ b/app/wyzebridge/mqtt.py @@ -54,7 +54,7 @@ def publish_discovery(cam_uri: str, cam: WyzeCamera, stopped: bool = True) -> No } # Clear out old/renamed entities - REMOVE = {"alarm": "switch"} + REMOVE = {"alarm": "switch", "pan_tilt": "cover"} for entity, type in REMOVE.items(): msgs.append((f"{MQTT_DISCOVERY}/{type}/{cam.mac}/{entity}/config", None)) @@ -350,21 +350,6 @@ def get_entities(base_topic: str, pan_cam: bool = False, rtsp: bool = False) -> "entity_category": "diagnostic", }, }, - "pan_tilt": { - "type": "cover", - "payload": { - "command_topic": f"{base_topic}rotary_degree/set", - "tilt_command_topic": f"{base_topic}rotary_degree/set", - "payload_open": "up", - "payload_close": "down", - "payload_stop": None, - "tilt_opened_value": 90, - "tilt_closed_value": -90, - "tilt_min": -90, - "tilt_max": 90, - "icon": "mdi:rotate-orbit", - }, - }, } if pan_cam: entities |= { @@ -405,6 +390,21 @@ def get_entities(base_topic: str, pan_cam: bool = False, rtsp: bool = False) -> "icon": "mdi:map-marker-multiple", }, }, + "pan_tilt": { + "type": "cover", + "payload": { + "command_topic": f"{base_topic}rotary_degree/set", + "tilt_command_topic": f"{base_topic}rotary_degree/set", + "payload_open": "up", + "payload_close": "down", + "payload_stop": None, + "tilt_opened_value": 90, + "tilt_closed_value": -90, + "tilt_min": -90, + "tilt_max": 90, + "icon": "mdi:rotate-orbit", + }, + }, } if rtsp: entities |= {