ParadoxAlarmInterface / pai

Paradox Magellan, Spectra and EVO, with MQTT, Signal, Pushbullet, Pushover and others
https://gitter.im/paradox-alarm-interface
Eclipse Public License 2.0
356 stars 95 forks source link

HomeAssistant: Platform mqtt does not generate unique IDs for zones and PGMs #175

Closed clau-bucur closed 4 years ago

clau-bucur commented 4 years ago

Alarm system

EVO192, access mode IP150.

Environment

Git branch

dev

Describe the bug

When HomeAssistant starts the following errors are present in the logs: Platform mqtt does not generate unique IDs. ID 0xxxfxxx_zone_Entrance_open already exists - ignoring binary_sensor.entrance ... the same for all the rest of the available zones and PGMs.

To Reproduce

Steps to reproduce the behavior:

  1. Install PAI addon
  2. Enable "MQTT_HOMEASSISTANT_AUTODISCOVERY_ENABLE: true"
  3. Start addon
yozik04 commented 4 years ago

I think @jpbarraca wrote about it that dev branch will generate different ids.

yozik04 commented 4 years ago

Related to #172

jpbarraca commented 4 years ago

The IDs are different in dev, but maybe we need for force the update. Will check it.

clau-bucur commented 4 years ago

I've installed the latest DEV HassIO addon and it's returning alot of errors like this, for all the existing Paradox entities:

2020-10-06 17:31:11 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_alarm_control_panel_mqtt': ({'name': 'Paradox xxxx Partition PARTER', 'unique_id': 'paradox_xxxx_partition_parter', 'command_topic': 'paradox/control/partitions/PARTER', 'state_topic': 'paradox/states/partitions/PARTER/current_state', 'availability_topic': 'paradox/interface/availability', 'device': {'manufacturer': 'Paradox', 'model': 'EVO192', 'identifiers': ['Paradox', 'EVO192', 'xxxx'], 'name': 'EVO192', 'sw_version': '7.30 build 3'}, 'payload_disarm': 'disarm', 'payload_arm_home': 'arm_stay', 'payload_arm_away': 'arm', 'payload_arm_night': 'arm_sleep', 'force_update': True, 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/alarm_control_panel.py", line 117, in async_discover
    config = PLATFORM_SCHEMA(discovery_payload)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['force_update']

I have cleared all the paradox and homeassistant MQTT messages and tried again. The result was the same.

yozik04 commented 4 years ago

I do not like this force_update for sensors as well.

clau-bucur commented 4 years ago

The issue is still there, but for other types:

2020-10-06 18:02:43 ERROR (MainThread) [homeassistant.util.logging] Exception in discovery_callback when dispatching 'mqtt_discovery_updated_('alarm_control_panel', 'xxx PARTER')': ({'name': 'Paradox xxx Partition PARTER', 'unique_id': 'paradox_xxx_partition_parter', 'command_topic': 'paradox/control/partitions/PARTER', 'state_topic': 'paradox/states/partitions/PARTER/current_state', 'availability_topic': 'paradox/interface/availability', 'device': {'manufacturer': 'Paradox', 'model': 'EVO192', 'identifiers': ['Paradox', 'EVO192', 'xxx'], 'name': 'EVO192', 'sw_version': '7.30 build 3'}, 'payload_disarm': 'disarm', 'payload_arm_home': 'arm_stay', 'payload_arm_away': 'arm', 'payload_arm_night': 'arm_sleep', 'force_update': True, 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 1299, in discovery_callback
    await self._discovery_update(payload)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/alarm_control_panel.py", line 170, in discovery_update
    config = PLATFORM_SCHEMA(discovery_payload)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['force_update']

2020-10-06 18:02:46 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_switch_mqtt': ({'name': 'Paradox xxx Zone Intrare Bypass', 'unique_id': 'paradox_xxx_zone_intrare_bypass', 'state_topic': 'paradox/states/zones/Intrare/bypassed', 'availability_topic': 'paradox/interface/availability', 'command_topic': 'paradox/control/zones/Intrare', 'payload_on': 'bypass', 'payload_off': 'clear_bypass', 'state_on': 'True', 'state_off': 'False', 'device': {'manufacturer': 'Paradox', 'model': 'EVO192', 'identifiers': ['Paradox', 'EVO192', 'xxx'], 'name': 'EVO192', 'sw_version': '7.30 build 3'}, 'force_update': True, 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/switch.py", line 86, in async_discover
    config = PLATFORM_SCHEMA(discovery_payload)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['force_update']
jpbarraca commented 4 years ago

The force_update is not mandatory, but results in nicer charts as it increases the amount of data published. I didn't had that error. What version of HA do you have? Any idea where it fails? Zone, Partition, Voltage...

yozik04 commented 4 years ago

From his log it is for bypass. I have fixed for partition already.

clau-bucur commented 4 years ago

Home Assistant 0.115.6. I've restarted DEV addon (I switched to release Addon while this issue is fixed) and here is the encrypted log. home-assistant.log

From what I see, HA does not support the force_update MQTT key.

yozik04 commented 4 years ago

This feature does not exist in release addon. You need to cleanup mqtt before testing again. How you updated dev? Removed and readded?

clau-bucur commented 4 years ago

Yes, I update DEV by uninstalling the addon and installing it again. Would love to have a better way :D OK, I stopped addon, removed all MQTT messages, rebooted HA, started DEV addon. It generates errors when discovers new alarm panels and new switches (the errors repeat for all existing partitions and switches):

2020-10-07 09:56:47 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_alarm_control_panel_mqtt': ({'name': 'Paradox xxxxx Partition ETAJ', 'unique_id': 'paradox_xxxxx_partition_etaj', 'command_topic': 'paradox/control/partitions/ETAJ', 'state_topic': 'paradox/states/partitions/ETAJ/current_state', 'availability_topic': 'paradox/interface/availability', 'device': {'manufacturer': 'Paradox', 'model': 'EVO192', 'identifiers': ['Paradox', 'EVO192', 'xxxxx'], 'name': 'EVO192', 'sw_version': '7.30 build 3'}, 'payload_disarm': 'disarm', 'payload_arm_home': 'arm_stay', 'payload_arm_away': 'arm', 'payload_arm_night': 'arm_sleep', 'force_update': True, 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/alarm_control_panel.py", line 117, in async_discover
    config = PLATFORM_SCHEMA(discovery_payload)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['force_update']

2020-10-07 09:56:48 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_switch_mqtt': ({'name': 'Paradox xxxxx Zone Intrare Bypass', 'unique_id': 'paradox_xxxxx_zone_intrare_bypass', 'state_topic': 'paradox/states/zones/Intrare/bypassed', 'availability_topic': 'paradox/interface/availability', 'command_topic': 'paradox/control/zones/Intrare', 'payload_on': 'bypass', 'payload_off': 'clear_bypass', 'state_on': 'True', 'state_off': 'False', 'device': {'manufacturer': 'Paradox', 'model': 'EVO192', 'identifiers': ['Paradox', 'EVO192', 'xxxxx'], 'name': 'EVO192', 'sw_version': '7.30 build 3'}, 'force_update': True, 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/switch.py", line 86, in async_discover
    config = PLATFORM_SCHEMA(discovery_payload)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['force_update']
yozik04 commented 4 years ago

I have removed all force_update parameters from the config

clau-bucur commented 4 years ago

Looks good now!

clau-bucur commented 4 years ago

It works ok since 9 days now.