tydom2MQTT addon :D - Delta Dore Tydom to MQTT Broker

Hi,
I can probably help even if I don’t have any of these switch.
First question: Do you know if the switch provide information to the tydom ?

Thanks you hercule !!!
Yes I get some information. Here is an example of my garage door and my gate :

{'name': 'Garage', 'picto': 'picto_sectional_door', 'last_usage': 'garage_door', 'first_usage': 'garage_door', 'id_device': 1606579271, 'anticipation_start': False, 'id_endpoint': 1606579271}
{'anticipation_start': False, 'first_usage': 'gate', 'last_usage': 'gate', 'picto': 'picto_gate', 'name': 'Portail', 'id_endpoint': 1606579658, 'id_device': 1606579658}

So you can see we have last_usage = garage_door or gate that we can use.
I’m able to log this and save data as a switch in home assistant :

CURRENT ELEM={'name': 'thermicDefect', 'validity': 'upToDate', 'value': False}
======[ DEVICE INFOS ]======
ID 1606579271
ENDPOINT ID 1606579271
Name Garage
Type garage_door
==========================
CURRENT ELEM={'name': 'thermicDefect', 'validity': 'upToDate', 'value': False}
'state'
Sensor created / updated :  device_id_tydom__Garage 1606579271
Sensor created / updated :  endpoint_id_tydom__Garage 1606579271
Sensor created / updated :  id_tydom__Garage 1606579271_1606579271
Binary sensor created / updated :  thermicDefect_tydom__Garage False
Switch created / updated :  Garage 1606579271_1606579271 On

Now, I don’t know how to continue and send command to my tydom :thinking:

Good start.
I assume that ‘Garage’ is your tyxia 4620. Correct ?

Reading the code, it is clear that last_usage:‘garage_door’ is NOT supported :frowning: This explains why you can’t play with it.

I can probably help you but I need to know your skills regarding python coding, docker mngt,…

If I provide you with some modified files, will you be able to use them for testing ?

Let me know.

Hi There,
thanks for your work on this system. I find it very useful !

However, I have an issue with my Tyxal CSX40 alarm since the beginning. I can’t arm or disarm the alarm.

Today, finally (I don’t know how or why) something came up in the logs :

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sending to tydom client..... PUT cdata {"value":"ON","pwd":"xxxx","zones":"[1]"}
<<<<<<<<<< Receiving from tydom_client...
Incoming message type : html detected (probable 404)
<!doctype html>
<html>
<head><title>Error 500</title></head>
<body>
<h2>Error 500</h2>
<p>Internal server Error</p>
</body>
</html>
HTML Response ?
Incoming data parsed successfully !

I was able to reproduce the error by calling directly the Tydom “api” by using this API https://github.com/mathman/tydom which acts as a proxy to this code https://github.com/mgcrea/node-tydom-client

With this request

PUT /devices/xxxx/endpoints/xxxx/cdata?name=alarmCmd HTTP/1.1\r\ncontent-length: 29\r\ncontent-type: application/json; charset=utf-8\r\ntransac-id: yyyy\r\n\r\n\r\n[{"pwd":"0000","value":"ON"}]\r\n\r\n 

I got the same 500 response error.

Did you encounter this kind of problem ? Is there a known limitation with my Tyxal CSX40 ?
here is the documentation : http://www.deltadore.com/mediastore/23/13522_3_FR_original.pdf

Hi,
Quick check:
Your manual command indicates ‘content-length: 29’ which I suppose should be the length of the command. Did you check if 29 is the right value ?

I checked in the code of the plugin and it seems like the content-length is set to 0.
Something like:

'PUT' + cmd + "HTTP/1.1\r\nContent-Length: 0\r\nContent-Type: application/json; charset=UTF-8\r\nTransac-Id: 0\r\n\r\n"

You may give it a try…
My 2 cents,

Thanks.

echo '[{"pwd":"0000","value":"ON"}]' | wc

said 30. (so 29 for a 0-indexed value). I suppose it’s correct. I’ll check the plugin’s code.

Oops. My fault.
I was not expecting a passed value ‘0000’ and did not really check the length of your rqst :wink:

Yes, Garage is my tyxia 4620.
I already added a switch.py package to play with it.
I just duplicated cover or light file (don’t remember) and adjust it to fit the data for switches.
The point is the send command function. I don’t know how to deal with it. I’m maybe doing in the wrong way. Can you tell me your point of view?

async def put_switch_state(tydom_client, device_id, switch_id, state):
        print(switch_id, 'state', state)
        if not (state == ''):
            await tydom_client.put_devices_data(device_id, switch_id, 'state', state)

And yes, I have some skills in dev + docker. I’ll tell you if I don’t understand
:wink:

What’s the difference between your garage door switch and a shutter one ?
IMHO, there is no.

So, I would propose to slightly modify the plugin to handle your switch as a shutter switch.

The mod is trivial.
You should modify the file tydomMessagehandler.py. In function parse_config_data(),
Line ~210, you should read:

if i[“last_usage”] == ‘shutter’ or i[“last_usage”] == ‘light’ or i[“last_usage”] == ‘window’ or i[“last_usage”] == ‘windowFrench’ or i[“last_usage”] == ‘belmDoor’:

update it to read:

if i[“last_usage”] == ‘shutter’ or i[“last_usage”] == ‘light’ or i[“last_usage”] == ‘window’ or i[“last_usage”] == ‘windowFrench’ or i[“last_usage”] == ‘belmDoor’ or i[“last_usage”] == ‘garage_door’:

and test.

Let me know,

That’s what i already tried. And I also added this to tydomMessageHandler :

if type_of_id == 'garage_door':
if elementName in deviceSwitchKeywords and elementValidity == 'upToDate': 
attr_garage['device_id'] = device_id
attr_garage['endpoint_id'] = endpoint_id
attr_garage['id'] = str(device_id) + '_' + str(endpoint_id)
attr_garage['switch_name'] = print_id
attr_garage['name'] = print_id
attr_garage['device_type'] = 'switch'
attr_garage[elementName] = elementValue

and

elif 'device_type' in attr_garage and attr_garage['device_type'] == 'switch':
new_garage = "garage_door_tydom_"+str(endpoint_id)
new_garage = Switch(tydom_attributes=attr_garage, mqtt=self.mqtt_client)
await new_garage.update()

I can get a switch in home assistant, but nothing happen when I click on it…

In addition, I just took a look at the homebridge plugin for Tydom which manage Tyxia 4620.
In this file : https://github.com/mgcrea/homebridge-tydom/blob/e7b09db1d777dc73fa93a47b9fe0c78b92424dec/src/accessories/garageDoorOpener.ts
It seems the command to send is levelCmd = TOGGLE.
I’ll give it a try and keep you inform :wink:

await client.put(`/devices/${deviceId}/endpoints/${endpointId}/data`, [
{
    name: 'levelCmd',
    value: 'TOGGLE'
}
]);

It seems like you are well ahead of me and as I don’t have this device at home, I will not be able to help you. But it seems like you are on a good track. BTW, TOGGLE is a ‘std’ value for switches as I can read in the doc.

I will follow your investigation.
Good luck.

:metal: :muscle:
This is working !!

Sending to tydom client..... PUT data [{"name":"levelCmd","value":"TOGGLE"}]

And my garage opened.
I need to do it in a clean way now. And maybe need some help from @WiwiWillou to merge with your work.

Hi, happy to see you guys going on with the project, you need to create a switch.py, (maybe take light.py as a start and mod things here), the Message Handler and the mqtt client in relation with the topics you will use in switch.py, and you should be good :slight_smile:

EDIT : just seen @fransiouz has already took a good start ! :smiley: thanks man !

Yep @WiwiWillou, already done like that with a switch.py.
Can you take a look at my repo and tell me if you can merge ?

In addition, I’ve added pin code management for alarm panel. Good idea ?
If no TYDOM_ALARM_PIN defined, there is no code asked.
If you set one, you will have the numpad :

1 Like

Since the transition to version 1.0 no outside temperature.

Édit: ok i found my temperature sensor

up on this please :slight_smile:
Is any of you having a Tyxal CSX40 alarm system ?

Hello,
Thank you for your work! It’s great to see that Delta Dore devices are now available in Home Assistant :slight_smile:

I am new with HA and MQTT. I installed Mosquitto and tydom2mqtt, then I restarted HA and tydom2mqtt.
Most of my devices have been recognized, but I got a few problems:

  • The temperature sensor that comes with the Tywatt 2000 is not recognized at all. There is no virtual sensor created for it. When I execute a python script to get its data I get a correct value.
    Here is its config:
# When I associate the whole Tywatt (that knows the temperature sensor):
{
  "id_endpoint": xxxxxxxx,
  "first_usage": "conso",
  "id_device": xxxxxxxx,
  "name": "Tywatt",
  "anticipation_start": false,
  "picto": "picto_conso",
  "last_usage": "conso"
}
# When I associate the temperature sensor directly:
{
  "id_endpoint": xxxxxxxx,
  "first_usage": "conso",
  "id_device": xxxxxxxxx,
  "name": "Temperature Sonde",
  "anticipation_start": false,
  "picto": "picto_conso",
  "last_usage": "conso"
}
  • I also have a sensor to detect doors opening (it only detects opening, not locking), but its sensor too seems not to be found.
    Here is its data value:
{
    "data": [
        {
            "name": "config",
            "validity": "upToDate",
            "value": 2
        },
        {
            "name": "battDefect",
            "validity": "expired",
            "value": false
        },
        {
            "name": "supervisionMode",
            "validity": "upToDate",
            "value": "LONG"
        },
        {
            "name": "intrusionDetect",
            "validity": "expired",
            "value": false # true when the door is opened
        }
    ],
    "error": 0,
    "id": xxxxxxxxxx
}

And its config:

{
  "id_device": xxxxxxxxx,
  "id_endpoint": xxxxxxxx,
  "name": "Porte Service",
  "picto": "picto_detect_door_service",
  "first_usage": "klineDetect",
  "last_usage": "klineDoor",
  "skill": "TYDOM_X3D"
}

Finally, I have another problem that concerns data refresh. Shutters and KLine door / window detectors work well, I get fresh values rapidly.
But the temperature associated with the alarm does not update! It only updates when I restart tydom2mqtt :thinking:

EDIT: I was too optimistic for the shutters. Positions are not correctly updated and sometimes incoherent:

Thanks for your help!

for the refresh problem, WiwiWillou merged my pull request which refresh everything when homeassistant starts. maybe the latest version solves this

thanks, I will take a look when the next version will be released

(when I restart HA I also restart tydom2mqtt manually)