mrwiwi / tydom2mqtt

Link between a Delta Dore's Tydom Hub and and a MQTT broker, unofficial of course.
MIT License
28 stars 17 forks source link

Store scenario patch #9

Open GiPe66 opened 4 years ago

GiPe66 commented 4 years ago

Hi William,

I have successfully made store scenario working. Please replace the commented out part of mqtt_client.py with the following block.

` Sorry, code indentation does not work...

    elif ('set_scenario' in str(topic)):
        print('Incoming MQTT set_scenario request : ', topic, payload)
        get_id = (topic.split("/"))[2] #extract id from mqtt
        print(str(get_id), 'run scenario')
        if not self.tydom.connection.open:
            print('Websocket not opened, reconnect...')
            await self.tydom.connect()
            await self.tydom.put_scenarios(str(get_id))

        else:
            await self.tydom.put_scenarios(str(get_id))

` Thanks for all. Jean-Paul.