YET another take on an alarm system

Hi @gazoscalvertos

I have several questions/suggestions:

  • could it be used with different arming codes (for each family member)? Meaning each has its own code while keeping the panic mode code the same for all; by doing this it can be further included into a sensor to show who’s code was used for arming/disarming;
  • set the iframe color scheme to be the same as HADashboard (when used with HADashboard widget it is showing the proper background however with iframe it loads as in HA);
  • add a counter for each sensor triggering while in armed mode;
  • add digit input obfuscating; when used from the regular HA component digits are not shown however in the custom panel they are in clear.

Thanks

1 Like

Hello,

I have a Cyrus 4 in 1 Multisensor and would like to use the motion sensor entity to trigger the alarm. There is also a entity called binary_sensor.vision_zp3111_multisensor_4in1_sensor but the status is always off. So I tried to use the entity sensor.vision_zp3111_multisensor_4in1_burglar instead. When no motion detected the status is “0”, when motion detected the status is “8”. I have tried it in the beggining with the normal “Manual Alarm” functionality in Home Assistant and it worked quite well with the following content in my automation.yaml:

  • action:
    • service: alarm_control_panel.alarm_trigger
      alias: Trigger alarm while armed away
      condition:
    • condition: state
      entity_id: alarm_control_panel.ha_alarm
      state: armed_away
      id: ‘1517755696067’
      trigger:
    • entity_id: sensor.vision_zp3111_multisensor_4in1_burglar
      platform: state
      to: ‘8’
  • action:
    • service: notify.einbrecher_meldung
      data:
      message: ALARM! The alarm has been triggered
      alias: Send notification when alarm triggered
      condition: []
      id: ‘1517763798806’
      trigger:
    • entity_id: alarm_control_panel.ha_alarm
      platform: state

How can I add the sensor.vision_zp3111_multisensor_4in1_burglar into this alarm system with the status “0” and “8”?

Hi,

The automation remains roughly the same (although I would suggest setting a binary sensor with on/off instead of the sensor with 8/0 payloads for motion as you could also use sensor class).

Just change the alarm panel entity_id to the actual one (alarm_control_panel.house if you did not modify the setting in the github).

Hello Petrica,

thank you for your reply. I´m quite new in HA so could you explain more in detail what to do please?

I have added both entities (sensor.vision_zp3111_multisensor_4in1_burglar and binary_sensor.vision_zp3111_multisensor_4in1_sensor) into the alarm.yaml but I can only see the binary_sensor.vision_zp3111_multisensor_4in1_sensor in the panel below “All Sensors”.
The sensor.vision_zp3111_multisensor_4in1_burglar is not listed there.
The binary_sensor.vision_zp3111_multisensor_4in1_sensor always has the status “off” so for me it is not clear how to integrate the burglar sensor.

Hi Robjay,

Does the automation work with the new entity id for the alarm panel?

My suggestion was that (after you solve the alarm panel issue) to use, in the automation, a binary sensor instead of a simple sensor as it can be setup with a class (it adds a custom icon for when is motion detected vs. when no motion). I was not referring to use the binary sensor set by Cyrus 4. A binary sensor in your case can be setup as a template (see below) although I think that the Z-wave panel should allow you to set it as “native” binary sensor (however, in my case, I found the process to be quite annoying).

Have a look at the binary sensor documentation:

Basically the payload need to be open/true/on or closed/false/off and it is easier to do automations based on state “on” or “off” as it is standardized.

Also, there’s another advantage for using binary sensor instead of simple sensor as in the state you can also use “for” clause (as in “how long was the binary sensor in the state on or off?”).

I didn’t used 0 as payload for false as my Z-wave sensor also throws 254 when not in use for some time.

- platform: template
  sensors:
    zwave_vision1:
      value_template: '{% if is_state("sensor.vision_zp3111_multisensor_4in1_burglar", "8") %}true{% else %}false{% endif %}'
      friendly_name: 'Zwave Vision 1'
      device_class: motion
1 Like

Thank you very much. It works like a charm now.
I just had a little trouble with the device_class “motion” because in my sensors.yaml it didn´t work but then I have put in the my customize.yaml and now it works.

Hello people, thanks for the contribution. I still can not see the sensors, can you help me set them up? Thank you

Hi @Holand86,

What sensors do you need help setting? The ones to be used by the alarm panel or the Z-wave type?

Wanting to use HTTP Shortcut program which would be the URL?

For a light is this below (then specifying json), for arming the alarm?

https://XXX.duckdns.org/api/services/light/toggle?api_password=XXX

Hi,

I don’t use duckdns but in lan works with:

http://192.168.x.x:8123/api/services/alarm_control_panel/alarm_arm_away

1 Like

thanks, this works.

I guess the alarm_disarm is not working, becasue you will need to put a code ? Any way to have a widget for that?

Disarming works with (however the code is in clear):

curl -v -X POST -H “Content-Type: application/json” -d ‘{“entity_id”:“alarm_control_panel.house”,“code”:“xxxx”}’ http://127.0.0.1:8123/api/services/alarm_control_panel/alarm_disarm

What kind of widget are you referring? In the alarm panel or outside of it (as in HA button or HADashboard)?

with Android Program HTTP Shiortcut

Disarming is not working, it says: failed with status code 400"

Are you able to disarm it when connected over ssh to the HA install?

putting the password I guess

pi@pi2:~ $ curl -v -X POST -H “Content-Type: application/json” -d ‘{“entity_id”:“alarm_control_panel.house”,“code”:“5528”}’ http://192.168.1.12:8123/api/services/alarm_control_panel/alarm_disarm?api_password=xxxxx
Note: Unnecessary use of -X or --request, POST is already inferred.

  • Could not resolve host: application
  • Closing connection 0
    curl: (6) Could not resolve host: application
    Note: Unnecessary use of -X or --request, POST is already inferred.
  • Rebuilt URL to: ‘“code”:“5528”’/
  • Illegal port number
  • Closing connection -1
    curl: (3) Illegal port number
    Note: Unnecessary use of -X or --request, POST is already inferred.
  • Trying 192.168.1.12…
  • TCP_NODELAY set
  • Connected to 192.168.1.12 (192.168.1.12) port 8123 (#1)

POST /api/services/alarm_control_panel/alarm_disarm?api_password=xxxxxx HTTP/1.1
Host: 192.168.1.12:8123
User-Agent: curl/7.52.1
Accept: /
Content-Length: 53
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 53 out of 53 bytes
    < HTTP/1.1 400 Bad Request
    < Content-Type: application/json
    < Content-Length: 40
    < Date: Sun, 11 Feb 2018 13:16:11 GMT
    < Server: Python/3.6 aiohttp/2.3.7
    <
  • Curl_http_done: called premature == 0
  • Connection #1 to host 192.168.1.12 left intact
    {“message”: “Data should be valid JSON”}pi@pi2:~ $

:slight_smile:

Use proper quotes

It should be " and ' not ” and ’

Ok changed, but still nothing …?

pi@pi2:~ $ curl -v -X POST -H “Content-Type: application/json” -d ‘{“entity_id”:“alarm_control_panel.house”,“code”:“5528”}" http://192.168.1.12:8123/api/services/alarm_control_panel/alarm_disarm?api_password=xxx

Did you change all quotes?

Use the preformatted markings (</>) when posting as some of the quotes still appear of the wrong type.

Nope; you should not see this error message if the JSON had the correct structure