Skip to content

Commit

Permalink
Update tasmota.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hendriksen-mark committed Dec 27, 2024
1 parent 46a248b commit bac9337
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions BridgeEmulator/lights/protocols/tasmota.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ def discover(detectedLights: List[Dict[str, Any]], device_ips: List[str]) -> Non
logging.debug("tasmota: <discover> invoked!")
for ip in device_ips:
try:
logging.debug(f"tasmota: probing ip {ip}")
#logging.debug(f"tasmota: probing ip {ip}")
response = requests.get(f"http://{ip}/cm?cmnd=Status%200", timeout=3)
response.raise_for_status()
if response.content and is_json(response.content):
device_data = response.json()
# logging.debug(pretty_json(device_data))
#logging.debug(pretty_json(device_data))
if "StatusSTS" in device_data:
logging.debug(f"tasmota: {ip} is a Tasmota device ")
logging.debug(f"tasmota: Hostname: {device_data["StatusNET"]["Hostname"]}")
logging.debug(f"tasmota: Mac: {device_data["StatusNET"]["Mac"]}")
#logging.debug(f"tasmota: Hostname: {device_data["StatusNET"]["Hostname"]}")
#logging.debug(f"tasmota: Mac: {device_data["StatusNET"]["Mac"]}")

properties = {"rgb": True, "ct": False, "ip": ip, "name": device_data["StatusNET"]["Hostname"], "id": device_data["StatusNET"]["Mac"], "mac": device_data["StatusNET"]["Mac"]}
detectedLights.append({"protocol": "tasmota", "name": device_data["StatusNET"]["Hostname"], "modelid": "LCT015", "protocol_cfg": {"ip": ip, "id": device_data["StatusNET"]["Mac"]}})
Expand Down

0 comments on commit bac9337

Please sign in to comment.