Manual MQTT alarm vs MQTT alarm

so , what is actually the difference between those 2 ?


vs

because my alarm works with this code below (state - and arming/disarming)

#  - platform: manual_mqtt
  - platform: mqtt  
    name: Risco Alarm
    state_topic: "riscopanel/armstatus"
    command_topic: "riscopanel/armstatus/SET"
    payload_disarm: "disarmed" 
    payload_arm_home: "partially"
    payload_arm_away: "armed"

but if i change it to the code below, just the platform changes

  - platform: manual_mqtt
#  - platform: mqtt  
    name: Risco Alarm
    state_topic: "riscopanel/armstatus"
    command_topic: "riscopanel/armstatus/SET"
    payload_disarm: "disarmed" 
    payload_arm_home: "partially"
    payload_arm_away: "armed"

then it doesnt work anymore, i dont see the state changing, i cant arm/disarm …, it just doesnt do anything…

and i think i need the manual_mqtt alarm, because i want to make use of the code_template as described in the second link above
i only want to code for DISARMING only, not to ARM

like example here:

#    code: 1234
#    code_template: >-
#            {% if is_state('alarm_control_panel.risco_alarm', 'armed_away') %}
#              1234
#            {% elif is_state('alarm_control_panel.risco_alarm', 'armed_home') %}
#              1234        
#            {% endif %}

The relevant difference is described in the documentation for Manual MQTT Alarm:

Manual Alarm Control Panel is essentially the opposite of the MQTT Alarm Panel which allows Home Assistant to observe an existing, fully-featured alarm where all of the alarm logic is embedded in that physical device.

Key phrase: “Where all of the alarm logic is embedded in that physical device.” If an alarm panel is commanded to arm itself, it will (usually) expect to receive a valid passcode and then it will respond with its status (“armed”).

Manual MQTT Alarm works without a physical alarm system. It provides the same kind of command and response messages as a physical alarm system. Whats missing are the sensors and logic (automations) that perform the same functions as a physical alarm panel.

I use the MQTT Alarm Panel component with a physical alarm system (an ELK M1). However, it lacks the ability to send the passcode to the ELK M1. The M1 needs to receive a valid passcode otherwise it will ignore commands to arm/disarm itself. The component doesn’t support this feature so I modified its code so it could handle a code_command_topic. I also added state_template.

Here’s what my entry looks like using my modified component (mqtt_alarm):

alarm_control_panel:
  - platform: mqtt_alarm
    name: Security System
    state_topic: "premise/home/securitysystem/securitystate"
    state_template: >-
      {% set values = { '0': 'armed_away', '1':'disarmed', '2':'armed_home', '3':'triggered'} %}
      {{ values[value] if value in values.keys() else 'disarmed' }}
    command_topic: "premise/command/home/securitysystem/securityaction"
    payload_disarm: 1
    payload_arm_home: 2
    payload_arm_away: 0
    code_command_topic: "premise/command/home/securitysystem/disarmcode"
    code: !secret alarm_panel_code
    retain: false

Let me know if this interests you and I’ll post the custom component’s code.

1 Like

ok, thnx in advance, appreciate the comment
well, i my case, the logic is embedded in the external alarm system
i just need to send a topic arm/disarm with MQTT to my other service running on another server
in that other component is already my real actual code setup to arm or disarm

so i hassio if i use as code 1234 so i acntually can press the arm/disarm button, at the end it doesnt mather, since the code embedded in my other server is arming/disarming…
so i dont need to send the passcode, i just want a passcode, if want to use a new HA panel on my front door, so i can trow away my original panel from alarm it self

i hope this clears up ?

so therefore, if i just changed the platform from mqtt to manual_mqtt , the panel is HA is not working anymore
it doesnt change the state, and pressing arm/disarm doesnt do anything,

but i see that you use as platform: mqtt_alarm , thats again something else? i dont see it described on the pages?

hmm :

Configuration invalidCHECK CONFIG

Platform not found: alarm_control_panel.mqtt_alarm

ow ok, i read it now again, i need your custom component :slight_smile:

@123 , is your custom component also capable to use a code for disarming only ? just t use on the panel, so it sends the mqtt message , so my service runnng accepts the disarm command to disarm my physical alarm system

I believe the code is sent for both arm and disarm commands.

so this is not possible with your code? but you can share anyway :slight_smile:

#    code_template: >-
#            {% if is_state('alarm_control_panel.risco_alarm', 'armed_away') %}
#              1234
#            {% elif is_state('alarm_control_panel.risco_alarm', 'armed_home') %}
#              1234        
#            {% endif %}

My custom component does not support a code_template.

The code is published as an MQTT topic (see my example above). It’s up to the subscriber to decide whether to use it or not.

ok, do you see a possibility for me?
i just need to have a code entered in the alarm panel, just for disarming only
i dont care what code it is, can be setup in HA,
i dont need it actually for disarming the alarm, since its already embedded in other script, i just want to have a code entered in Home assistant on the panel

Then you don’t need my custom component. MQTT Alarm already does what you want. From the documentation for code:

code: If defined, specifies a code to enable or disable the alarm in the frontend.

The code is only used by the frontend UI and is not shared via an MQTT topic. In other words, the code is not sent to another device and is only used by the UI to validate the user’s arm/disarm commands.

I know, but the problem is that you also need a code to arm … I just want to have to enter a code to disarm

From what I’ve read, code is used for arming and disarming by both MQTT Alarm and Manual MQTT Alarm. So, as far as I can see, what you want (code not used for arming) isn’t supported by either component.

If you don’t want to use a code for arming, perhaps you should just create a script because they are rendered as pushbuttons in the UI. Simply push the button to arm the alarm system. The script would just use mqtt.publish to publish the arming command to riscopanel/armstatus/SET.

yes, was also thinking about a script/button for arming
but its nice to have the alarm panel, since its has a key pad

so i end with a keypad with a functional disarm button and code, but the arm button doesnt work
so i need to make a new arm button/script, that doesnt look good

another approach is to have a look at the mqtt PY code that is used now, modify it, delete the lines with arming with a code or something like that, and load it as a new custom component

this code

maybe i just need to change or delete lines 203 - 204

    if not self._validate_code(code, 'arming away'):
        return

i think deleting those lines is enough , so codes doesnt get validated, then i can enter what i want or enter nothing

And lines 190-191 (for arm_home).

Indeed , if it works :wink:

So I need it for example to rename it to mqtt_alarm.py , place it in custom_compontens folder, then make platform also mqtt_alarm?

Or just copy the modified file in custom folder and subfolder mqtt leave platform: mqtt, and HA is smart enough to load the custom one?

Ok @123 , last question , on arming, I want to have a delay for like 30 seconds when I press the arm button, on the manual_mqtt there is a pending time, on this mqtt platform it’s missing, any idea how I can do that? Because when I arm now , it instants arms my alarm, no time to actually leave my house :wink:

Yes.

Yes.

Either option will work. I prefer the first one (rename it) because it reminds me that I am using a custom version of the component and not the standard version.

You could copy the relevant delay code from Manual MQTT Alarm to your custom component (and then test/debug it). However, a simpler solution would be to create an automation that serves as a broker (a ‘middleman’) between MQTT Alarm and your alarm system.

For example:

    state_topic: "riscopanel/armstatus"
    command_topic: "riscopanelbroker/command"
  • The automation subscribes to riscopanelbroker/command.
  • If it receives an “arm_away” command, it does two things:
    – 1 Publishes “pending” to riscopanel/armstatus
    – 2 Waits 30 seconds, then publishes “arm_away” to riscopanel/armstatus/SET
  • If it receives a “disarm” command, it immediately publishes it to riscopanel/armstatus/SET

ok, i almost understand
but why do i need to publish pending? why not just an automation that waits 30 seconds and that just publishes arm_away ?

ok, i understand the pending
its just the status of the alarm control panel itself