Texecom2mqtt: Texecom alarm panel and MQTT integration with HA support

Well, I gave in an ordered a Premier Elite 24 for 83 EUR which should be arriving in about a week. This is just too important to not have connected to HA. I should be back in a few weeks with some feedback and certainly more questions. Thanks, Daniel!

I would like to configure phone notifications if alarms triggers. Anyone has any template that will send the sensor that triggered the alarm?

Thanks, restarting home assistant did the job after changing the config.yml and restarting the docker container

Add-in form would make me very happy indeed as presumably I wouldn’t have to move from my current HassOS installation.

In the meantime, I’ve downloaded docker to my laptop to have a play and see if I can get it working in it’s current form. Regard me as the idiot test :slight_smile:

You might be able to use the Portainer addon to install the docker container. I haven’t done this, so don’t know if it would work though

I’ve added a couple of new features.

  1. The app now sends log messages from the panel to the MQTT topic texecom2mqtt/XXXX/log. This is useful for doing automations based on various events. For example, I’ve set up an automation which alerts me to a bunch of failure events:
alias: "Alarm: log event"
trigger:
  platform: mqtt
  topic: texecom2mqtt/XXXX/log
condition:
  condition: template
  value_template: "{{ trigger.payload_json['type'] in ['ArmFailed', 'ACFail', 'LowBattery', 'MainsOverVoltage', 'PanelBoxTamper', 'BellTamper', 'AuxiliaryTamper', 'ExpanderTamper', 'KeypadTamper', 'FireZoneTamper', 'ZoneTamper', 'CodeTamperAlarm', 'PSUACFail', 'PSUBatteryFail', 'PSULowOutputFail', 'PSUTamper', 'PowerUnitFailure', 'BatteryChargerFault'] }}"
action:
  service: notify.phones
  data_template:
    message: "Alarm: {{ trigger.payload_json['description'] }}"
  1. You can now set the date and time by sending a message to texecom2mqtt/XXXX/datetime. I use this to sync the Home Assistant date and time every night.
alias: "Alarm: sync date and time"
trigger:
  platform: time
  at: "03:00:00"
action:
  service: mqtt.publish
  data_template:
    payload: "{{ now().isoformat() }}"
    topic: texecom2mqttt/XXXX/datetime

I hope they’re useful to people. I’m also looking at adding support for panel outputs soon.

4 Likes

I’ve been working on something similar. I’ve set it up by tracking the last active sensor and then including that in the notification.

To do so, you will need an input_text entity which stores the last active sensor:

input_text:
  recently_active_alarm_sensor:
    name: Recently active alarm sensor

Then add two automations. The first tracks the most recently active sensor:

automation:
  - alias: "Alarm: recently active"
    trigger:
      platform: state
      entity_id: binary_sensor.master_bedroom_motion_sensor, binary_sensor.hallway_motion_sensor, binary_sensor.living_room_motion_sensor, binary_sensor.front_door
      from: 'off'
      to: 'on'
    action:
      service: input_text.set_value
      data_template:
        entity_id: input_text.recently_active_alarm_sensor
        value: "{{ trigger.from_state.name }}"

The second triggers the notification on alarm.

automation:
  - alias: "Alarm: triggered"
    trigger:
      platform: state
      entity_id: alarm_control_panel.house_alarm
      to: triggered
    action:
      service: notify.phones
      data_template:
        title: House Alarm Triggered
        message: "Last active sensor: {{ states('input_text.recently_active_alarm_sensor') }}"
        data:
          push:
            sound:
              critical: 1
              volume: 1.0

This example uses iOS notifications and sends them as ‘critical’ which means your phone will still make a sound even if your phone is on silent and will show in CarPlay etc.

Obviously change your entity_ids and notification service but it should be a start at least.

3 Likes

Hi - I’m about to update my system to a premier elite controller with add-on communicator(s).

Hopefully someone can clarify something that is not clear to me - If I want to access the system with both the Texecom app and home assistant at the same time, will I need to install both SmartCom and ComIP or is SmartCom alone sufficient to handle both use cases?

Thank you, i’ll give it a go. I’ve installed Portainer and created the container with Daniels image but it fails constantly. However…as i’m a complete noob to this I have probably set it up completely wrong.

I don’t want to derail this thread too much so if anyone has any pointers for where I should start for idiot proof guides/help on how to set up containers it would be greatly appreciated.

Hi Guys

Does this work with IPCom?
I have a premier 412 version 11.0 and get the following error:

Starting texecom2mqtt … done
Attaching to texecom2mqtt
texecom2mqtt | 2020-09-04 06:15:41 - INFO: Connected to alarm, sleeping for 0.5 seconds…
texecom2mqtt | 2020-09-04 06:15:42 - INFO: Connection ready
texecom2mqtt | 2020-09-04 06:15:42 - INFO: Fetched serial number: 1153715
texecom2mqtt | 2020-09-04 06:15:42 - INFO: Logging in
texecom2mqtt | 2020-09-04 06:15:42 - DEBUG: Executing command 1
texecom2mqtt | /snapshot/app/dist/texecom/texecom.js:57
texecom2mqtt | throw new Error(Unexpected start, expected 't', got ${headerStart});
texecom2mqtt | ^
texecom2mqtt |
texecom2mqtt | Error: Unexpected start, expected ‘t’, got :heart:
texecom2mqtt | at Texecom.parseBuffer (/snapshot/app/dist/texecom/texecom.js:57:19)
texecom2mqtt | at Socket. (/snapshot/app/dist/texecom/texecom.js:216:22)
texecom2mqtt | at Socket.emit (events.js:315:20)
texecom2mqtt | at emitReadable_ (_stream_readable.js:562:12)
texecom2mqtt | at processTicksAndRejections (internal/process/task_queues.js:83:21)

Hi Marcel,

according to the author, the app uses the Texecom Connect protocol and therefore is only compatible with Premier Elite controllers:

I’d appreciate if someone had some insight on this.

I only have a SmartCom and can use both the Texecom app and this in parallel, with some limitations. I don’t get Texecom alerts when this is running (but can set the equivalent up in Home Assistant), and the calendar in the app doesn’t work (but it was pretty useless anyway)

Hi, I am a NOOB when it comes to docker.

I first tried to install this on a PI following this giuide


so doocker is up and running.

I have also installed docker desktop on my WIN 10 desktop.

I do not know now how to install the image / container, I have followed this


Again no problem following these steps.

I am stumped when it comes to Dockerfile and Docker Pull Command as all the examples point to GIT?

When I use the command docker build --tag dchesterton/texecom2mqtt . I get all kinds of errors.

Normally I would not attempt this but unfortunately this is my only option to achieve this integration at present.

Hi Mark,

the docker build command is used to make your own container from a DOCKERFILE you’ve created yourself. In this case you’re using the dchesterton/texecom2mqtt container that has been published to docker hub - therefore you need to use the “docker run” command, as per this post:

That being said, the author of the container recommends to use docker-compose in the container documentation, which is the way I am using it currently. See https://hub.docker.com/r/dchesterton/texecom2mqtt:

Running in Docker

Docker is currently the only supported way of running the application. A docker-compose.yml example is shown below:

version: "3"
services:
    texecom2mqtt:
        container_name: texecom2mqtt
        image: dchesterton/texecom2mqtt:latest
        restart: unless-stopped
        volumes:
            - ./config.yml:/app/config.yml

So for this, you’d create a directory, add the docker-compose.yml file as above and your config.yml file. Then using the docker-compose up command will download/run the container and use your configuration file.

I think there was talk earlier in this thread above of turning this into a fully-fledged home assistant add-on to make this more user-friendly but I’m not sure if it’s been implemented yet.

Note you’ll also need to set up a MQTT broker (such as the mosquito add-in available in home assistant)

Thanks, Anthony. If that is the case then I guess I’ll need to make a decision about whether or not these are things I can live without.

I’m also wondering if it’s physically possible to have both SmartCom and ComIP communicators installed on the panel.

Hi Chris,

Many thanks for the confirmation, after much googling yesterday I managed to get it up and running on Docker-Desktop and your above write up serves as confirmation.

My issue now is that i am trying to replicate the same on my R PI.
These are my steps.

  1. Installed the Raspberry Pi OS 32 bit Lite version and enabled SSH.
  2. Login
  3. Install Docker

curl -sSL https://get.docker.com | sh

  1. Add permission to Pi User to run Docker Commands

sudo usermod -aG docker pi

Reboot

  1. Test Docker installation

docker run hello-world

  1. Install proper dependencies

sudo apt-get install -y libffi-dev libssl-dev
sudo apt-get install -y python3 python3-pip
sudo apt-get remove python-configparser

  1. Install Docker Compose

sudo pip3 -v install docker-compose

nano Dockerfile
save and exit

nano config yml
save and exit

nano docker-compose.yml
save and exit

docker-compose up

pi@raspberrypi:~ $ docker-compose up
Starting texecom2mqtt ... done
Attaching to texecom2mqtt
texecom2mqtt    | standard_init_linux.go:211: exec user process caused "exec format error"

docker ps

pi@raspberrypi:~ $ docker ps
CONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS                         PORTS               NAMES
218e2da192af        dchesterton/texecom2mqtt:latest   "docker-entrypoint.s…"   13 hours ago        Restarting (1) 6 seconds ago                       texecom2mqtt

Any Ideas?
texecom2mqtt | standard_init_linux.go:211: exec user process caused “exec format error”

Regards,

The “exec format error” is almost certainly due to trying to run an application compiled for a different processor architecture.

Tried on my Pi 4, same results.


pi@raspberrypi:~ $ docker-compose up
Creating network "pi_default" with the default driver
Pulling texecom2mqtt (dchesterton/texecom2mqtt:latest)...
latest: Pulling from dchesterton/texecom2mqtt
cbdbe7a5bc2a: Pull complete
c6b8a3ced104: Pull complete
b5b015038032: Pull complete
5228d41d469d: Pull complete
0050f54e85db: Pull complete
fec675876f14: Pull complete
Digest: sha256:b6fc7a8dadccf9fcdda1ddcf59505db942ba7e95f97e10389ebe98dd392b66df
Status: Downloaded newer image for dchesterton/texecom2mqtt:latest
Creating texecom2mqtt ... done
Attaching to texecom2mqtt
texecom2mqtt    | standard_init_linux.go:211: exec user process caused "exec format error"

So would I be right in saying you cannot run this on a Raspberry Pi, only in Docker Desktop WIN / MAC?

I am not too familiar with running containers on pi but based on your logs I’d hazard a guess that it’s the node image referenced in the container itself not being arm-compatible:

https://hub.docker.com/r/dchesterton/texecom2mqtt/dockerfile

FROM node:14-alpine AS build

WORKDIR /app

COPY package.json .
COPY yarn.lock .
RUN yarn install --frozen-lockfile

COPY tsconfig.json .
COPY src .
RUN yarn build
RUN yarn compile

FROM node:14-alpine

WORKDIR /app

COPY --from=build /app/texecom2mqtt ./app/texecom2mqtt

CMD ["./app/texecom2mqtt"]