Keypad missing in custom alarm_control_panel

Hi,

I am developing a custom alarm_control_panel and is curious about how to display the keypad to enter a code when arming the alarm system.
At the beginning of developing the component there was a keypad right above the ARM HOME and ARM AWAY buttons. Now it just looks like this and I have no idea why it is gone:
HomeAssistantArmDialog

Any help would be much appreciated :slight_smile:

Here is a link to the source code: https://github.com/MikaelSchultz/homeassistant

My understanding is that this peace of code should show the keypad, but it doesnโ€™t. It is cut from the alarm_control_panel\visonicalarm.py file:

@property
def code_format(self):
    """ Return one or more digits/characters. """
    return 'Number'

Update: Just found this link that explain that setting code_format as Number should display the key pad: https://developers.home-assistant.io/docs/en/entity_alarm_control_panel.html

Or you could use lovelace and Lovelace: Alarm card

Thanks, I have not used Lovelace before but it seems it is time to look into it now.

Sadly the Lovelace Alarm Card act the same way as the previous UI. The keypad is missing here as well. There must be some small mistake I have made in the code, but I cannot seem to find it :frowning:

This is what I get when using Lovelace:
HomeAssistantLovelaceAlarmPanel

This is the config I tried:

cards:
  - type: custom:alarm_control_panel-card
    entity: alarm_control_panel.visonic_alarm
    title: My alarm
    hide_keypad: false
    display_letters: true
    code_length: 4
    states:
      - arm_home
      - arm_away

Solved it! :rofl:

When I added the state_attributes() method to my VisonicAlarm class (which inherit from homeassistant.components.alarm_control_panel:AlarmControlPanel) I overrode the state_attributes() method from the parent class:

@property
def state_attributes(self):
    """Return the state attributes."""
    state_attr = {
        ATTR_CODE_FORMAT: self.code_format,
        ATTR_CHANGED_BY: self.changed_by
    }
    return state_attr

Which meant that my method (which is now missing the attribute ATTR_CODE_FORMAT) did not share the code_format() anymore:

@property
def state_attributes(self):
    """ Return the state attributes of the alarm system. """
    return {
        STATE_ATTR_SYSTEM_SERIAL_NUMBER: hub.alarm.serial_number,
        STATE_ATTR_SYSTEM_NAME: hub.alarm.name,
        STATE_ATTR_SYSTEM_MODEL: hub.alarm.model,
        STATE_ATTR_SYSTEM_READY: hub.alarm.ready,
        STATE_ATTR_SYSTEM_ACTIVE: hub.alarm.active,
        STATE_ATTR_SYSTEM_CONNECTED: hub.alarm.connected,
        STATE_ATTR_SYSTEM_SESSION_TOKEN: hub.alarm.session_token,
        STATE_ATTR_SYSTEM_LAST_UPDATE: hub.last_update,
    }

So, all I had to do was to add this link to the attribute list and it worked!

ATTR_CODE_FORMAT: self.code_format,

Finally, this is what solved my problem:

@property
def state_attributes(self):
    """ Return the state attributes of the alarm system. """
    return {
        STATE_ATTR_SYSTEM_SERIAL_NUMBER: hub.alarm.serial_number,
        STATE_ATTR_SYSTEM_NAME: hub.alarm.name,
        STATE_ATTR_SYSTEM_MODEL: hub.alarm.model,
        STATE_ATTR_SYSTEM_READY: hub.alarm.ready,
        STATE_ATTR_SYSTEM_ACTIVE: hub.alarm.active,
        STATE_ATTR_SYSTEM_CONNECTED: hub.alarm.connected,
        STATE_ATTR_SYSTEM_SESSION_TOKEN: hub.alarm.session_token,
        STATE_ATTR_SYSTEM_LAST_UPDATE: hub.last_update,
        ATTR_CODE_FORMAT: self.code_format,
        ATTR_CHANGED_BY: self.changed_by,
        ATTR_CHANGED_TIMESTAMP: self._changed_timestamp,
    }