Skip to content

Commit

Permalink
only show pan_tilt for pan_cam
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlt8 committed Jul 25, 2023
1 parent b002d87 commit 90a47b8
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions app/wyzebridge/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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 |= {
Expand Down Expand Up @@ -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 |= {
Expand Down

0 comments on commit 90a47b8

Please sign in to comment.