Giter VIP home page Giter VIP logo

risco-mqtt-bridge's Introduction

Risco (or MyElas) Panel <-> MQTT - bridge

Bridge Risco-MyElas Alarm panel to and from MQTT Server (to interface a home automation controller)

NPM

2019-02-12 UPDATE: With Beta 2.0 release supports Home Assistant Autodiscovery, so can discovery panel and Detectors without manual edit the config. Try it and let me know. Thanks

Motivation

This application is useful for interfacing a home automation controller that support MQTT protocol (for example Openhab, Home Assistant, etc... ) with Cloud Risco (or MyElas, depending on your country).

It can receive information from the Cloud Risco and send it to an MQTT server, or then receive commands via MQTT messages to be sent to the Cloud Risco(for example to arm or disarm your system).

ATTENTION: using this application you do it at your own risk, this is not an official Risco application. If you have access to the cloud installers area, I recommend you create another user and panel security code. However it is highly recommended not to share your cloud data (username, password, security code or site Id) on the internet, nor with other users.

Requirements

Installation

After installing Node.js, execute the following steps:

  • clone the repository with git clone https://github.com/lucacalcaterra/risco-mqtt-bridge.git
  • cd risco-mqtt-bridge
  • npm install
  • in config dir copy the config-example.js to config.js and fill your information (follow the Configuration section below)
  • launch with node app.js

if you want, you can use a process manager like pm2, nodemon, forever for automatically restart or launch at system boot the app.

Configuration

In config.js inside config folder, the mandatory parameters to be filled are:

Inside loginData section:

  • username : your cloud username
  • password : your cloud password
  • code : your cloud security code (for its username)
  • SelectedSiteId : your riscoSiteId *

Inside exports.Mqtt section fill MQTT_SERVER address (change port also, if different from the standard 1883 ); if MQTT server requires authentication fill username and password in options

If you want, you can change the MQTT topics where the messages are published inside channels section (in the lines there are brief descriptive comments )

*To get your riscoSiteId, login to riscocloud via ChromeBrowser (first login screen), and before providing your PIN (second login page), display source of the page and find string: <div class="site-name" ... it will look like:

<div class="site-name" id="site_12345_div"> In that case "12345" is your siteId (Thanks to szlaskidaniel in homebridge-risco-alarm project for this description)

To change polling interval (I suggest not to lower it too much, avoiding overloading of Risco servers) can change POLLINGINTERVAL param (in milliseconds)

Leave the other parameters as they are (if you do not know what you are doing)

Receive Informations and Send commands from/to Risco Cloud (and so ... to your alarm panel)

You can receive informations and send commands from your alarm system subscribing/publishing related topics.

Here is a simple example with following configuration topics (default topic and subtopics as in default-config.js):

channels: {
    MAINCHAN: 'riscopanel', // Main Topic
    ARMSTATUS: 'armstatus', // Arm status subtopic
    DETECTORS: 'dects', // Detectors subtopic
    EVENTHISTORY: 'eventhistory', // Event History subtopic
    ISONALARM: 'isonalarm', // Topic for receiving ongoing alarm
  },

Arming status

You can receive arming status subscribing to riscopanel/armstatus topic

Detectors data (triggered, bypassed/unbypassed and others)

Receive detectors data subscribing to riscopanel/dects for JSON data of all detectors or riscopanel/dects/15 for receive only data about detector with id 15 (example)

Event History data

Can receive Event History of your security panel subscribing to riscopanel/eventhistory for all events data (JSON format), or riscopanel/eventhistory/lastevent to retrieve last event riscopanel/eventhistory/today/errors to retrieve today's errors events (other possibilities must to be implemented)

Ongoing Alarm

Subscribing to riscopanel/isonalarm can receive messages if your panel is in alarm state (true if is on alarm / false not in alarm)

Arm/Disarm

You can send the following messages to riscopanel/armstatus/SET topic:

  • armed to arm partition
  • diarmed to disarm partition
  • partarmed to partially arm partition

(commands can be changed to the section armStatus in exports.States)

Bypass/Unbypass detectors

You can send the following messages to riscopanel/dects/{DetectorId}/SET topic:

  • bypass for bypass specific detector ({DetectorId})
  • unbypass for unbypass specific detector ({DetectorId})

Home Assistant

To make the bridge work with Home Assistant you must enable MQTT and use the MQTT Alarm Control Panel of HA (https://www.home-assistant.io/components/alarm_control_panel.mqtt/).

Configuration

Change config.js in transforms section as follow:

transforms: {
    // transforms states strings...to use for example in Home Assistant to reflect H.A.'s  alarm control panel states
    states: {
      disarmed: 'disarmed', 
      partarmed: 'armed_home', 
      armed: 'armed_away', 
      onalarm: 'onalarm', 
    },

....

Add following lines to configuration.yaml in HomeAssistant :

......
mqtt:
  broker: 127.0.0.1

alarm_control_panel:
  - platform: mqtt
    state_topic: "riscopanel/armstatus"
    command_topic: "riscopanel/armstatus/SET"
    payload_disarm: "disarmed" 
    payload_arm_home: "partially"
    payload_arm_away: "armed"
......

Run with Docker

You can run it with Docker, without having to install nodes and all of its dependencies. Cannot explain how Docker works in this README but if you know it a little, i give you some short examples... REQUIREMENTS: MQTT Server (You can run also mqtt server with docker in case you don't have it on your host). If you want can build the Docker image with Dockerfile provided in the repo.

Example running MQTT Server and Risco-Mqtt-Bridge with docker

  • 1- Run MQTT container (i.e. Mosquitto container- refer to: https://hub.docker.com/_/eclipse-mosquitto)
  • 2- Copy config.js from the github project, fill your params and run risco-mqtt-bridge container with : docker run --name risco-mqtt-bridge -v {path where copied}/config.js:/app/config/config.js lucacalcaterra/risco-mqtt-bridge You can also mount the logs dir if you want adding the param -v {your path}/logs:/app/logs

BONUS: I created the docker image for ARM also (for running i.e on Raspberry); to use it must append armhf tag when pull image: lucacalcaterra/risco-mqtt-bridge:armhf

Example running MQTT Server and Risco-Mqtt-Bridge with Docker Compose

If you know Docker Compose here is an example of a docker-compose.yml file:

docker-compose.yml:

version: '2.0'
services:
  mosquitto:
    image: eclipse-mosquitto
    container_name: mosquitto
    restart: unless-stopped
    ports:
      - "1883:1883"
      - "9001:9001"
    #volumes:
    # - ./mosquitto/config:/mosquitto/config
    # - ./mosquitto/data:/mosquitto/data - /srv/dockerct/mosquitto/log:/mosquitto/log
  risco-mqtt-bridge:
    image: lucacalcaterra/risco-mqtt-bridge # Append 'armhf' if you run it on ARM Platform
    container_name: risco-mqtt-bridge
    restart: unless-stopped
    #ports: - "3000"
    volumes:
      - ./config.js:/app/config/config.js
      - ./logs:/app/logs
    environment:
      - NODE_ENV=production

ISSUES/KNOWN BUGS/SUGGESTIONS

For now , it works only with one partition and does not manage groups

I'm using the application with my alarm system (using Openhab mqtt binding for receive arm status), please send me your feedbacks (opening ticket on issues in github page), so i can fix any issues.

Report them to: https://github.com/lucacalcaterra/risco-mqtt-bridge/issues

Tech/framework used

Support via PayPal

risco-mqtt-bridge's People

Contributors

dependabot[bot] avatar lucacalcaterra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

risco-mqtt-bridge's Issues

how to change the system pin class request

i need to change the system pin class from sitepin to key because my security company uses Risco software/control panel but on their own servers with the 2014 version of riscocloud and there the system pin HTML class is key

Connected to panel but no arming or disarming

Hi Luca,

I am using the Risco Commpact panel which is partitionless.
I can see from the command prompt when I arm or disarm my alarm from the Risco app.
However I cannot arm or disarm the alarm with MQTT.

15-03-2023 11:41:59 info: message from mqtt arrived:riscopanel/armstatus/SET/disarmed
15-03-2023 11:41:59 info: arm/disarm command arrived
15-03-2023 11:42:00 debug: user code is expired? : false
15-03-2023 11:42:00 debug: arm command result ok
15-03-2023 11:42:07 debug: polling ...
15-03-2023 11:42:08 debug: return null, overview empty!
15-03-2023 11:42:08 debug: Polled...counter: 109
15-03-2023 11:42:18 debug: polling ...
15-03-2023 11:42:19 debug: return null, overview empty!
15-03-2023 11:42:19 debug: Polled...counter: 110

Any ideas?

Node-red + real time feedback from sensors

Hello,
Someone is tried to use this with node-red platform and get feedback form the riscopanel/dects topic in real time when sensor is interrupted while alarm is disarmed?
I'm trying to use the sensors for running lighting scenario.

BR
Kobi

Risco cloud is now a pay service :-(

Hi, this happen in your country too ? About 23 euros per year.
I'm Very disappointed with Risco because pay service not bring us any improvements .

What do you think about ?

Luca

I need you feedbacks !

Hi,

i'm quite finished new version of this bridge using updated API (Thanks to @mancioshell )
But before to finish and publish i would like to know how many users still use it, since H.A. has now his own binding.

How many users use it for openhab or other domotics controller ? If prevalence is on openhab, is convenient to develop a native binding abandoning this project.

Thanks for you feedback.

Luca

Problem during arm

Hey Luca.
An error pops up when I am arming my alarm. See below
The alarm at the end is armed. Copying the messages before and after the arming.
For your information this is being used in a docker container and the image used is the latest from docker hub.

16-05-2023 08:32:02 info: Arming status: armed
16-05-2023 08:32:02 info: publish messages on MQTT Server
16-05-2023 08:32:02 info: Status panel infos arrived
16-05-2023 08:32:12 debug: polling ...
16-05-2023 08:32:13 debug: ...Control Panel State taken and overview not empty... OK
16-05-2023 08:32:13 debug: Polled...counter: 3004
16-05-2023 08:32:13 debug: newarmstatus emitted
16-05-2023 08:32:13 info: Arming status: armed
16-05-2023 08:32:13 info: Status panel infos arrived
/app/app.js:59
const detectorsArray = riscoPoller.riscoConn.riscoDetectors.parts[0].detectors;
^
TypeError: Cannot read properties of null (reading 'parts')
at RiscoPoller. (/app/app.js:59:67)
at RiscoPoller.emit (node:events:513:28)
at Timeout._onTimeout (/app/panelPoller.js:53:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.12.1
16-05-2023 08:32:22 debug: Class Connection Constructor end
16-05-2023 08:32:22 info: Express server started...
16-05-2023 08:32:22 info: Connected to MQTT Server
16-05-2023 08:32:23 debug: Logged...Response code is 302: OK

seems it doesnt reconnect after disconnected..

hey @lucacalcaterra

noticed lately that my state was not changing anymore, so turned on development
today i had the issue again, you see in log it was disconnected, it seems to reconnect, but it stopped polling?

log here ..

,05-04-2019 14:15:43 debug: return null, overview empty!
,05-04-2019 14:15:43 debug: Polled...counter: 5852
,05-04-2019 14:15:53 debug: polling ...
,05-04-2019 14:15:53 debug: return null, overview empty!
,05-04-2019 14:15:53 debug: Polled...counter: 5853
,05-04-2019 14:16:03 debug: polling ...
,05-04-2019 14:16:03 debug: return null, overview empty!
,05-04-2019 14:16:03 debug: Polled...counter: 5854
,05-04-2019 14:16:13 debug: polling ...
,05-04-2019 14:16:13 debug: return null, overview empty!
,05-04-2019 14:16:13 debug: Polled...counter: 5855
,05-04-2019 14:16:23 debug: polling ...
,05-04-2019 14:16:24 debug: return null, overview empty!
,05-04-2019 14:16:24 debug: Polled...counter: 5856
,05-04-2019 14:16:34 debug: polling ...
,05-04-2019 14:16:34 debug: return null, overview empty!
,05-04-2019 14:16:34 debug: Polled...counter: 5857
,05-04-2019 14:16:34 warn: Disconnected from cloud...relogin and init...
,05-04-2019 14:16:34 debug: Logged...Response code is 302: OK
,05-04-2019 14:16:35 debug: ...site and Pin Code sent...Response code is 302: OK
,05-04-2019 14:16:35 debug: ...Cameras taken...Response code is 200 and no data error: OK
,05-04-2019 14:16:36 debug: ...Event History taken...Response code is 200 and no data error: OK
,05-04-2019 14:16:36 debug: ...Detectors taken...Response code is 200 and no data error: OK
,05-04-2019 14:16:36 debug: ...Overview taken...Response code is 200 and no data error: OK
,05-04-2019 14:16:36 debug: return null, overview empty!
,05-04-2019 14:16:36 debug: newarmstatus emitted
,05-04-2019 14:16:36 info: Arming status: armed
,05-04-2019 14:16:36 info: publish messages on MQTT Server
,05-04-2019 14:16:36 debug: Init function for getting data from Cloud completed: OK
,05-04-2019 14:16:44 debug: polling ...

and then nothing, we are almost 2 hours later now

running in portainer

Question: Exit delay

hey Luca,

opened another question for this, in the other thread you mentioned that the exit timer is based on the app, and your code is using the the same timer

This project act as the Risco app , so if you arm the connection via mqtt the panel, it arms instantly. This behaviour can be changed from risco panel config (if you have the installer code )

well, i am looking in the installer manual, see below, but i cant find a setting to setup the exit delay timer
only an exit delay timer for the risco original panels

so how can you setup the delay timer , so the same exit delay timers is running when using your bridge?

https://www.dropbox.com/s/3kmgl55brebxp7o/5IN1482_LightSYS_Installer_Manual.pdf?dl=0

Unknown state in Home Assistant

ok, i get started with this
installed ubuntu, installed and config node js, changed config line

ps there is a typo in your readme = > onalarm: 'onalarm', should be triggered in your home assistant section
but anway,

installed MQTT server as addon on my home assistant
so i start your node, it gives me no error, i see info : connected to MQTT = OK
i see my status in the log of my alarm like armed/disamred, so OK, so its now started polling
that seems to be OK on that side

now in home assistant, added the config below, but the state of my alarm panel = UNKNOWN
mqtt broker is started without any error

so i dont know whats wrong :(

mqtt:
broker: 127.0.0.1
port: 1883
username: xxx
password: yyyy

alarm_control_panel:

  • platform: mqtt
    state_topic: "riscopanel/armstatus"
    command_topic: "riscopanel/armstatus/SET"
    payload_disarm: "disarmed"
    payload_arm_home: "partially"
    payload_arm_away: "armed"

Riscocloud upgraded to 5.2 , error code 200

today riscocloud upgraded to 5.2
seems this bridge doesnt connect anymore now :(

if i restart the docker, i now get :

18-09-2019 16:19:30 �[33mwarn�[39m: Disconnected from cloud...relogin and init...
18-09-2019 16:19:30 �[31merror�[39m: Exceptions on login response: Error: Request failed with status code 200

beta release

i pulled latest docker, but is it possible its not downloading the beta? only the 1.2 release?

Unable to set the alarm

Hello
I have following shown in the log. Were is the problem?

image

Other issue is that i'm getting error Failed to call service alarm_control_panel/alarm_arm_away. must contain at least one entity_id, area_id

Thank you very much

Armed command only arm Parition 1

Hi and thank you for your work.
Everythings seems to works fine except one things : with MQTT when you send "armed", only the first parition is armed.
Is it possible to have one topic for each partition ?

Cannot read property 'x' of undefined.

I have been receiving this error recently, and the status of the alarm is not reporting, yet it seems to be responding to commands.

Running inside docker.

I orignally thought the issue was related to the multi partition mod, but this happens on the unforked version too. Reference to the first reported issue is here.

log:

10-02-2020 17:12:49 debug: polling started...,
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'detectors' of undefined,
at RiscoPoller.riscoPoller.on (/app/app.js:58:76),
at emitNone (events.js:106:13),
at RiscoPoller.emit (events.js:208:7),
at ,
at process._tickCallback (internal/process/next_tick.js:189:7),
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.,
10-02-2020 17:12:49 debug: Init function for getting data from Cloud completed: OK,
10-02-2020 17:12:49 info: Arming status: partarmed,
10-02-2020 17:12:49 debug: newarmstatus emitted,
10-02-2020 17:12:49 debug: return null, overview empty!,
10-02-2020 17:12:44 debug: ...Overview taken...Response code is 200 and no data error: OK,
10-02-2020 17:12:38 debug: ...Detectors taken...Response code is 200 and no data error: OK,
at RiscoPoller.init (/app/panelPoller.js:35:10),
10-02-2020 17:12:12 debug: Class Connection Constructor end,
10-02-2020 17:12:12 info: Connected to MQTT Server,
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1),
10-02-2020 17:12:22 debug: ...site and Pin Code sent...Response code is 302: OK,
10-02-2020 17:12:27 debug: ...Cameras taken...Response code is 200 and no data error: OK,
10-02-2020 17:12:33 debug: ...Event History taken...Response code is 200 and no data error: OK,
10-02-2020 17:12:17 debug: Logged...Response code is 302: OK

Time zone ?

I've only really noticed this of late, but the Time zone seems to be hard coded to Europe/Rome ? but my time on the docker container is GMT -1

I've Tried an ENV or TZ=Europe/Dublin but no joy...

Cannot connect to the cloud

Every 10 second it tries to connect to the cloud, but can't:

...
10-04-2024 07:07:25 �[33mwarn�[39m: Disconnected from cloud...relogin and init...
10-04-2024 07:07:35 �[33mwarn�[39m: Disconnected from cloud...relogin and init...
10-04-2024 07:07:45 �[33mwarn�[39m: Disconnected from cloud...relogin and init...
10-04-2024 07:07:55 �[33mwarn�[39m: Disconnected from cloud...relogin and init...
10-04-2024 07:08:05 �[33mwarn�[39m: Disconnected from cloud...relogin and init...
10-04-2024 07:08:15 �[33mwarn�[39m: Disconnected from cloud...relogin and init...
...

It's a fresh installation, but I am sure the credentials are fine, because when I provide wrong credentials I get different log:

09-04-2024 17:26:28 �[33mwarn�[39m: Disconnected from cloud...relogin and init...
09-04-2024 17:26:28 �[31merror�[39m: Exceptions on login response: AxiosError: Request failed with status code 200

If that can't be fixed (not maintained anymore or any other reason), could someone confirm they experience the same or that maybe it's working for them? I will appreciate it!

I am using the docker version on QNAP if that's important.

running on Docker within Synology

Hi, ive had this running on my Pi with docker for some time now and all is well but just bought a new synology 918+ so want to move it to docker on there- Home Assistant installs and runs ok but cant get the Risco bridge going.

Anyone got any experience here ?

Logs suggest a permission issue but not sure how to resolve:

Error: EACCES: permission denied, open '/app/config/config.js'

Thanks in advance
Rob

Giving error during polling

The working instance that I have started throwing errors during polling.
Any thoughts?

06-10-2023 21:42:26 debug: polling started...
/app/app.js:91
this.lastEventString = (${todayNotErrEventsArray[0].YTimeToShow} ${todayNotErrEventsArray[0].EventName}).split(''').join('');
^
TypeError: Cannot read properties of undefined (reading 'YTimeToShow')
at RiscoPoller. (/app/app.js:91:62)
at RiscoPoller.emit (node:events:513:28)
at RiscoPoller.init (/app/panelPoller.js:35:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async MqttClient. (/app/app.js:37:5)
Node.js v18.12.1
06-10-2023 21:43:29 debug: Class Connection Constructor end
06-10-2023 21:43:29 info: Express server started...
06-10-2023 21:43:29 info: Connected to MQTT Server
06-10-2023 21:43:29 debug: Logged...Response code is 302: OK
06-10-2023 21:43:30 debug: ...site and Pin Code sent...Response code is 302: OK
06-10-2023 21:43:30 debug: ...Cameras taken...Response code is 200 and no data error: OK
06-10-2023 21:43:30 debug: ...Event History taken...Response code is 200 and no data error: OK
06-10-2023 21:43:31 debug: ...Detectors taken...Response code is 200 and no data error: OK
06-10-2023 21:43:31 debug: ...Overview taken...Response code is 200 and no data error: OK
06-10-2023 21:43:31 debug: return null, overview empty!
06-10-2023 21:43:31 debug: newarmstatus emitted
06-10-2023 21:43:31 info: Arming status: disarmed
06-10-2023 21:43:31 debug: Init function for getting data from Cloud completed: OK
06-10-2023 21:43:31 debug: polling started...
/app/app.js:91
this.lastEventString = (${todayNotErrEventsArray[0].YTimeToShow} ${todayNotErrEventsArray[0].EventName}).split(''').join('');
^
TypeError: Cannot read properties of undefined (reading 'YTimeToShow')
at RiscoPoller. (/app/app.js:91:62)
at RiscoPoller.emit (node:events:513:28)
at RiscoPoller.init (/app/panelPoller.js:35:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async MqttClient. (/app/app.js:37:5)
Node.js v18.12.1
06-10-2023 21:44:36 debug: Class Connection Constructor end
06-10-2023 21:44:36 info: Express server started...
06-10-2023 21:44:36 info: Connected to MQTT Server
06-10-2023 21:44:37 debug: Logged...Response code is 302: OK
06-10-2023 21:44:37 debug: ...site and Pin Code sent...Response code is 302: OK
06-10-2023 21:44:37 debug: ...Cameras taken...Response code is 200 and no data error: OK
06-10-2023 21:44:37 debug: ...Event History taken...Response code is 200 and no data error: OK
06-10-2023 21:44:38 debug: ...Detectors taken...Response code is 200 and no data error: OK
06-10-2023 21:44:38 debug: ...Overview taken...Response code is 200 and no data error: OK
06-10-2023 21:44:38 debug: return null, overview empty!
06-10-2023 21:44:38 debug: newarmstatus emitted
06-10-2023 21:44:38 info: Arming status: disarmed
06-10-2023 21:44:38 debug: Init function for getting data from Cloud completed: OK
06-10-2023 21:44:38 debug: polling started...
/app/app.js:91
this.lastEventString = (${todayNotErrEventsArray[0].YTimeToShow} ${todayNotErrEventsArray[0].EventName}).split(''').join('');
^
TypeError: Cannot read properties of undefined (reading 'YTimeToShow')
at RiscoPoller. (/app/app.js:91:62)
at RiscoPoller.emit (node:events:513:28)
at RiscoPoller.init (/app/panelPoller.js:35:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async MqttClient. (/app/app.js:37:5)
Node.js v18.12.1

Beta version in docker

Hi,
I have the main release running fine in docker for a while now - thanks a lot !

Is there anyway I can use the beta version in docker ? I run Hass in docker on a synology and would like to mess about with the detectors and event log integration the beta release has....

Thanks a lot

Public API verry soon available

good news guys, just got information that risco wil launch soon a public API for developers, they will inform me next week about ETA
seems they also finished integration with amazon alexa already, probably launching verry soon

state delay when arming/disarming

@lucacalcaterra , creating a new clean ticket this time
anyway, my issue is that when i arm/disarm from the panel (original risco) that the state is in an extreem lag/timeout of about 3-5 mnutes before sending the mqtt

so when i arm/disarm from risco panel, there is a lag
so when i arm/disarm from risco app/risco webcloud, its instant
maybe its because of the same user logged in? so when the panel arm/disarms, your app isnt able to sync? so it maybe waits before the riscopanel user is logged out or something like that??

anyway, here are some timestamps
i disarmed/partarmed from riscocloud APP on 20:01 (risco app) , no delay here
i disarmed/partarmed from risco panem on 19:47 (partarmed) 19:52 (disarmed)

see logs below, your logs are 1 hour behind, i think docker is on UTC timezone ...
so the 19:47 is actually 18:50 => 3 minutes later
and 19:52 is actually 18:56 => 4 minutes later

so actually the logs is just telling that there is a extreme delay

2019-02-04 18:56:29,stdout,04-02-2019 18:56:29 �[32minfo�[39m: Status panel infos arrived

2019-02-04 18:56:29,stdout,04-02-2019 18:56:29 �[32minfo�[39m: publish messages on MQTT Server

2019-02-04 18:56:29,stdout,04-02-2019 18:56:29 �[32minfo�[39m: Arming status: disarmed

2019-02-04 18:56:29,stdout,04-02-2019 18:56:29 �[34mdebug�[39m: newarmstatus emitted

2019-02-04 18:56:29,stdout,04-02-2019 18:56:29 �[34mdebug�[39m: Polled...counter: 1580

2019-02-04 18:56:29,stdout,04-02-2019 18:56:29 �[34mdebug�[39m: ...Control Panel State taken and overview not empty... OK

2019-02-04 18:56:28,stdout,04-02-2019 18:56:28 �[34mdebug�[39m: polling ...

2019-02-04 18:51:09,stdout,04-02-2019 18:51:09 �[34mdebug�[39m: Polled...counter: 1549

2019-02-04 18:51:09,stdout,"04-02-2019 18:51:09 �[34mdebug�[39m: return null, overview empty!
"
2019-02-04 18:51:09,stdout,04-02-2019 18:51:09 �[34mdebug�[39m: polling ...

2019-02-04 18:50:59,stdout,04-02-2019 18:50:59 �[32minfo�[39m: Status panel infos arrived

2019-02-04 18:50:59,stdout,04-02-2019 18:50:59 �[32minfo�[39m: publish messages on MQTT Server

2019-02-04 18:50:59,stdout,04-02-2019 18:50:59 �[32minfo�[39m: Arming status: partarmed

2019-02-04 18:50:59,stdout,04-02-2019 18:50:59 �[34mdebug�[39m: newarmstatus emitted

2019-02-04 18:50:59,stdout,04-02-2019 18:50:59 �[34mdebug�[39m: Polled...counter: 1548

2019-02-04 18:50:59,stdout,04-02-2019 18:50:59 �[34mdebug�[39m: ...Control Panel State taken and overview not empty... OK

2019-02-04 18:50:58,stdout,04-02-2019 18:50:58 �[34mdebug�[39m: polling ...


2019-02-04 19:01:56,stdout,04-02-2019 19:01:56 �[34mdebug�[39m: ...Control Panel State taken and overview not empty... OK

2019-02-04 19:01:53,stdout,04-02-2019 19:01:53 �[34mdebug�[39m: polling ...

2019-02-04 19:01:43,stdout,04-02-2019 19:01:43 �[32minfo�[39m: Status panel infos arrived

2019-02-04 19:01:43,stdout,04-02-2019 19:01:43 �[32minfo�[39m: publish messages on MQTT Server

2019-02-04 19:01:43,stdout,04-02-2019 19:01:43 �[32minfo�[39m: Arming status: disarmed

2019-02-04 19:01:43,stdout,04-02-2019 19:01:43 �[34mdebug�[39m: newarmstatus emitted

2019-02-04 19:01:43,stdout,04-02-2019 19:01:43 �[34mdebug�[39m: Polled...counter: 1609

2019-02-04 19:01:43,stdout,04-02-2019 19:01:43 �[34mdebug�[39m: ...Control Panel State taken and overview not empty... OK

2019-02-04 19:01:39,stdout,04-02-2019 19:01:39 �[34mdebug�[39m: polling ...

2019-02-04 19:01:29,stdout,04-02-2019 19:01:29 �[34mdebug�[39m: Polled...counter: 1608

2019-02-04 19:01:29,stdout,"04-02-2019 19:01:29 �[34mdebug�[39m: return null, overview empty!
"
2019-02-04 19:01:23,stdout,04-02-2019 19:01:23 �[34mdebug�[39m: polling ...

2019-02-04 19:01:13,stdout,04-02-2019 19:01:13 �[32minfo�[39m: Status panel infos arrived

2019-02-04 19:01:13,stdout,04-02-2019 19:01:13 �[32minfo�[39m: publish messages on MQTT Server

2019-02-04 19:01:13,stdout,04-02-2019 19:01:13 �[32minfo�[39m: Arming status: partarmed

2019-02-04 19:01:13,stdout,04-02-2019 19:01:13 �[34mdebug�[39m: newarmstatus emitted

2019-02-04 19:01:13,stdout,04-02-2019 19:01:13 �[34mdebug�[39m: Polled...counter: 1607

Trigger panic alarm

I don't think this is possible but is there anyway we can trigger a panic alarm from home assistant so say for example I see someone outside my house on a camera I can just press a button and the alarm goes off ?

I have a panic button that does this so essentially I would just need to trigger that detector...

Could it be possible ?

Question: cameras

ok, this is really interesting, is it also possible to get the camera feed of the onvif/generic cameras in the risco cloud system ?

Question: How to get started

Hi, i'm totally new to Home Assistant and have a Risco panel i want to integrate so this has led me to install MQTT (again not sure what im doing but seems to be running) and then now node.js.

Node.js is where im really confused. Is there any getting started tutorial to help me get going here ?

Also is there a way to communicate directly with the panel instead of via the risco cloud ? i use the CS software to talk to the panel locally to program it (think its via port 1000) so can we just talk direct and bypass riscos cloud ?

Thanks a lot - great work - lets hope i can get it going !!

Rob

No overview

Hi,

I'm trying to get this to work with my alarm system.
I've got the correct Site ID from the HTML source and used it in the config.
After running the app it will show me 'return null, overview empty'.

I do see my sensors, events etc. on the riscocloud page.

Log:

18-11-2018 17:40:40 debug: Class Connection Constructor end
18-11-2018 17:40:40 info: Connected to MQTT Server
18-11-2018 17:40:40 debug: Logged...Response code is 302: OK
18-11-2018 17:40:41 debug: ...site and Pin Code sent...Response code is 302: OK
18-11-2018 17:40:41 debug: ...Cameras taken...Response code is 200 and no data error: OK
18-11-2018 17:40:41 debug: ...Event History taken...Response code is 200 and no data error: OK
18-11-2018 17:40:41 debug: ...Detectors taken...Response code is 200 and no data error: OK
18-11-2018 17:40:41 debug: ...Overview taken...Response code is 200 and no data error: OK
18-11-2018 17:40:42 debug: return null, overview empty!
18-11-2018 17:40:42 debug: newarmstatus emitted
18-11-2018 17:40:42 debug: no new status
18-11-2018 17:40:42 debug: Init function for getting data from Cloud completed: OK
18-11-2018 17:40:42 debug: polling started...
18-11-2018 17:40:52 debug: polling ...
18-11-2018 17:40:52 debug: return null, overview empty!
18-11-2018 17:40:52 debug: Polled...counter: 0
18-11-2018 17:41:02 debug: polling ...
18-11-2018 17:41:02 debug: return null, overview empty!
18-11-2018 17:41:02 debug: Polled...counter: 1
18-11-2018 17:41:12 debug: polling ...
18-11-2018 17:41:12 debug: return null, overview empty!

I would expect to see all my sensors in MQTT right?

Any way we can debug this easily?

Regards,
Kenneth

Risco Alarm Panel not working, but my scripts do. What's happening???

I have this in my configuration.yaml:

alarm_control_panel:
  - platform: mqtt
    name: Risco Alarm
    unique_id: !secret risco_alarm_id
    state_topic: "riscopanel/armstatus"
    command_topic: "riscopanel/armstatus/SET"
    payload_disarm: "disarmed" 
    payload_arm_home: "partially"
    payload_arm_night: "partially"
    payload_arm_away: "armed"

Which of course creates an entity:

alarm_control_panel.risco_alarm

However, when I look in the logbook, no activity is recorded for the alarm_control_panel.risco_alarm entity, even though there were times when the alarm was set. Also, if I add an Alarm Panel to my Lovelace UI, it does not work at all.

Because the above was not working I created a sensor and a binary_sensor which use MQTT messages directly as follows:

In sensors.yaml

- platform: mqtt
  unique_id: risco_alarm_status
  state_topic: "riscopanel/armstatus"
  name: Alarm Status
  icon: mdi:bell

And in binary_sensor.yaml

- platform: template
  sensors:
    ###################### Risco Alarm Armed ######################
    risco_alarm_armed:
      friendly_name: 'Alarm'
      value_template: >-
        {{ is_state('sensor.alarm_status', 'armed') 
          or is_state('sensor.alarm_status', 'partarmed') 
        }}      
      icon_template: >-
        {% if is_state('binary_sensor.risco_alarm_armed', 'on') %}
          mdi:bell-check
        {% else %}
          mdi:bell-off-outline
        {% endif %}

In an attempt to replace the Alarm Panel in Lovelace, I created a switch in switches.yaml

- platform: mqtt
  name: "Risco Alarm"
  command_topic: "riscopanel/armstatus/SET"
  payload_on: "armed"
  payload_off: "disarmed"
  state_topic: "riscopanel/armstatus"
  state_on: "armed"
  state_off: "disarmed"
  optimistic: false

This works, although there is a delay in setting the state to On / Armed.

The question is, why does the alarm_control_panel.risco_alarm config fail to work when my switch does?? Any help would be appreciated.

MQTT topics and payload invisible and not relayed to Home Assistant

I am a Home Assistant user in Docker environment on an Intel NUC, and use the RISCO Integration for sensor states, and notifications.
Next is to control the Alarm Panel, which brought me to [https:://github.com/lucacalcaterra/risco-mqtt-bridge]. Installation okay with Node.js (v17.3) en Mosquitto (v2.0.14).
From the 'risco-mqtt-bridge'-log I get:
image
No problem sofar, also according [https://github.com//issues/3]
Within Home Assistant I changed my configuration.yaml with:
image
And from my MQTT log I can see connection is established correctly:
image

But no messages are relayed to Home Assistant!

When I login to MQTT from outside Docker network(s), I can relay messages between Home Assistant (MQTT Broker integration) and my MacBook (on my local house-network), confirmed by my App 'MQTT Spy', so Mosquitto seems to work as to be expected.

But as for 'risco-mqtt-bridge' no messages are visible wherever. I subscribed to the topics 'riscopanel/armstatus', 'riscopanel/dects', and even to 'riscopanel/#', but no data become available.
When I use my 'MQTT Explorer' App I can see topics and messages are exchanged, but I am not able to get into them.

What can I do? Are the topic subscriptions with Risco correct?

State not always updating, timeout/lag for a few minutes

Luca

I have one issue though with the mqtt alarm

Sometimes the state like armed / disarmed … comes it with a lag, sometimes 3-4 minutes after the alarm has armed or disarmed I see the state changing….
If I then do it again in the irisco app, the state is then almost instantly

I don’t know where the issue is, in your polling? In mqtt sending to HA … can I enable logging somewhere too see what the issue is next time?

Does this sounds familiar?

how can i enable logging? the logs in log folder are only logging issues/errors , so not relevant to this issue

Application Hang With pm2

Hello world,

I've installed this app in /opt/risco-mqtt-bridge.
When I launch it manually with node app.js it seem to run fine.

20-11-2018 09:18:45 debug: Class Connection Constructor end
20-11-2018 09:18:45 info: Connected to MQTT Server
20-11-2018 09:18:46 debug: Logged...Response code is 302: OK
20-11-2018 09:18:46 debug: ...site and Pin Code sent...Response code is 302: OK
20-11-2018 09:18:47 debug: ...Cameras taken...Response code is 200 and no data error: OK
20-11-2018 09:18:47 debug: ...Event History taken...Response code is 200 and no data error: OK
20-11-2018 09:18:48 debug: ...Detectors taken...Response code is 200 and no data error: OK
20-11-2018 09:18:48 debug: ...Overview taken...Response code is 200 and no data error: OK
20-11-2018 09:18:48 debug: return null, overview empty!
20-11-2018 09:18:48 debug: newarmstatus emitted
20-11-2018 09:18:48 info: Arming status: disarmed
20-11-2018 09:18:48 info: publish messages on MQTT Server
20-11-2018 09:18:48 debug: Init function for getting data from Cloud completed: OK
20-11-2018 09:18:48 debug: polling started...
20-11-2018 09:18:58 debug: polling ...
20-11-2018 09:18:59 debug: return null, overview empty!
20-11-2018 09:18:59 debug: Polled...counter: 0
20-11-2018 09:19:09 debug: polling ...
20-11-2018 09:19:10 debug: return null, overview empty!
20-11-2018 09:19:10 debug: Polled...counter: 1
...

But when I try to automatise it with pm2 with this launch file.

risco.yml
apps:

  • script : app.js
    watch : true

app hang and restart continuously

20-11-2018 09:20:00 info: Connected to MQTT Server
20-11-2018 09:20:00 info: Exiting ...
20-11-2018 09:20:00 info: Connected to MQTT Server
20-11-2018 09:20:00 info: Exiting ...
20-11-2018 09:20:00 info: Connected to MQTT Server
20-11-2018 09:20:00 info: Exiting ...
20-11-2018 09:20:01 info: Connected to MQTT Server
20-11-2018 09:20:01 info: Exiting ...
20-11-2018 09:20:01 info: Connected to MQTT Server
20-11-2018 09:20:01 info: Exiting ...
....

App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
│ app │ 0 │ 1.1.2 │ fork │ 0 │ stopping │ 1740 │ 0 │ 0% │ 0 B │ root │ enabled │

what did I do wrong ?

Thanks for your help

Incorrect PIN gives login OK but 500 error

Hi

First of all, great work on this project!

I entered the wrong PIN when configuring, it shows me an error, it would be nice if it would suggest the PIN would be maybe incorrect :)

Log:

18-11-2018 17:38:14 debug: Class Connection Constructor end
18-11-2018 17:38:14 info: Connected to MQTT Server
18-11-2018 17:38:14 debug: Logged...Response code is 302: OK
18-11-2018 17:38:15 error: Exception getting Event History: Error: Request failed with status code 500
18-11-2018 17:38:15 debug: return null, overview empty!
18-11-2018 17:38:15 debug: newarmstatus emitted
18-11-2018 17:38:15 debug: no new status
18-11-2018 17:38:15 debug: Init function for getting data from Cloud completed: OK
18-11-2018 17:38:15 debug: polling started...
18-11-2018 17:38:25 debug: polling ...
18-11-2018 17:38:26 debug: return null, overview empty!
18-11-2018 17:38:26 debug: Polled...counter: 0
18-11-2018 17:38:26 warn: Disconnected from cloud...relogin and init...
18-11-2018 17:38:26 debug: Logged...Response code is 302: OK
18-11-2018 17:38:26 error: Exception getting Event History: Error: Request failed with status code 500
18-11-2018 17:38:27 debug: return null, overview empty!
18-11-2018 17:38:27 debug: newarmstatus emitted
18-11-2018 17:38:27 debug: no new status
18-11-2018 17:38:27 debug: Init function for getting data from Cloud completed: OK
^C18-11-2018 17:38:31 info: Exiting ...
18-11-2018 17:38:31 debug: polling stopped.

Regards,
Kenneth

Disconnected from cloud...relogin and init...

Hi,
thank you for your project.

I have cloned master branch of your github project. I have installed all npm dependencies, and i have started the app.

My username, password, pin and SelectedSiteId are correct, but application give me this error, and enter in an infinite loop:

07-09-2019 09:43:47 debug: Class Connection Constructor end
07-09-2019 09:43:48 info: Connected to MQTT Server
07-09-2019 09:43:48 debug: Logged...Response code is 302: OK
07-09-2019 09:43:49 debug: ...site and Pin Code sent...Response code is 302: OK
07-09-2019 09:43:50 debug: return null, overview empty!
07-09-2019 09:43:50 debug: newarmstatus emitted
07-09-2019 09:43:50 debug: no new status
07-09-2019 09:43:50 debug: Init function for getting data from Cloud completed: OK
07-09-2019 09:43:50 debug: polling started...
07-09-2019 09:44:00 debug: polling ...
07-09-2019 09:44:00 debug: return null, overview empty!
07-09-2019 09:44:00 debug: Polled...counter: 0
07-09-2019 09:44:00 warn: Disconnected from cloud...relogin and init...

I already tested this project before now in another raspberry (with home assistant) installation, and i never have got this type of error.
Maybe, has been there any change in the cloud?

Question: Can HA detect when alarm is in process of been set?

Is it possible for HA to detect when alarm is in process of been set?
What I mean is when I leave the house, there is approx 40 seconds when the alarm is in a preset mode and the panel is beeping - basically giving me time to exit the flat.

What I would like to do is have HA alert me that a window has been left open during this 40 seconds. Having it alert me afterwards would be rather frustrating as I would have to unlock the door as well as unset the alarm.

Warning with nodeJS after arming all parts

Error message on console (same when disarming parts):

01-05-2022 18:27:23 info: Status panel infos arrived
(node:5455) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'parts' of null
    at RiscoPoller.riscoPoller.on (/root/risco-mqtt-bridge/app.js:58:67)
    at emitNone (events.js:106:13)
    at RiscoPoller.emit (events.js:208:7)
    at Timeout.timer.setTimeout [as _onTimeout] (/root/risco-mqtt-bridge/panelPoller.js:53:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
(node:5455) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5455) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.