Intruder Alert System with Home Assistant – Part 2

This is the second part in my Intruder Alert System series in which I describe my DIY solution to building an automated alarm system using an actual alarm and Home Assistant. Here is the link to Part 1, in case you missed it.

I use a Lovelace dashboard in Home Assistant which gives me a quick overview of my Intruder Alert System and can be easily extended to include additional devices. In the current version it contains alarm sensors and control interfaces provided by Paradox Alarm Interface addon, security cameras provided by Generic Camera integration and lights provided by Tuya-local or SonoffLAN integrations. The dashboard uses Config Template Card that allows me to use pretty much any valid Javascript on the hass object in my configuration.

My house consists of two floors and for each of them I uploaded in Home Assistant an image with the 2D plan location /config/www/alarm. In the same location I uploaded other images which I use to overlay on the main floor plan. Below I included a picture with the dashboard for each floor and details on each configuration parameter.

Floor 1 dashboard

Floor 2 dashboard

Details:

  • entities – option which contains a list of entity strings that should be watched for updates. I added here all the entities that I used in each card. Since I don’t have that many entities, I was able to monitor all of them, but be sure to choose only the most relevant ones in case you have a lot of entities becauase this impacts the performance.
  • card – is of type picture-elements and links to the local image contains the 2D floor plan
  • sensor entities – each sensor is integrated using its own element of type image, linked to the corresponding entity. The state_image option contains links to images used for states on and off which are stored in the same location as above. With style option I control the position of the element on the main image, by adjusting the top, left and width parameters
  • alarm control entity – I have three conditional elements for configuring the states of the entity that controls the arming/disarming of the alarm. The displayed image for each state is configured with image option. The state of the entity is specified with state option. The action to be performed when tapping the displayed image in described in the tap_action option. With style option I control the position of the element on the main image, by adjusting the top, left and width parameters
  • security camera entities – For each security camera I have an image element. The entity option points to the security camera entity. image points to the local image of the security camera which will be displayed on the floor plan. With style option I control the position of the element on the main image, by adjusting the top, left and width parameters.
  • light entities – Currently I only have one light configured, which is mapped to a Sonoff switch. To view it on the dashboard I use an icon element. I configured a template which changes the icon depending on the state of the switch(on/off). tap_action option contains the toggling action to be performed when clicking on the image. Similar to the other entities, with style option I control the position of the element on the main image, by adjusting the top and left parameters. With the color parameter, I change the state of the icon color to yellow when the switch is on and blue when the switch is off.

Conclusions:

This is the current version of the Dashboard that I use for my Intruder Alert System. I covers the second use case defined in Part 1. With it, I can manually activate/deactivate the alarm system remotely, access my security cameras and view the state of each sensor.

In the future, I plan to use Sweet Home 3D and create a more interactive 3D floor plan and I will keep you updated with another blog post when this project will be done.

In the next part of the series, I will described the automation I have sends notifications on my mobile phone and a private Telegram channel when a sensor is activated and the alarm is armed. Below I included the code used for each floor. In case you want to use it, please make sure you change the entities with the ones specific to your integration.

Floor 1 config template card code:

type: custom:config-template-card
entities:
  - switch.sonoff_1000291bc4
  - binary_sensor.birou
  - binary_sensor.hol_intrare
  - binary_sensor.depozit_scara
  - binary_sensor.cutie
  - binary_sensor.living
  - binary_sensor.bucatarie
  - binary_sensor.camara
  - binary_sensor.smoke_detector
  - alarm_control_panel.sp6000_partition_toata_casa
view_layout:
  column: 2
card:
  type: picture-elements
  image: /local/alarm/house_plan_first_floor_alarm.jpg
  elements:
    - type: image
      entity: binary_sensor.birou
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 59.2%
        left: 31.7%
        width: 4%
    - type: image
      entity: binary_sensor.hol_intrare
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 69.2%
        left: 36.5%
        width: 4%
    - type: image
      entity: binary_sensor.depozit_scara
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 47%
        left: 44%
        width: 4%
    - type: image
      entity: binary_sensor.cutie
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 52%
        left: 44%
        width: 4%
    - type: image
      entity: binary_sensor.living
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 67%
        left: 53%
        width: 4%
    - type: image
      entity: binary_sensor.bucatarie
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 70%
        left: 77%
        width: 4%
    - type: image
      entity: binary_sensor.camara
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 78.5%
        left: 80.5%
        width: 4%
    - type: image
      entity: binary_sensor.smoke_detector
      state_image:
        'off': /local/alarm/smoke_alarm_inactive.jpg
        'on': /local/alarm/smoke_alarm_active.jpg
      style:
        top: 78.5%
        left: 60%
        width: 4%
    - type: conditional
      conditions:
        - entity: alarm_control_panel.sp6000_partition_toata_casa
          state: disarmed
      elements:
        - type: image
          image: /local/alarm/security_alarm_disarmed.jpg
          tap_action:
            action: call-service
            service: alarm_control_panel.alarm_arm_away
            service_data:
              entity_id: alarm_control_panel.sp6000_partition_toata_casa
          style:
            top: 78.5%
            left: 47%
            width: 4%
    - type: conditional
      conditions:
        - entity: alarm_control_panel.sp6000_partition_toata_casa
          state: arming
      elements:
        - type: image
          image: /local/alarm/security_alarm_arming.jpg
          tap_action:
            action: call-service
            service: alarm_control_panel.alarm_disarm
            service_data:
              entity_id: alarm_control_panel.sp6000_partition_toata_casa
          style:
            top: 78.5%
            left: 47%
            width: 4%
    - type: conditional
      conditions:
        - entity: alarm_control_panel.sp6000_partition_toata_casa
          state: armed_away
      elements:
        - type: image
          image: /local/alarm/security_alarm_armed.jpg
          tap_action:
            action: call-service
            service: alarm_control_panel.alarm_disarm
            service_data:
              entity_id: alarm_control_panel.sp6000_partition_toata_casa
          style:
            top: 78.5%
            left: 47%
            width: 4%
    - type: image
      entity: camera.camera_fata_dreapta
      image: /local/alarm/security_camera.png
      style:
        top: 89%
        left: 10.3%
        width: 4.3%
    - type: image
      entity: camera.camera_fata_stanga
      image: /local/alarm/security_camera.png
      style:
        top: 93.8%
        left: 87%
        width: 4.3%
    - type: image
      entity: camera.camera_lateral
      image: /local/alarm/security_camera.png
      style:
        top: 31.5%
        left: 91.5%
        width: 4.3%
    - type: image
      entity: camera.camera_spate
      image: /local/alarm/security_camera.png
      style:
        top: 31.4%
        left: 10.7%
        width: 4.3%
    - type: icon
      icon: >-
        ${if (states['switch.sonoff_1000291bc4'].state === 'on')
        'mdi:lightbulb-on';else 'mdi:lightbulb'}
      tap_action:
        action: toggle
      entity: switch.sonoff_1000291bc4
      style:
        top: 35%
        left: 85%
        color: >-
          ${if (states['switch.sonoff_1000291bc4'].state === 'on') 'yellow';else
          'blue'}
        '--iron-icon-height': auto
        '--iron-icon-width': 4vh

Floor 2 config template card code:

type: custom:config-template-card
entities:
  - binary_sensor.dormitor_oaspeti
  - binary_sensor.dormitor_mare
  - binary_sensor.dormitor_sabrina
  - binary_sensor.dresing
  - alarm_control_panel.toata_casa
card:
  type: picture-elements
  image: /local/alarm/house_plan_second_floor_alarm.jpg
  elements:
    - type: image
      entity: binary_sensor.dormitor_oaspeti
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 61%
        left: 37.5%
        width: 4%
    - type: image
      entity: binary_sensor.dormitor_mare
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 56%
        left: 67%
        width: 4%
    - type: image
      entity: binary_sensor.dormitor_sabrina
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 69%
        left: 70%
        width: 4%
    - type: image
      entity: binary_sensor.dresing
      state_image:
        'off': /local/alarm/sensor_inactive.svg
        'on': /local/alarm/sensor_active.svg
      style:
        top: 79%
        left: 48%
        width: 4%
    - type: conditional
      conditions:
        - entity: alarm_control_panel.toata_casa
          state: disarmed
      elements:
        - type: image
          image: /local/alarm/security_alarm_disarmed.jpg
          tap_action:
            action: call-service
            service: alarm_control_panel.alarm_arm_away
            service_data:
              entity_id: alarm_control_panel.toata_casa
          style:
            top: 67.5%
            left: 57%
            width: 4%
    - type: conditional
      conditions:
        - entity: alarm_control_panel.toata_casa
          state: arming
      elements:
        - type: image
          image: /local/alarm/security_alarm_arming.jpg
          tap_action:
            action: call-service
            service: alarm_control_panel.alarm_disarm
            service_data:
              entity_id: alarm_control_panel.toata_casa
          style:
            top: 67.5%
            left: 57%
            width: 4%
    - type: conditional
      conditions:
        - entity: alarm_control_panel.toata_casa
          state: armed_away
      elements:
        - type: image
          image: /local/alarm/security_alarm_armed.jpg
          tap_action:
            action: call-service
            service: alarm_control_panel.alarm_disarm
            service_data:
              entity_id: alarm_control_panel.toata_casa
          style:
            top: 67.5%
            left: 57%
            width: 4%

Intruder Alert System with Home Assistant – Part 1

Over the years I have gathered a lot of subscriptions, which add to quite a substantial amount of money that I have to pay every month. After I installed the alarm system from Paradox in my house, I was surprised to see that they also have a yearly subscription to get notifications on your phone and do some basic remote alarm configurations.

Having an instance of Home Assistant running in my HomeLab, I started to research if it was possible to integrate my alarm system and create an automation to offer at least the same functionality as the manufacturer and avoid paying their subscription. This post is the first part in a series I plan to share with you in which I offer details on my DYI Intruder Alert System with Home Assistant.

My alarm system is Paradox Spectra SP6000+ with 8 zones which can have 2 physical sensors attached to them using resistance of different values. I have one motion sensor in every room of the house, a smoke detector in the kitchen and a siren outside on the front house wall. They are all connected to a central panel together with a small battery which can offer up to a day of runtime in case the power is lost. In order to communicate over Ethernet with my HomeLab, I bought from Paradox an IP150 Internet Module. I spent almost two months mounting and wiring all the sensors and researching online for various tutorials on how to configure the alarm system. Paradox offers paid training to certified installers so the information was quite difficult to obtain. Having all the necessary hardware, it was time to focus on the software and see what wonders I could do!

First thing I did was to install and configure Paradox Alarm Interface addon in Home Assistant. This is a middleware that connects to a Paradox Alarm panel, exposing the interface for monitoring and control through MQTT. I won’t detail the installations steps, because they can be found in PAI’s wiki. Once the configuration was done, I suddenly had 48 entities available in MQTT integration from Home Assistant, with various information from my alarm system. I could see in real-time when a sensor was active, arm or disarm the alarm and other internal signals. It was time now to put my thinking cap and do something useful with all this information.

Next I created a list of use cases for my future Intruder Alert System so I could figure out what functionalities available in Home Assistant I codul use. I came up with the following 4 use cases

  • Notification on sensor activation when alarm is armed
  • Dashboard to provide a quick overview of my Intruder Alert System
  • Arming the system when leaving home
  • Disarming the system when returning home

The final step was to somehow start implementing the use cases. I didn’t have much experience back then with Home Assistant, so this project involved quite a steep learning curve. In my first iteration, I implemented all use cases except the dashboard in NodeRed because of it’s nice graphical interface. Recently I started to migrate from NodeRed to native Home Assistant automations, because there are some limitations with it and in the recent releases of HomeAssistant the GUI for automations has been improved a lot.

In the next part of the series, I will provide details on the dashboard I created to give me a quick overview of my Intruder Alert System.

What to do with USD in Romania?

It turns out that it is very difficult to do something useful in Romania with US Dollars and below I’d like to share my experience on this matter.

A while ago I worked at a company which offered RSU(Restricted Stock Units) as a form of employee benefits. After a certain period of time, the stock was transferred to me, and I could do whatever I wanted with it. I decided to sell the it, because the company stock appreciated quite a lot and I wasn’t sure the price will would remain like that for a long time. I ended up with a bunch of US Dollars in my US broker account and I somehow had to figure out how to get them in Romania, the country where I lived, so I could actually benefit from them.

The US broker offered two options to transfer the money to a bank. I could either transfer them to an USD account with no additional fee, or convert the USD to a certain currency, for a rather high fee. I didn’t want to pay a fee for converting them either to EUR or RON(Romanian currency) which were the only two currencies in which I had accounts in my own country, but I didn’t had an USD account either.

After asking several banks in Romania if they offered an account in USD, it turned out I didn’t had that many options. I found a bank which offered an account in USD but it had a monthly maintenance fees, and the conversion from USD to RON was very bad. As you probably already figured out, I hate paying fees so at that time, my options were not looking so good.

In the end I chose to risk it and go with Revolut which offered a free USD account, even if I heard some horror stories with accounts being blocked. I reached out to support and inform them that a larger payment would arrive in my account. I asked them if they need any documents to prove where the money originated from. They said it was ok and I didn’t had to send anything. This way I hoped to avoid my account to be blocked. I finally issued the transfer from the US broker to my Revolut account. It took almost two weeks, but in the end the money arrived in my account and I felt relieved that the entire adventure was over!

Next step was to figure out what to do with my nice and shiny pile of… virtual $$$ 🤑

I did the only logical thing in this situation, create a list of pros/cons 🤣

Pros:

  • Increase diversity of the cash I owned
  • Avoid currency conversion fees when buying financial instruments or goods denominated in USD

Cons:

  • Difficult to find a bank in Romania that offers an USD account without additional fees to keep the money for a longer period of time
  • Limited availability of USD deposits
  • Transfers between USD accounts took a long time and had high fees compared to SEPA transfers in EUR
  • Almost no products in Europe are sold in USD
  • Exchange rate to other currency at banks were very bad

I ended up using once again Revolut. As part of the free standard plan I could exchange every month with no fee and at a decent rate, up to the equivalent of 5000 RON from USD.

I don’t know if this was the best decision but it was the best I could find with the available information at that time. Feel free to leave a comment with what you have done in a similar situation.