Invalid code given for armed_home

I setup a simple manual alarm and it works fine. I have a 4 button key (which is DSC 4 button wireless key https://www.dsc.com/alarm-security-products/WS4939%20-%204-Button%20Wireless%20Key/112). I want to setup an automation, when the arm key pressed, the alarm is set, etc. but I got error in the log. I can’t find where should I give the code to the automation.

Invalid code given for armed_home
9:59 PM components/alarm_control_panel/manual.py (WARNING)

the automation is
- alias: ‘Arm alarm when dsc remote pressed’
trigger:
- platform: state
entity_id: sensor.dsc_remote
to: ‘129’
action:
- service: alarm_control_panel.alarm_arm_home
entity_id: alarm_control_panel.ha_alarm

alarm_control_panel hass:

  • platform: manual
    name: ‘HA Alarm’
    code: 1234
    pending_time: 0
    delay_time: 0
    trigger_time: 1
    disarmed:
    trigger_time: 0
    armed_home:
    pending_time: 0
    delay_time: 0