fmartinou / tydom2mqtt

Deltadore Tydom to MQTT Bridge
https://fmartinou.github.io/tydom2mqtt/
MIT License
86 stars 49 forks source link

Tyxal alarm: can we use a numpad rather than a hardcoded code in the configuration ? #170

Open jerry34ha opened 5 months ago

jerry34ha commented 5 months ago

Hi,

14 months ago I tried to integrate my Delta Dore installation with mqtt2tydom in my HA and I gave up: too many things not working.

A year later, I try again and everything works! Lights, cover, dvi, alarm.

Good job!

One things bothers me: deactivating the alarm does not require the user to enter a code. I see this as a problem when my HA dashboard is mounted next to the front door.

Is there a way to request that the user enters the code?

jerry34ha commented 5 months ago

Version 3.4.2 by the way.

I look at the mqtt diagnostics and see: "state": { "entity_id": "alarm_control_panel.tyxal_alarm", "state": "disarmed", "attributes": { "code_format": null, "changed_by": null, "code_arm_required": false,

So with code_arm_required false, panel is not shown.

So I looked into the code (no knowing what I'm doing, of course):

app/sensors/Alarm.py shows:

 if self.alarm_pin is None:

            self.config['code'] = self.alarm_pin

            self.config['code_arm_required'] = 'true'

So I guess that if I do not setup an alarm code in mqtt2tydom configuration, then the 'code_arm_required' is set to true and the alarm panel card will show the numpad.

BUT, if I don't setup a code, the alarm entity is not created and there is an error in the homeassistant.log complaining about a code set to 'None':

2024-01-25 17:27:26.470 ERROR (MainThread) [homeassistant.components.mqtt.mixins] Error 'string value is None for dictionary value @ data['code']' when processing MQTT discovery message topic: 'homeassistant/alarm_control_panel/tydom/xxxxx/config', message: '{'name': None, 'unique_id': 'xxxxx', 'device': {'manufacturer': 'Delta Dore', 'model': 'Tyxal', 'name': 'Tyxal Alarm', 'identifiers': 'xxxxx'}, 'command_topic': 'alarm_control_panel/tydom/xxxxx/set_alarm_state', 'state_topic': 'alarm_control_panel/tydom/xxxxx/state', 'code_arm_required': 'true', 'code': None, 'json_attributes_topic': 'alarm_control_panel/tydom/xxxxx/attributes', 'platform': 'mqtt'}'

If I do setup a code, then no error in the log, and I can turn on/off the alarm, but without a code. For completeness, here is the log when I setup a code:

2024-01-25 17:40:15.712 DEBUG (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('alarm_control_panel', 'tydom xxxxx') '{'name': None, 'unique_id': 'xxxxx', 'device': {'manufacturer': 'Delta Dore', 'model': 'Tyxal', 'name': 'Tyxal Alarm', 'identifiers': 'xxxxx'}, 'command_topic': 'alarm_control_panel/tydom/xxxxx/set_alarm_state', 'state_topic': 'alarm_control_panel/tydom/xxxxx/state', 'code_arm_required': 'false', 'json_attributes_topic': 'alarm_control_panel/tydom/xxxxx/attributes', 'platform': 'mqtt'}'

2024-01-25 17:40:15.712 DEBUG (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: alarm_control_panel.tyxal_alarm

xxxxx are anonymization of the serial number.

jerry34ha commented 5 months ago

cc @fransiouz because of https://community.home-assistant.io/t/tydom2mqtt-addon-d-delta-dore-tydom-to-mqtt-broker/151333/300 and https://community.home-assistant.io/t/tydom2mqtt-addon-d-delta-dore-tydom-to-mqtt-broker/151333/325