tydom2MQTT addon :D - Delta Dore Tydom to MQTT Broker

Hey thanks, could you do a pull request pls ?

Not easily :frowning:. Can’t you apply my patch directly?

^^ I don’t know how ! Just drag and drop your modded files on my github page directly, it will ask for PR :slight_smile:

in the new release :

MQTT - Deprecated features from MQTT platforms are now removed. - (@emontnemery - #32909) (mqtt docs 1)

For MQTT lights setup through MQTT discovery, it’s no longer possible to specify schema with platform configuration variable. Instead, schema must be specified by the schema configuration variable.
For MQTT alarm_control_panel, MQTT binary_sensor and MQTT sensor set up through MQTT discovery: The undocumented implicit setting of state_topic is no longer supported. Instead, state_topic must be explicitly set.
Support for json_attributes is removed from MQTT sensor, json_attributes_topic should be used instead.

Maybe something to change ? :slight_smile:

Nope, already anticiped that one ! :slight_smile:

1 Like

Hello after the update I’ve this log message : " exec: fatal: unable to exec bashio
: No such file or directory".
The addon is still working.
I’ve a question : is that normal that i need to clic 2 times for down or up my covers ? 1 time nothing happend, and 2nd time its ok.
Thx again for ur work.

Mmh… Ils there any other normal log ?

That issue is known, for now I can’t use the service part of s6overlay that is default in hassio add-ons.

Rebuild it, it should be fixed

after rebuild addon wont start anymore :
s6-supervise tydom2mqtt: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise (child): fatal: unable to exec run: No such file or directory
s6-maximumtime: warning: unable to wait for child process: Operation timed out

Ok retry !

Yes it work.
Tks.

Pls send me your files !

I will rework a lot of the base, and I could use some help to do a proper integration, with a common base with MQTT :

  • Isolate Tydom client to just instanciate and forget.
  • take the flow logic out in a separate py (connection, listen for incoming, heartbeat…)
  • I need the home assistant part (integration), I don’t understand yet how it is handled with a push logic from Tydom to HASS (hass create devices from a dict returned from library (instanciated at init ?) then use the provided function to update ?)

Here my Integration of French data source :slight_smile:
https://github.com/max5962/prixCarburant-home-assistant
Very simple exemple and works well.

1 Like

Thanks !!

But it’s a poll logic no ? Not push (i.e. Hass is the one to fetch the data, data does not come at it alone)

yes you are right
regularly update => PULL

Ok guys, pushed 0.92, big changes under the hood, tydomConnector is now totally isolated, it can be used as a library i think (maybe pushing it to pipy, which is a prereq for integration)

Autoreconnections are handled waaaaaaay better for websocket.
And thanks to @Max013 for the changes in ids !

One drawback : you WILL have duplicate devices because of the change of ids, you should remove MQTT integration, destroys topics with MQTT explorer, reboot hassio, reintegrate, update/restart addon.

Just to see how many people are using that… Any feedback ? What are you using if not my solution ? (Looking for coding ideas and how real Devs handle some things !)

Triyng your last release and everything works like a charm. Some sensors popup for every cover. Thanks again for your great work. I’ll try to add my external temperature sensor when i have time.

1 Like

Hi @WiwiWillou !

You’ve done a really nice work for Tydom users :star_struck: Thank you ! :clap: :clap:

I’ve try your new version (0.92), to use it I’ve uninstall and reinstall MQTT Broker and Tydom2MQTT to be sure, but I can’t see anymore my devices.
When I’m looking the Tydom2MQTT logs I can see a lot of msg_data error in parsing !.
I’ve some Shutter, Light and Consumption devices.
In previous version, I also had parsing errors but devices was there.

I using Hassio with supervisor version 217 and Home Assistant version 0.108.6.
To install Tydom2MQTT, I’ve added your GitHub Addon repository and use MQTT auto discovery.
I’m new to Home Assistant, maybe I did something wrong.

More logs, with trace log level (This is not my real options.json and I’ve the same issue with local access):

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 

-----------------------------------------------------------
 Add-on: Tydom2MQTT - Beta
 Link between a Delta Dore's Tydom Hub and and a MQTT broker, unofficial of course, hassio addon version
-----------------------------------------------------------
 Add-on version: release_0.92
 You are running the latest version of this add-on.
parse error: Expected string key before ':' at line 1, column 4
[12:38:30] ERROR: Unknown HTTP error occured
 System:   (amd64 / qemux86-64)
 Home Assistant Core: 0.108.6
 Home Assistant Supervisor: 217
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to TRACE
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

Starting /opt/tydom2mqtt/main.py
Task exception was never retrieved
future: <Task finished name='Task-5' coro=<listen_tydom_forever() done, defined at /opt/tydom2mqtt/main.py:103> exception=NameError("name 'websockets' is not defined")>
Traceback (most recent call last):
  File "/opt/tydom2mqtt/main.py", line 119, in listen_tydom_forever
    incoming_bytes_str = await asyncio.wait_for(tydom_client.connection.recv(), timeout=tydom_client.refresh_timeout)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
    return fut.result()
  File "/usr/lib/python3.8/site-packages/websockets/protocol.py", line 509, in recv
    await self.ensure_open()
  File "/usr/lib/python3.8/site-packages/websockets/protocol.py", line 812, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: code = 1000 (OK), no reason

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/tydom2mqtt/main.py", line 123, in listen_tydom_forever
    except (asyncio.TimeoutError, websockets.exceptions.ConnectionClosed) as e:
NameError: name 'websockets' is not defined
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
STARTING TYDOM2MQTT
Dectecting environnement......
/data/options.json detected ! Hassio Addons Environnement : parsing options.json....
{'TYDOM_MAC': '001A25XXXXXX', 'TYDOM_IP': 'mediation.tydom.com', 'TYDOM_PASSWORD': 'MyFakePassword', 'TYDOM_ALARM_PIN': 123456, 'TYDOM_ALARM_HOME_ZONE': 1, 'TYDOM_ALARM_NIGHT_ZONE': 2, 'MQTT_HOST': 'localhost', 'MQTT_USER': 'mqtt_user', 'MQTT_PASSWORD': 'AnotherFakePassword', 'MQTT_PORT': 1883, 'MQTT_SSL': False, 'log_level': 'trace'}
Initialising TydomClient Class
Setting remote mode context.
Starting main loop_task
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Attempting MQTT connection...
MQTT host :  localhost
MQTT user :  mqtt_user
##################################
Subscribing to :  +/tydom/#
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
TYDOM WEBSOCKET CONNECTION INITIALISING....                     
Building headers, getting 1st handshake and authentication....
Upgrading http connection to websocket....
Attempting websocket connection with tydom hub.......................
Host Target :
mediation.tydom.com
Tydom Client is connected to websocket and ready !
Requesting 1st data...
>>>>>>>>>> Sending to tydom client..... GET /info
##################################
##################################
>>>>>>>>>> Sending to tydom client..... POST /refresh/all
>>>>>>>>>> Sending to tydom client..... GET /configs/file
>>>>>>>>>> Sending to tydom client..... GET /devices/data
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : Info detected
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
Cannot parse response !
Error :  string indices must be integers
{'scenarios': [{'id': 663436197, 'name': 'Nuit', 'picto': 'picto_scenario_night'}, {'id': 278543048, 'name': 'Jour', 'picto': 'picto_scenario_day'}], 'old_tycam': False, 'groups': [{'id': 2, 'name': 'TOTAL', 'picto': 'picto_shutter', 'usage': 'shutter', 'group_all': True}, {'picto': 'picto_lamp', 'usage': 'light', 'group_all': True, 'name': 'TOTAL', 'id': 3}, {'usage': 'awning', 'group_all': True, 'id': 260698568, 'name': 'TOTAL', 'picto': 'picto_awning_awning'}, {'usage': 'light', 'group_all': False, 'id': 1785928416, 'name': 'Lampes', 'picto': 'picto_lamp1'}], 'moments': [{'id': 2036167189, 'color': 3367324, 'name': 'Chargeur 🔌 '}, {'color': 10105408, 'id': 654938890, 'name': 'Chargeur 2 🎈'}, {'id': 1949780119, 'name': 'Lumière 💡 ', 'color': 13418883}, {'name': 'Nuit 🌙', 'id': 1238109790, 'color': 7979729}, {'color': 14805122, 'name': 'Lumière 💡 WE', 'id': 72396589}, {'id': 141243120, 'color': 9813268, 'name': 'Nuit 🌙 WE'}], 'endpoints': [{'name': 'Interrupteur Lampe', 'picto': 'picto_bedside', 'first_usage': 'light', 'last_usage': 'light', 'id_endpoint': 1531984244, 'id_device': 1531984245}, {'picto': 'picto_lamp', 'id_endpoint': 1531984244, 'id_device': 1531984244, 'name': 'Chargeur USB', 'first_usage': 'light', 'last_usage': 'light'}, {'id_device': 1576882204, 'name': 'Temp extérieur', 'picto': 'picto_conso', 'first_usage': 'conso', 'last_usage': 'conso', 'id_endpoint': 1576882204}, {'id_endpoint': 1578160287, 'last_usage': 'conso', 'picto': 'picto_conso', 'id_device': 1578160287, 'name': 'Conso Chauffage', 'first_usage': 'conso'}, {'picto': 'picto_conso', 'id_device': 1578160364, 'id_endpoint': 1578160364, 'name': 'Conso ECS', 'first_usage': 'conso', 'last_usage': 'conso'}, {'id_endpoint': 1578160430, 'id_device': 1578160430, 'picto': 'picto_conso', 'name': 'Conso Reste', 'last_usage': 'conso', 'first_usage': 'conso'}, {'picto': 'picto_shutter', 'name': 'Volet Salon', 'first_usage': 'shutter', 'last_usage': 'shutter', 'id_device': 1578848782, 'id_endpoint': 1578848782}, {'picto': 'picto_shutter', 'id_device': 1586096438, 'last_usage': 'shutter', 'first_usage': 'shutter', 'name': 'Volet Chambre', 'id_endpoint': 1586096438}], 'os': 'ios', 'version': '1.0.1', 'version_application': '3.7.0 (255)', 'date': 1587110912, 'id_catalog': 'F2BD90F93B888DA02C54980F11AE4796DFCC98F447CD3FE326F5A3A964C939BF'}
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
msg_data error in parsing !
1531984244
msg_data error in parsing !
1531984245
msg_data error in parsing !
1576882204
msg_data error in parsing !
1578160287
msg_data error in parsing !
1578160364
msg_data error in parsing !
1578160430
msg_data error in parsing !
1578848782
msg_data error in parsing !
1586096438
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
msg_data error in parsing !
1578160287
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
msg_data error in parsing !
1578160287
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
msg_data error in parsing !
1531984244
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
msg_data error in parsing !
1578160430
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
msg_data error in parsing !
1578160287
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
msg_data error in parsing !
1578160430
Incoming data parsed successfully !

Starting /opt/tydom2mqtt/main.py,

Ok thanks I’ve forgot an import used to check if connection is still alive… I will fix it this afternoon ! Thanks :wink:

1 Like

Hi,

First, thank’s for your job.
I often spoke with DeltaDore and the theirs very closed devices…

So, I Use Home assistant on a RaspberryPi and I can’t get it to Work.
First :

  • Install Mosquitto broker. I didn’t change the default config file.
  • Then, I’ve added the integration of “MQTT”
    - localhost/1883/user/password

Then :

This is an extract of tydom add-on log file :

TYDOM WEBSOCKET CONNECTION INITIALISING....                     
Building headers, getting 1st handshake and authentication....
Upgrading http connection to websocket....
Attempting websocket connection with tydom hub.......................
Host Target :
mediation.tydom.com
Tydom Client is connected to websocket and ready !
Requesting 1st data...
>>>>>>>>>> Sending to tydom client..... GET /info
##################################
##################################
>>>>>>>>>> Sending to tydom client..... POST /refresh/all
>>>>>>>>>> Sending to tydom client..... GET /configs/file
>>>>>>>>>> Sending to tydom client..... GET /devices/data
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : Info detected
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
<<<<<<<<<< Receiving from tydom_client...
Incoming message type : no type detected
{"endpoints":[{"picto":"picto_plug","fir
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
msg_data error in parsing !
20
msg_data error in parsing !
1520677197
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
Incoming data parsed successfully !
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : data detected
Incoming data parsed successfully !
code = 1000 (OK), no reason
>>>>>>>>>> Sending to tydom client..... POST /refresh/all
TimeoutError or websocket error - retrying connection in 2 seconds...
Error: code = 1000 (OK), no reason
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
TYDOM WEBSOCKET CONNECTION INITIALISING....                     
Building headers, getting 1st handshake and authentication....
Upgrading http connection to websocket....
Attempting websocket connection with tydom hub.......................
Host Target :
mediation.tydom.com
Tydom Client is connected to websocket and ready !
Requesting 1st data...
>>>>>>>>>> Sending to tydom client..... GET /info
##################################
##################################
>>>>>>>>>> Sending to tydom client..... POST /refresh/all
>>>>>>>>>> Sending to tydom client..... GET /configs/file
>>>>>>>>>> Sending to tydom client..... GET /devices/data
<<<<<<<<<< Receiving from tydom_client...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Incoming message type : Info detected

Mosquitto Broker log file :

1587819563: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1587819565: New client connected from 172.30.32.1 as auto-414xx (p2, c1, k60, u'homeassistant').
1587819565: Client auto-414xx disconnected.
1587819565: New connection from 172.30.32.1 on port 1883.
1587819565: New client connected from 172.30.32.1 as auto-39C6xxx (p2, c1, k60, u'homeassistant').

Discover is activated but no device appear…
I’ve tried with localhost and local IP address.

Have you an idea about my problem ?
Many Thanks