tydom2MQTT addon :D - Delta Dore Tydom to MQTT Broker

Yes, but the service failled to start. When I look at the journalctl I’ve an error :
ModuleNotFoundError: No module named ‘sdnotify’ !

Just do a pip3 install sdnotify !
Corrected the reader, thanks.
Sorry guys I have a lot of things to handle right now (madam is sick since January)…

Would be good if you guys start a pure HASS integration, maybe based on mcgrea node version,it could be easier ?

Thanks a lot it work !! thanks for ur help !!
Edit : It don’t work when I restart HA :cry:
I’ve this message on MQTT :
1584899411: New connection from 172.30.32.1 on port 1883.
1584899411: Socket error on client , disconnecting.
But I don’t see where this Ip adress is stored…

If you do a simple python3 main.py, is there any errors ?

MQTT can be painful to setup 1st, but once it’s running, it’s flawless.

BIG UPDATE on github guys, @max5962 i’ve added a new variable to disable all sdnotify mechanics by setting SYS_CONTEXT to None, it should please you :slight_smile:

Local mode is working now !!! That code 1006 error was so simple… but it got me for weeks.

I’ve separated the message handler from the client, so if you guys want to change the way the incoming data from tydom is processed (like a good push style proper integration for home assistant, it’s up to you, i still don’t have a lot of time…).

To fix the not updating on restart (because the config part as already happenned when hassio boot), create that script on hass, and create an automation to execute it when hass start !

update_tydom2mqtt:
  alias: Tydom Update
  sequence:
  - data:
      payload: '{ "update" }'
      topic: hassio/tydom/update
    service: mqtt.publish

AAAAAAAANNNND we have docker install now, next step is make an addons instead of an integration for the time we have MQTT.

I’m on fire.

Addon created, check OP.

i will be much easier now, you just need a MQTT broker already set up.

Small issue from docker hub that can’t follow… just tonight for now.

Ok, i need help, addon is working here with no issue so far, BUT, i can’t understand how i can force a restart policy to always (without a manual command or portainer).

@frenck, as litteraly the biggest addon dev known to earth could you please give me a hint ?

I just want a way to tell hassio to always auto restart the script (it’s working with docker run --restart=always … on manual install of the docker image that is pulled by the addon).

Nothing in documentation, i got the host network access option but not the restart. Not implemented ?

Everything is in python inside, and it work if i do a docker update --restart=always addon_container_id or with portainer.

Base of docker image repo (with autobuild on docker hub) :


Addon repo :

Thanks in advance…

docker version is cool. i will try it.

@WiwiWillou, is possible de define mqtt precisly in the config file ?

    if (MQTT_HOST == 'localhost'):
        MQTT_PORT = 1883 #1884 for websocket without SSL
        MQTT_SSL = False
    else:
        MQTT_PORT = 8883 #8884 for websocket
        MQTT_SSL = True

I have private mqtt on docker private network ( at home)
So i fill mqtt_IP and mqtt port. but because mqtt_host is not localhost i can use 1883 with mqtt_host with an private IP ?

A way better the docker version !

In order to retrieve the information, i need to move the cover or disarmed my alarm…
Any idea ?

But When i move the cover i received all informations :

Using your service at startup solved my unavailable issue

thnaks :slight_smile:

Should be good now, little but good add to covers : UP/DOWN/STOP are now correctly handled !

I could use some help with alarm, does someone know typescript ? :wink:

I try to read code from mgcrea node homebrige Tydom client, I put the commands for alarm handling in comments in messagehandler…just need to get the correct format it’s almost working ! (That’s why there is a new variable btw : TYDOM_PIN_ALARM

Last weekend, I started a standalone broker based on mgcrea node client.
Even if it was designed to work with HA, it can be used with any MQTT client.

I only have Delta Dore covers so this project is not complete but I took a lot of inspiration from the work done here so it can help on some points.

Here is the repository :

1 Like

Hey ! :smiley: The more the merrier :slight_smile: !

You should add mqtt discovery, really simple to use afterwards !

I tried mgcrea version with homebrige + homekit integration : Control over alarm but cover aren’t updated every time, and with latency (but maybe it’s homekit integration), got back to my version with some great ideas, and it’s fun to learn something new !

Could you help, i just need a little transcription of a portion of javascript / typescript code from mgcrea to a normal request :

It’s here : https://github.com/mgcrea/homebridge-tydom/blob/49128076c92d199bd27b164fe0a9e3618d45582d/src/accessories/securitySystem.ts

I think that one :


await client.put(`/devices/${deviceId}/endpoints/${endpointId}/cdata?name=zoneCmd`, {
            value: nextValue,
            pwd: pin,
            zones: targetZones
          });

i can’t find how to translate it to python, i’m here with badly formed response from websocket :

async def put_alarm_cdata(self, alarm_id, asked_state, zone=None):

        if not self.connection.open:
            print('Connection closed, exiting to ensure restart....')
            sys.exit()

        if self.alarm_pin == None:
            print('TYDOM_ALARM_PIN not set !')
            pass

        if zone == None:
            cmd = 'alarmCmd'
            body=" "+"{\"pwd\":\"" + str(self.alarm_pin) + "\",\"value\":\""+ asked_state + "\"}"
        else:
            cmd = 'zoneCmd'
            body="{\"pwd\":\"" + str(self.alarm_pin) + "\",\"value\":\""+ 'ON' + "\",\"zones\":\""+ '1' + "\"}"

        str_request = self.cmd_prefix + "PUT /devices/{}/endpoints/{}/cdata?name={},".format(str(alarm_id),str(alarm_id),str(cmd)) + body +");"
        # str_request = self.cmd_prefix + "PUT /devices/{}/endpoints/{}/cdata?name={} HTTP/1.1\r\nContent-Length: ".format(str(alarm_id),str(alarm_id),str(cmd))+str(len(body))+"\r\nContent-Type: application/json; charset=UTF-8\r\nTransac-Id: 0\r\n\r\n"+body+"\r\n\r\n"
        a_bytes = bytes(str_request, "ascii")
        print(a_bytes)
        await self.connection.send(a_bytes)
        print('PUT alarm cdata send to Websocket !',a)
        return 0

Thanks !

If not i will reinstall homebridge and integrate it to check commands…

1 Like

Maybe I not understand you well, but why not pass pin alarm in the data ? (In order to not store the information).

Alarm Lovelace have numeric keyboard.

FOUND ! (thanks mgcrea logs from homebridge)

for reference :


        # AWAY # "PUT /devices/{}/endpoints/{}/cdata?name=alarmCmd HTTP/1.1\r\ncontent-length: 29\r\ncontent-type: application/json; charset=utf-8\r\ntransac-id: request_124\r\n\r\n\r\n{"value":"ON","pwd":{}}\r\n\r\n"
        # HOME "PUT /devices/{}/endpoints/{}/cdata?name=zoneCmd HTTP/1.1\r\ncontent-length: 41\r\ncontent-type: application/json; charset=utf-8\r\ntransac-id: request_46\r\n\r\n\r\n{"value":"ON","pwd":"{}","zones":[1]}\r\n\r\n"
        # DISARM "PUT /devices/{}/endpoints/{}/cdata?name=alarmCmd HTTP/1.1\r\ncontent-length: 30\r\ncontent-type: application/json; charset=utf-8\r\ntransac-id: request_7\r\n\r\n\r\n{"value":"OFF","pwd":"{}"}\r\n\r\n"


Yeah for the PIN, just have to get it from MQTT ! Will do it later !

Ok, huys, will push an update tonight, alarm control is effective :smiley:

It will need more config options, for now ARM_HOME and ARM_NIGHT arm zone 1 & 2 respectively.

Github updated, docker image is pending, addon will be updatable soon.

0.84.

Next : Full attributes (defects) on alarm & covers, then adding lights

New options :


TYDOM_ALARM_PIN = None

TYDOM_ALARM_HOME_ZONE = 1

TYDOM_ALARM_NIGHT_ZONE = 2

0.85 : Full Tydom Attributes (defects, SOS, etc.) to Home assistant ! (check on dev tools :p)

This integration seems indeed quite interesting. I’ll try that this week-end.

I also want to allow users to use environment variables or secrets for sensitive information. This will make the config file git-able.

Don’t use ADDON for now, i try a new implementation to use s6 overlay to supervise the script… no issue with docker installs.