Skip to content

Commit

Permalink
Merge pull request #472 from clau-bucur/dev
Browse files Browse the repository at this point in the history
Home Assistant auto-discovery - set "code required" flags to false
  • Loading branch information
yozik04 authored Jun 18, 2024
2 parents fefc868 + 1741046 commit c2bc296
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions paradox/interfaces/mqtt/entities/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def serialize(self):
))
if self.code is not None:
config['code']=self.code
else:
config.update(dict(
code_arm_required=False,
code_disarm_required=False,
code_trigger_required=False
))
return config

@property
Expand Down
3 changes: 3 additions & 0 deletions tests/interfaces/mqtt/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def test_alarm_control_panel_serialize(mqtt_entity_factory):
'payload_arm_home': 'arm_stay',
'payload_arm_night': 'arm_sleep',
'payload_disarm': 'disarm',
'code_arm_required': False,
'code_disarm_required': False,
'code_trigger_required': False
}

assert alarm_control_panel.configuration_topic == "homeassistant/alarm_control_panel/1234abcd/partition_partition_1/config"
Expand Down
5 changes: 4 additions & 1 deletion tests/interfaces/mqtt/test_homeassistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ async def test_hass(mocker):
"payload_disarm": "disarm",
"payload_arm_home": "arm_stay",
"payload_arm_away": "arm",
"payload_arm_night": "arm_sleep"
"payload_arm_night": "arm_sleep",
'code_arm_required': False,
'code_disarm_required': False,
'code_trigger_required': False
},
0,
True
Expand Down

0 comments on commit c2bc296

Please sign in to comment.