"""Держит режим сопряжения Zigbee открытым 15 минут (по 254 с).""" import json import time import paho.mqtt.client as mqtt c = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1, client_id="zg-keepalive") c.username_pw_set("hub", "hubmqtt") c.connect("192.168.1.107", 1883, 20) c.loop_start() end = time.time() + 15 * 60 while time.time() < end: c.publish("zigbee2mqtt/bridge/request/permit_join", json.dumps({"value": True, "time": 250})) print("permit_join open", flush=True) time.sleep(230) c.loop_stop() c.disconnect()