Where “smartMC” and “smartMS” two different test MQTT topics. I can armed home, disarm etc. with state_topic just publish a packet to smartMC with right data. With state_topic it work correctly.
But command_topic doesn’t work.
I try to publish a packet to smartMS with data (ARM_HOME, DISARM, etc…) but there was no effect.
I also try to use service alarm_control_panel.alarm_disarm and just type code in sensor panel but it was also no effect.
I mean when for example i type code (1111) in panel or just use any service of alarm control panel, nothing happens - installed alarm with state_topic (smartMC) doesn’t change state.
If i correctly understood MQTT alarm control panel, i can change state of alarm with state_topic (for example: when MQTT device triggered it send to smartMC topic data “triggered” and i have triggered alarm, right?). Also i can change state of alarm with command_topic (code panel or other services) but when i send data to smartMS topic or just type code, alarm panel doesn’t change state, altrough it should, right? Also with code panel i couldt set alarm, disarm, etc… panel but i can’t.
It’s just a topic for one of the sensors, but I use it for testing MQTT alarm panel.
Here I seem to begin to understand how it works. Correct me please if im wrong.
When i type code or use service it publish certain data to command_topic (DISARM, ARM_HOME, etc.) and when it comes to “smartMS” i should use automation for send data to state_topic “smartMC” for change state?
If your MQTT device is in the alarm state (burglar has broken into your home and triggered an alarm), the MQTT device should publish triggered to the state_topic (“smartMC”). Now Home Assistant knows the MQTT device is in alarm.
Correct. When MQTT Alarm Control Panel publishes ARM_AWAY to the command_topic (“smartMS”), the MQTT device should reply by publishing armed_away to the state-topic (“smartMC”). Upon receiving the reply, Home Assistant know the command it published was received, and acknowledged, by the MQTT device.
From the documentation, here are the commands and expected replies:
ARM_AWAY - > armed_away
ARM_HOME → armed_home
DISARM - > disarmed
The MQTT device can also send two special messages:
triggered → MQTT device is in alarm state.
pending → MQTT device has received a command and is busy processing it.
Ok, i understood.
Last question: how can i publish right command to state_topic of MQTT alarm after receiving data from command_topic?
It should be done with the help of the service, automation or what?
That depends on the device itself. For example, when you arm it (ARM_AWAY), what does it send as a response?
If it sends no response, then there’s not much you can do!
If it responds but not with the phrase armed_away, then you have to create some kind of translator to convert the phrase to armed-away and then publish it to the state-topic. This is what some people have done using an additional sensor and an automation.
I did something different. I modified the code, for the MQTT Alarm Control Panel platform, so that it supports a state_template. I described it here. Let me know if it interests you.