Skip to content
davesmeghead edited this page Apr 29, 2023 · 122 revisions

Buy me a coffee

Visonic Alarm Panel for Home Assistant

A Custom Integration for Home Assistant

Introduction

Visonic produce the Powermax and Powermaster alarm panel series.

This Home Assistant Integration allows you to control the alarm panel (arm/disarm) and allows you to use the Visonic sensors and events (movement, door contact, ...) and X10 devices within Home Assistant.

Contents

What my Frontend looks like

This is what my sensors look like

And I have 2 cards in Lovelace, they look like this

This last image shows a card in Home Assistant with a set of entities that have been created from attributes of the alarm panel entity "alarm_control_panel.visonic_alarm". This can be done using a templete as here in HA.

Supported Visonic Panels

These are the supported Visonic Panel Types (including specific model information).

Panel Model
Comment
Powermax This doesn't work with this Integration, it doesn't support a Powerlink Hardware Module.
Powermax+ This will work but needs to be Manually Enrolled (please set force_autoenroll to 'no').
Powermax Pro This will work but needs to be Manually Enrolled (please set force_autoenroll to 'no').
Powermax Complete This will work and will auto enroll.
Powermax Pro Part This will work and will auto enroll.
Powermax Complete Part This will work and will auto enroll.
PowerMax Express This will work and will auto enroll.
Powermaster 10 This will work and will auto enroll. Note 1
Powermaster 30 This will work and will auto enroll. Note 1
Powermaster 33 This will work and will auto enroll. Note 1
Powermaster 33 This will work and will auto enroll. Note 1
Visonic 360r This doesn't work with this Integration.

Note 1, you may need to disable the battery saver in your PIR sensors to get motion triggers when the alarm is disarmed.

Please note that:

  • After extensive work, the original PowerMax Panel is not able to be used as it does not support the Powerlink protocol that this integration relies on. It only supports EPROM Upload and Download and nothing more.
  • The Visonic 360R Alarm Panel is not fitted with an RS232 connection and cannot have a Powerlink3 fitted (this integration mimics the operation of the Visonic Powerlink Hardware), it is therefore not compatible with this HA Integration.
  • Powermax+ and Powermax Pro users will need to manually enroll at the right point in time (usually within a few minutes of starting this integration). I believe that you do this by INSTALLER MODE → 7. ENROLL PWRLNK → 01: INSTALL. Most users with these 2 panel types only need to do this once, however a few users have found that they need to do this every time they restart the integration.

Supported Panel Functionality

Multiple visonic alarm panels are supported and are integrated in to the same Home Assistant. This Integration currently connects to each panel and it creates an:

  • HA Sensor for each alarm sensor
  • HA Switch for each X10 device
  • Alarm Panel integration Entity "alarm_control_panel.visonic_alarm" so you can look at the internal state values
  • "alarm_control_panel" badge so you can arm and disarm the alarm
  • HA Service to arm/disarm the panel
  • HA Service to bypass/re-arm individual sensors
  • HA Service to retrieve the event log and save to an xml and/or a csv file
  • HA Event for several triggers from the panel to use in your Automations.

What it doesn't do in Home Assistant

  • Partitions, it assumes a single partition.

PowerMaster PIRs

When the PIRs are first installed they default to only sending their detections when the panel is armed. If you also want to send PIR detections when the panel is disarmed then change the “Disarm Activity” in panel device settings. This seems to be as follows in the panels menu and needs to be done for each PIR. installer mode > zones and devices > modify device > motion sensors > device settings > disarm activity > yes +0 seconds.

Installing the Software in to HA

This section tells you how to install the software part of the Integration in to Home Assistant.

There are 2 ways to do this

  1. Direct download. When you download the github zip file, extract it in your main HA configuration directory. This will create this directory hierarchy custom_components/visonic/**** where **** are all the files of the Integration. To download the zip file, go to the wiki here https://github.com/davesmeghead/visonic then click the green code button and select "download zip" (as at the time of writing this description).
  2. Using HACS. This integration is part of the HACS system so you should be able to search and find it (after installing HACS of course).

With both of these ways of installation, please restart Home Assistant in order to include the integration in the integrations page.

The Visonic Integration

This section looks at how you set up the integration within HA. By now you should have the hardware setup and the software for this integration installed. You also need to know which Connection Mode you want: Standard or Powerlink.

The Different Connection Modes

There are different ways to connect to the Panel and each gives it's own advantages and disadvantages. One persons advantage is another persons disadvantage so there are configuration settings to support this. Also, the highest level of interaction is with Powerlink Mode but that cannot always be achieved.

Standard Mode

This is the basic mode where the alarm panel provides an indication of its state and the information about the sensors and X10 devices. However, not all information is available for the Sensors, critically the sensor type is missing. You can arm and disarm the panel by either setting the Override Code in the HA configuration or by entering the code each time manually from the HA Frontend. The EPROM data is not downloaded from the alarm panel.

Standard Plus Mode

As per Standard mode, but in addition the EPROM data has been obtained from the panel. This provides more detailed information about the sensors and X10 devices and it also provides the user code for the panel. You can arm and disarm the panel without entering any user code as the HA Integration already knows it. You do not need to use the Override Code in the HA configuration although there are times when it might be useful. Standard Plus is achieved when trying to get to Powerlink Mode but the alarm panel refuses in some way.

Powerlink Mode

From a functionality view point, there isn't much difference between Standard Plus and Powerlink. Powerlink Mode provides:

  • All the things from Standard Plus Mode
  • More informative panel status messages from the panel, including the external siren status.
  • The interaction with the panel is more robust with continual "Powerlink Alive" messages from the Panel.
  • The Panel recognises that it has an external device attached to it and therefore attempts to maintain the connection / interaction with message retries.

Currently, the integration tries to get to powerlink mode as follows:

  • For Powermax+ and Powermax Pro users the panel asks the integration to manually enroll. See further down on this page.
  • For all other panel types, the integration makes 4 attempts over 9 minutes (3 minute gap) to auto-enroll powerlink with the panel.
You can force it in to Standard mode.

This Integration tries to connect in Powerlink mode by default, unless you set Force Standard in the configuration options.

If the Integration connects in Standard Plus or Powerlink mode then it automatically gets the user codes from the panel to arm and disarm.

If the Integration connects in Standard mode then you must provide the user code to arm and disarm. You can either use Override Code in the HA configuration or manually enter it each time from the HA Frontend. Some panels allow arming without the user code. Note that to arm and disarm you must also set the configuration settings to permit this.

Why would I want to force Standard Mode?

It all comes down to trust and security versus flexibility. Do you trust your home network and the HA connection to it?

  • For those that have no trust then force Standard Mode and disable remote arm and disarm through this Integration. You will see the status of your panel sensors but you will not be able to interact with your panel.
  • For those that have some trust but not too much, then force Standard Mode and enable remote arm and disarm through this Integration (you're presented with a keypad). Perhaps just enable remote arm but not disarm in the configuration options.
  • For those that have a bit more trust, then force Standard Mode, enable remote arm and disarm through this Integration and set the Override Code in your configuration (no keypad needed).
  • For those that have full trust, get the connection to at least Standard Plus (but hopefully Powerlink) and enable remote arm and disarm through this Integration (no need to set the Override Code in your configuration and no keypad needed).

Integration Creation, Modification and Deletion from within Home Assistant

You configure this integration from the Integrations page within Home Assistant. Note that the configuration.yaml file set up is no longer supported for this Integration.

You do this by navigating to the integrations page, selecting the "+ Add Integration" at the bottom right and then finding "Visonic Intruder Alarm". You then go through the menus to set the settings as per the descriptions in the table below.

You can delete the integration from within HA and you then need to restart HA. Note that deleting the integration stops everything working and terminates the connection with the panel but it does not remove all the frontend. You can also Reload the integration, this is a combination of delete and create, it stops and restarts the integration with the same settings.

You can edit some of the settings for the integration by selecting the "Configure" in the integration. Some of the settings are only used at startup and you cannot subsequently edit those.

Settings that are only used as part of creation are:

  • Configure the Connection Settings (Ethernet/USB)
  • Set the Panel Number (see Multiple Visonic Alarm Panels below)
  • Set the Language
  • Whether to Force Standard Mode
  • Whether the panel supports Auto Enroll (Powermax+ and some Powermax Pro users must leave this Unticked, all other Panels, please Tick this)
  • Whether to Synchronise Time with the host (where HA is running). This does not work with all panels.
  • Set the Download Code for the EPROM
  • Set the Exclude Sensor list (do not create Sensors in HA for these)
  • Set the Exclude X10 list (do not create Switches in HA for these)

When you subsequently edit you can change the other settings.

Note that the download code can usually be left at the default of 5650, some panel types use AAAA as the default panel code. On many panels you can set the download code, on my panel the menus are INSTALLER MODE → 5. DEFINE COMM → 27: MAST. DL CODE. The download code is not the same as the installer code, please do not use your installer code for anything to do with this integration.

Specifically for PowerMaster users, by default it does not ask you for the experimental B0 settings. If you have a PowerMaster panel and want to use this you can edit an existing integration that is in Powerlink mode and the settings will be there to set/change.

Multiple Visonic Alarm Panels

The Integration supports multiple Alarm Panels, simply configure each panel from the Integration page within Home Assistant. In the configuration when you first set up this Integration you can set the panel number. Zero (0) uses Auto Numbering and also creates the first panel without the panel naming convention. 1 or more manually sets the created panel to be that number.

Panel 0 creates Entities without a "px" in their names where x is the panel number, for example "binary_sensor.visonic_z01" Panel 2 would create Entities with "px", in the case of panel 2 for example "binary_sensor.visonic_p2_z01"

All panels use a common set of Services and Events within Home Assistant (each panel does not have dedicated Services and Events). All Services and Events include a "panel" attribute that is an Integer. This panel attribute is what you have set when you created the Panel. The panel attribute defaults to 0 so remains backwards compatible, if you do not set it for the Services then the Integration uses 0.

Achieving PowerLink Mode

For users that do not have a Powermax+ or a Powermax Pro panel, then you should be able to install the integration and it should automatically connect and start. Unless you are forcing the integration to remain in Standard Mode then it should achieve Powerlink Mode. For users that have a Powermax+ or a Powermax Pro panel then you will need to manually enroll the panel to achieve Powerlink Mode:

  • Start the integration in Home Assistant
  • Watch the panel (or the panel status in HA) and you should see it downloading the EPROM from the panel, this normally takes a minute or two.
  • Once it has completed downloading the EPROM from the panel, enter installer mode on the panel then INSTALLER MODE → 7. ENROLL PWRLNK → 01: INSTALL
  • This tells the panel to send an enrollment message to the integration which then tries to enroll with the panel. If successful, after a few more minutes you should see the mode in HA go to Powerlink.
  • You can see the panel status by going in to "Developer Tools" and searching for the entity "alarm_control_panel.visonic_alarm". Look for the attribute "Panel Mode:".
  • You should only need to do this once. The first time after you install the hardware you need to do this on your panel (and occasionally after that when you restart Home Assistant and it stops working)

Configuration Settings

The complete list of configuration settings are defined below with their default value together with the full list of values.

Within the Integration, No / Yes values are tick boxes. The first column indicates "*" when that setting is only used for the Creation of the integration. All other settings can be modified from within the HA integration "Configure".

C
Configuration Name
Default Description List of values
* Language EN Set the Language. EN for English, NL for Dutch or FR for French. EN, NL or FR
* Panel 0 This Integration supports multiple panels (0 = Auto Numbering or manually number your panel) 0, 1, 2 etc
* Force Standard No Do not attempt to connect in Powerlink Mode, establish a Standard Mode connection only. No / Yes
* Auto Enroll Supported Yes Determine the ability for this Integration to auto-enroll prior to the panel type being known. Powermax+ and some Powermax Pro panels cannot auto enroll, those users need to set this to No. No / Yes
* Synchronise Time Yes Attempt to synchronise the time between the device you run HA on and the alarm panel. This does not work with all panels. No / Yes
* Download Code 5650 This is the 4 digit code used to download the EPROM and to Enroll for Powerlink. AAAA is also a known Download Code that may work if 5650 doesn't 4 digits
* Exclude Sensor List A comma separated list of Zone Sensors to exclude e.g to exclude zones Z02 and Z03 then use 2,3 1,2 ... ,64
* Exclude X10 List A comma separated list of X10 devices to exclude e.g to exclude devices X02 and X03 then use 2,3. For PGM use 0 in the list. 0,1,2 ... ,15
Motion Off Delay Time 120 The time to keep the zone trigger True after it is triggered. There will not be another trigger for that sensor within this time period. Integer Seconds
Allow Remote Panel Arm No Determines whether the panel can be Armed from within HA. No / Yes
Allow Remote Panel Disarm No Determines whether the panel can be Disarmed from within HA. No / Yes
Override Code This is a 4 digit code that is used to arm, disarm, bypass and get the log, and allows you to override the code. See notes 1 and 2 below 4 digits or 0
Attempts to Try to Connect 1 This is the number of attempts the integration will try to (re)connect to the panel. If this is set to 0 then the Integration will try to connect once on initial startup but never again (following any disconnection). 0 to 1000
Delay Between Attempts 90 This is the period, in seconds, between connection retries. This is only used when "Attempts to Try to Connect" is 2 or more. 5 to 1000
Arm Without User Code No If the Panel is Disarmed, then Arm without the Usercode/keypad. See note 2 below. No / Yes
Force use of a Keypad No Display the numeric keypad to force the user to enter the correct code. See note 2 below. No / Yes
Arm Away Instant No If set to Yes then arm away instant is used instead of a normal arm away. See Note 5 below. No / Yes
Arm Home Instant No If set to Yes then arm home instant is used instead of a normal arm home. See Note 5 below. No / Yes
Allow Sensor Bypass No If set to Yes then allow individual sensors to be bypassed (using the HA service) No / Yes
List of Trigger for Siren Intruder A list of reasons that the siren is sounding, you set this as this information is not obtained from the panel. See Note 6
List of Trigger for HA Notification See Note 7 A list of reasons to create a Notification in the Frontend of Home Assistant. See Note 7
Panel Log Entry Event No Generate an event within HA for each panel log entry (potentially hundreds). No / Yes
Panel Log XML Filename If this is set to something other than an empty string, create an xml file with the content of the panel event log using an xml template (Note 3 and 4) '' or 'validpath/filename.xml'
Panel Log CSV Filename If this is set to something other than an empty string, create a csv file with the content of the panel event log (Note 4) '' or 'validpath/filename.csv'
Panel Log CSV Add Title Row No If creating a csv file, then do or do not include a title row at the top No / Yes
Panel Log Completion Event No Generate an event within HA at the end of the log retrieval. As this could take tens of seconds, this HA Event marks the end. No / Yes
Panel Log Reverse Order No Reverse the order of the entries in the saved file(s) No / Yes
Panel Log Max Entries 10000 Retrieve at most this number of log entries. For example, set this to 1 to get the most recent, etc... Integer

Note 1: The use of this depends on how secure you make your system and how much you trust it.

Note 2: This note defines the combinations of the 3 parameters: Force use of a Keypad, Arm Without User Code and Override Code (assuming a valid 4 digit code). In addition, the effect of these parameters is also influenced by the Panel Mode (Standard, Standard Plus or Powerlink) and the current Panel State (Disarmed or Armed).

For the Override Code

  • Set it to 0 when not in use, this represents "No" in the tables below
  • The GUI will only allow numbers from 0 to 9999, if your override/user code starts with zero(s) then just miss them out i.e. enter 34 for code 0034

With reference to the 2 tables below, the first 4 columns constitute the input parameters to determine whether to show the keypad in the HA Frontend and what code to send to the panel.

The 3 output columns indicate:

  • Is Keypad Shown : This indicates when the Keypad is show in the HA Frontend
  • Code sent to Panel : This indicates the actual 4 digit code that is sent to the Alarm Panel. "User code 1" is the first user code in your panel as obtained from the panels EPROM.
  • Extras : Where the Extra column has an A, some panels will arm with any 4 digit user code, including 0000.

The function of Arm Without User Code has a slightly different meaning depending on the Panel Mode (Standard, Standard Plus or Powerlink).

In the "Panel State", remember that it is the current panel state i.e. Disarmed means what you see to arm the panel.

For Standard Mode

Panel State
Arm Without User Code
Force use of a Keypad
Override Code Valid
Is Keypad Shown
Code sent to Panel Extra
Disarmed Yes - - No '0000' A
Disarmed No No No Yes Keypad A
Disarmed No No Yes No Override A
Disarmed No Yes No Yes Keypad A
Disarmed No Yes Yes No Override A
Armed - No No Yes Keypad
Armed - No Yes No Override
Armed - Yes - Yes Keypad A

Note that when Arm Without User Code is used in Standard Mode:

  • It is only used when the panel is Disarmed (in order to arm the Panel) and
  • If you set Arm Without User Code then the other 2 settings are only use for Disarming the Panel, to Arm the Panel the code '0000' is always used.
  • Remember that most panels do not support its use in Standard Mode.

To summarise the use of the Force use of a Keypad and Override Code settings (when Arm Without User Code is "No"):

  • When both are "No" then the keypad is shown to arm and disarm the panel
  • When one is set and the other is not, then it uses whichever is enabled to arm and disarm the panel
  • When both are "Yes" and when the panel is disarmed, the Override code is used to arm the panel
  • When both are "Yes" and when the panel is armed, the keypad is shown to disarm the panel

For Standard Plus and Powerlink Modes

Panel State
Arm Without User Code
Force use of a Keypad
Override Code Valid
Is Keypad Shown
Code sent to Panel Extra
Any - No No No User code 1
Any - No Yes No Override A
Armed - Yes - Yes Keypad A
Disarmed No Yes - Yes Keypad A
Disarmed Yes Yes No No User code 1
Disarmed Yes Yes Yes No Override A

Note that when Arm Without User Code is used in Standard Plus and Powerlink Modes:

  • It is only used when the panel is Disarmed (in order to arm the Panel) and
  • If you set Arm Without User Code and Force use of a Keypad then it can be used to send the Override or Usercode Code to Arm the Panel but force the user to use the keypad to Disarm the Panel.
  • This can be used for all panel types as it is used inside the Integration itself
  • If your panel supports arming the panel without a code then setting just Force use of a Keypad will give strange results. It will show a keypad to arm the panel but you can use any code on the keypad and it works. You may as well set both Arm Without User Code and Force use of a Keypad

Note 3: This creates an xml file from an xml jinja2 template defined in a file called 'visonic_template.xml'. There is an example 'visonic_template.xml' file with this Custom Integration BUT it will not find that file (Home Assistant discourage user defined file settings in the custom components directories) so please copy it to one of the valid directories and alter if you wish to. The Integration uses the following directory locations to find the file, in order: ./templates, ./xml, ./www, '.' (where '.' is your configuration directory). The dictionary variables entries total and available are passed in to the jinja2 xml file for processing. Take a look at the example file and you should see what I mean.

Note 4: Be careful with the filename path, especially putting a leading "/". By default, if you do not specify a path, the file is created in your configuration directory.

Note 5: Arming Instant has an exit delay as normal but does not have an entry delay. Once armed, any detection will trigger an immediate alarm. Arm home instant is the most useful for me when setting an alarm overnight.

Note 6: The complete list of reasons that the siren may be sounding are "Intruder", "Tamper", "Fire", "Emergency", "Gas", "Flood", "X10", "Panic". Just to be clear, the Panel does not provide a direct indication that the external siren is sounding. Powerlink and Standard Plus Mode provide a more reliable and timely indication than Standard Mode but all methods need a combination of values from the panel. I’ve found that in Standard mode, the Panel is lazy in passing me the values.

Note 7: The complete list of reasons to create a Notification in the Home Assistant Frontend are:

  • Siren Sounding : The Siren is Sounding i.e. the Main Alarm has been Triggered
  • Panel Tamper : The Main Alarm Panel Tamper has been Triggered
  • Panel System Reset : The Panel has undergone a System Reset i.e. Enter and then Exit Installer mode on the Panel
  • Code Rejected By Panel : The 4 digit code has been rejected by the panel
  • Panel Operation : There has been an issue with downloading the panel EPROM data or there is a Watchdog Timeout
  • Connection Problems : This indicates when there is a connection problem with the Alarm Panel
  • Sensor Bypass Problems : If you try to Bypass a Sensor, this indicates specific problems
  • Event Log Problems : This indicates when there have been problems getting the data and then writing it to the log files
  • Command Not Sent To Panel : There are many data checks performed before a command is sent to the Panel, these are indicated here.

The default settings are: Connection Problems and Siren Sounding

Further Notes:

  1. You do not need to use the Master Installer Code from your panel with this integration, please keep that a secret.
  2. Only 1 Home Assistant Notification will be generated at a time, you must "Dismiss" it before you may get future notifications.

The Download Code setting

To connect in Standard Plus and Powerlink mode, the Integration uses a special Download Code to download the EPROM data from the panel (this is not the Master Installer Code). The Download Code defaults to "5650" (for those with ASCII knowledge this is hex for the characters VP for Visonic Panel I believe), but you can override it in the configuration when creating the integration.

The default Download Code seems to vary across the different panel models and seem to have 1 of 2 download codes if you haven't changed them. The 2 possible default download codes seem to be "5650" or "AAAA". So if you don't get to Standard Plus or Powerlink modes then try deleting and recreating the integration and overriding the download code to "AAAA".

In addition, some panels allow you to set the download code using the panels menu. For example, on a UK Powermax Pro using the menus: 5.Define Communication=>C.S. Reporting=>PSTN Up/Down, in this menu there is a Master Download Code setting and an Installer Download Code setting the default to AAAA and 0000 respectively. You could change the Master Download Code within your alarm panel and then set it in the settings for this Integration. Do not set the download code to 0000 in your panel settings as I believe that this disables EPROM download from your panel (or perhaps it will then only use the installer code which you don't want to do).

The Start Up Sequence of the Integration

The Integration attempts to connect to the Panel using the configured mechanism (Ethernet, USB or RS232).

The Achieved Panel Mode
  • At Integration start, it checks the Force Standard user setting. If set it goes directly to Standard Mode and stays there.
  • If Force Standard is not set then it tries to Download the EPROM data from the panel.
    • If this fails immediately then it keeps retrying every 4 minutes.
    • If it fails part way through the download there is something more seriously wrong and it goes to Standard Mode and stays there.
    • The Download step itself takes about 40 seconds on my panel,
  • When EPROM Download succeeds is goes to Standard Plus mode.
    • I get Standard Plus Mode within a minute or so of starting HA.
    • I expect that most people will be happy to get it to Standard Plus mode.
  • If you have a PowerMax+ or a PowerMax Pro then you need to Manually Enroll (in your control panel menu)
  • Otherwise it then starts trying to Auto Enroll as a Powerlink device,
    • Trying every 4 minutes.
    • It can't try too often as the panel just blocks the communication, thinking that it's an attack I think, so 4 minutes seems OK
    • I usually get Powerlink Mode within 2 minutes of starting HA
    • On my panel it sometimes fails to enroll the first time and it works the next time around, so about 5 minutes after starting HA
The Connection State and Disconnection Handling

This section describes the sequence of connecting to the panel and what happens when problems occur.

The Integration always tries to connect when it is first started (or reloaded from within Home Assistant). The number of times the integration will attempt a connection / reconnection and the time interval between attempts is set in the configuration for this integration. Note that the configured number of attempts can be set to 0 in which case the connection will be attempted once on initial startup but never again, even after a disconnection.

There are mechanisms in the integration that trigger a reconnection:

  • Too many CRC Errors in the received data and within a defined timeframe
  • Sometimes the panel just repeatedly sends out the same packet, if this occurs for 10000 packets in a row
  • The external physical connection is terminated (i.e. disconnected altogether such as a wifi router reboot).

The most common cause of this last reconnection is when this occurs in the log file:

ERROR Connection Lost : disconnected because the Ethernet/USB connection was externally terminated.

Connection Progress and Connection Attempt Indications

Home Assistant Events are used to inform on progress, see the Panel and Sensor HA Events Section for more details but they are used as follows. For the HA Event, defined in the Panel and Sensor HA Events Section, to explain the difference between condition=0 and condition=10:

  • Condition=0 is to do with the (physical and logical) connection between the system on which you run Home Assistant and the alarm panel i.e. is there a connected Ethernet / USB / RS232 connection established? The integration tries to keep a permanent connection between the integration and the panel. So the "state" is:
    • "disconnected" when a break in the connection has occurred, "reason" is set to:
      • "crcerror" when there have been too many crc errors in the received data
      • "samepacketerror" when the panel sends too many of the same packet in the same sequence
      • "termination" when the external physical connection is terminated
    • "connected" when everything is OK and
    • "failedattempt" when an attempt has been made to connect but that failed (with an attempt counter). The number of attempts can be set in the configuration settings for this integration.
  • Condition=10 is to do with the receipt of data from the panel. Once Condition=0 is "connected" the integration will interact with the panel. The "state" is
    • neverconnected when, following a successful connection (Condition=0), no data has been received at all for over 30 seconds, and
    • disconnected when data has been received previously but not for the past 4 minutes (and Condition=0, state is "connected" as the Operating System believes that there is still a valid connection to the panel).

So the sequence is, after starting HA with a successful connection:

  • If the integration receives no data from the panel (after sending data to the panel to prompt the panel to respond) then after 30 seconds the integration stops and sends the HA event (condition=10, state=neverconnected).
  • If the panel and integration initially communicate and some time later (hours, days, weeks), after the integration has not received data for 4 minutes then it stops and sends the HA event (condition=10, state=disconnected).
    • For some messages to the panel (that explicitly expect a reply from the panel), within that 4 minutes it does try other things like re-sending the message. It also sends a "restore" to the panel to trigger it to send back its status. So there are mechanisms within that 4 minutes to try to get the panel to respond.
    • But after 4 minutes if all of these have not worked then it sends the HA Event and it is up to you to create an HA Automation to decide what to do, which could be to send you an email or to restart the integration.
  • For condition=10, the integration does not restart itself (it will stop in a dormant state and not reconnect) as:
    • Some users were having issues where it restarts a lot and they wanted to decide what to do
    • The physical connection between HA and the panel looks OK, so I assume it's a panel problem

Home Assistant device_class

In Standard Plus & Powerlink Modes, I try to set the device class correctly by default however I don't know if a particular perimeter sensor "magnet" is on a door or window for example. By default I set all:

  • "PIRs" to device_class "motion"
  • "magnet" to device_class "window"
  • "wired" to device_class "door"

You can change this in your customize configuration file customize.yaml like this for example

    "binary_sensor.visonic_z04":
      friendly_name: 'Kitchen Door'
      device_class: door

You will find the various settings for device_class here

For Standard Mode I do not get any information from the panel so you can use this method to set the device class in Home Assistant.

Home Assistant Panel Services

The Integration responds to some of the built in HA Alarm Panel Services. The first 3 are HA built in, the other 4 I have added.

Name Code Description
alarm_control_panel.alarm_arm_away Optional Arm the panel away e.g. "entity_id":"alarm_control_panel.visonic_alarm"
alarm_control_panel.alarm_arm_home Optional Arm the panel home e.g. "entity_id":"alarm_control_panel.visonic_alarm"
alarm_control_panel.alarm_disarm Optional Disarm the panel e.g. "entity_id":"alarm_control_panel.visonic_alarm"
visonic.alarm_sensor_bypass Optional Bypass/Arm individual sensors (must be done when panel is disarmed). e.g. "entity_id":"binary_sensor.visonic_z01", "bypass":"True"
visonic.alarm_panel_eventlog Optional Retrieve the panel event log and process it.
visonic.alarm_panel_command Optional Send Arm / Disarm commands to the panel (Note 1) e.g. "Command":"ArmAway"
visonic.alarm_panel_reconnect Reconnect following a previous problem.

Note 1: The "Command" is set to one of 'ARM_AWAY', 'ARM_AWAY_INSTANT', 'ARM_HOME', 'ARM_HOME_INSTANT', 'ArmAway', 'ArmAwayInstant', 'ArmHome', 'ArmHomeInstant', 'Arm_Away', 'Arm_Away_Instant', 'Arm_Home', 'Arm_Home_Instant', 'DISARM', 'Disarm', 'arm_away', 'arm_away_instant', 'arm_home', 'arm_home_instant', 'armaway', 'armawayinstant', 'armhome', 'armhomeinstant', 'disarm'

These are all case sensitive.

In the first 6 services the "code" service data is optional and is only needed in Standard Mode. However, if it is set in any of the connection modes then it is used.

Just to note that:

  • alarm_control_panel.alarm_arm_away has the same effect as visonic.alarm_panel_command with different service data. This is similar for alarm_control_panel.alarm_arm_home and alarm_control_panel.alarm_disarm.
  • The last 4 services have a 'panel' attribute that is used for multiple panels, it defaults to panel set to 0

Home Assistant Panel Events

The Integration generates these events on the HA event bus. Events are part of HA and I generate an HA event for many things such as changes in the panel or sensor states. Panel events include the detailed panel state data.

To see them in action in your own HA, go to “Developer Tools”, “Events” and in the bottom where it says “Listen to events” paste visonic_alarm_panel_state_update and click “start listening”. Then do things with your alarm panel such as trigger sensors, arm and disarm, you should see what I mean. You should be able to see the events on the same webpage in the HA Frontend.

All Events have a 'panel' attribute that represents the panel number, this defaults to 0.

Name Description Event Data
visonic_alarm_panel_event_log_entry When the event log is being downloaded, an HA event for every panel log entry (if enabled in configuration) see Note 1 below
visonic_alarm_panel_event_log_complete When the event log from the panel has been downloaded (if enabled in configuration) None
visonic_alarm_panel_state_update An HA Event for various panel and sensor changes condition (see Note 2 below)

Panel Event Log HA Events (Note 1)

This describes the HA event data associated with the visonic_alarm_panel_event_log_entry HA event. The list of HA event data parameters for each log entry (that you can also use in the jinja2 xml settings file)

Data Type Description
current Integer The current event log entry
total Integer The total number of event log entries
data Date The date of the event in the historical log
time Time The time of the event in the historical log
partition Integer The panel partition
zone String The Zone of this log
event String The detailed Panel Event

Panel and Sensor HA Events (Note 2)

This describes the HA event data associated with the visonic_alarm_panel_state_update HA event. This is quite complicated but I have tried to make it as easy to understand as possible. I suggest that you view the events live in the developer tools (Events) in combination with this description to try to understand the structure before you use it in your Automations.

The data that appears in every visonic_alarm_panel_state_update HA event is condition: X where X is 0 to 14.

When the condition is set to 11, 12, 13, or 14 then there has been a problem BEFORE the command has been sent to the panel. In other words, these are NOT panel status events, they represent feedback (usually errors) from the Integration itself.

Each condition X is an integer but it also has an action that is a string, this can be used in automations instead of "condition" to make it more readable

  e.g. "action" = "connection" and "state" = "disconnected"
       "action" = "zoneupdate" and "zone" = 3

Most of the events do not have any other associated data (other than condition and action) but some do, the Data Set column indicates which events have additional data associated with them and which of the 3 data sets A, B or C.

X
action
Meaning
Command
Data Set
0 "connection" This condition indicates the state of the physical connection and the connection through the operating system. See the startup sequence section. "state" = "disconnected" indicates a communication disconnection
"state" = "failedattempt" indicates a failed connection attempt
                  "attempt" = an attempt counter
"state" = "connected" indicates a successful connection
1 "zoneupdate" Zone update A
2 "panelupdate" Panel update B
3 "sirenactive" Panel update AND the alarm is active B
4 "panelreset" Panel reset B
5 "pinrejected" Pin rejected
6 "paneltamper" Panel Tamper alarm
7 "timeoutdownload" EPROM download timeout, go to Standard Mode
8 "timeoutwaiting" Watchdog timeout, staying in current mode
9 "timeoutactive" Watchdog timeout, going to try to get a better mode
10 "nopaneldata" Data not received from the Panel. This condition indicates that a connection to the panel has been established but no data has or is being received from the Panel. See the startup sequence section. "state" = "neverconnected" indicates that no data has been received
"state" = "disconnected" indicates that data has stopped being received
11 "armdisarm" Arm/Disarm feedback "disarmed", "stay", "armed", "stayinstant", "armedinstant" C
12 "bypass" Bypass feedback "bypass" C
13 "eventlog" Event Log feedback "eventLog" C
14 "x10" X10 feedback "x10" C

Data set A

This represents the Zone State and is used when the event condition is set to 1 (and action is set to "zoneupdate")

Data Item Description
'Zone' The Zone (integer 1 to 64)
'Event' The Event as an Integer range 0 to 20 (see below)
'Description' This is a Description of the Event as a String (see below)

The Event is an integer in the range 0 to 20 and the table below shows the Description in English, in your integration it will appear in your chosen language (EN, NL, FR).

Event Description
0 None
1 Tamper Alarm
2 Tamper Restore
3 Open
4 Closed
5 Violated (Motion)
6 Panic Alarm
7 RF Jamming
8 Tamper Open
9 Communication Failure
10 Line Failure
11 Fuse
12 Not Active
13 Low Battery
14 AC Failure
15 Fire Alarm
16 Emergency
17 Siren Tamper
18 Siren Tamper Restore
19 Siren Low Battery
20 Siren AC Fail

Data set B

This represents the Panel State and is used when the event condition is set to 2, 3 or 4.

Notes:

  • 'Type', 'Mode', 'Event' and 'Name' are lists (arrays) that are referenced from 0 to 'Count' - 1
  • 'Count' is usually set to 0 or 1 but it can go to a maximum of 4.
  • If 'Count' is 0 then the lists are empty
  • If 'Count' is 1 then the lists have a single entry, referenced as e.g. data['Type'][0]
  • 'Type' and 'Mode' represent the same thing but as an integer and a string.
  • 'Event' and 'Name' represent the same thing but as an integer and a string.
Name Description
'Zone' The Zone that caused this panel state change (if zero then invalid)
'Entity' The Entity in this panel state. You can use this to directly get the sensor entity data in automations
'Tamper' Panel Tamper (True or False)
'Siren' Is the siren sounding (True or False)
'Reset' Has the panel had a system reset (possibly by exiting installer mode on the panel) (True or False)
'Time' The creation time
'Count' How many messages in the Type, Event, Mode and Name lists
'Type' A list of integers representing an action that has taken place
'Mode' A list of the string representations of the Type list
'Event' A list of integers representing the event that has taken place
'Name' A list of string representations of the Event list

Data set C

This represents the Panel State when the event condition is set to 11, 12, 13 or 14. This is feedback from HA when this components Services are used, from BEFORE the command is sent to the Alarm Panel.

Name Type Description
'Command' String One of "disarmed", "stay", "armed", "stayinstant", "armedinstant", "bypass", "eventlog" or "x10"
'Reason' Integer Depends on which event 'Command', one of 0, 1, 2, 3, 4 or 5 (See Note 1)
'PanelReady' Boolean The Panel Ready state (True or False)
'OpenZones' String List A list of Zones that are open (i.e. not closed)
'Bypass' String List A list of Zones that are bypassed
'Tamper' String List A list of Zones that have the 'raw' tamper set
'ZoneTamper' String List A list of Zones that have the "logical" tamper set

Note 1: Each 'Command' has the following reasons.

X
Meaning
Command
Reason
11 Arm/Disarm feedback "disarmed", "stay", "armed", "stayinstant", "armedinstant" 0,1,2,3,4
12 Bypass feedback "bypass" 0,1,2,3
13 Event Log feedback "eventLog" 0,1,2
14 X10 feedback "x10" 0,1,5

Reasons 0 to 5 are:

Reason Meaning
0 Success, Sending Command to Panel
1 Not sending command to panel, Request only supported when not downloading EPROM
2 Not sending command to panel, not allowed without valid pin
3 Not sending command to panel, user configuration setting prevented access
4 Not sending command to panel, invalid state requested
5 Not sending command to panel, general X10 Problem

Home Assistant Automation Examples

- alias: Alarm Armed So Turn Lights Off
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: alarm_control_panel.visonic_alarm
    to: armed_away
  action:
  - service: script.alarm_armed

- alias: Alarm Disarmed So Email Me
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: alarm_control_panel.visonic_alarm
    to: disarmed
  action:
  - service: script.alarm_disarmed

- alias: 'Alarm Siren Triggered Action'
  initial_state: true
  trigger:
    platform: event
    event_type: visonic_alarm_panel_state_update
    event_data:
      condition: 3
  action:
    service_template: persistent_notification.create
    data_template:
      title: "Alarm Siren"
      message: "{% set ety = trigger.event.data['Entity']|string %}
                {% if ety == 'None' %}
                    Alarm siren from unknown sensor
                {% else %}
                    The Sensor that triggered the Siren is the {{ state_attr(ety, 'friendly_name') }}
                {% endif %}"

- alias: 'Alarm Panel Arm/Disarm Request Action'
  initial_state: true
  trigger:
    platform: event
    event_type: visonic_alarm_panel_state_update
    event_data:
      condition: 11
  condition:
    condition: template
    value_template: >
      {{ trigger.event.data.reason in [1,2,3,4] }}
  action:
    service_template: persistent_notification.create
    data_template:
      title: "Alarm {{ trigger.event.data.Command|title|string }} Request Failed"
      message: "{% set st = trigger.event.data.OpenZones %}
                {% if st|length > 1 %}
                    There are open zones, check the following
                    {% for ent in st %}
                        {{ '\n' ~ ' '|safe*30 ~ state_attr(ent, 'friendly_name') | string }}
                    {% endfor %}
                    \n
                {% elif st|length == 1 %}
                    The {{ state_attr(st[0], 'friendly_name') | string }} is open \n
                {% endif %}
                {% set ta = trigger.event.data.Tamper %}
                {% if ta|length > 1 %}
                    There are zones with Tamper alarms, check the following
                    {% for ent in ta %}
                        {{ '\n' ~ ' '|safe*30 ~ state_attr(ent, 'friendly_name') | string }}
                    {% endfor %}
                {% elif ta|length == 1 %}
                    The {{ state_attr(ta[0], 'friendly_name') | string }} has Tamper set
                {% endif %}"

- alias: 'Alarm Panel Bypass Reject Action'
  initial_state: true
  trigger:
    platform: event
    event_type: visonic_alarm_panel_state_update
    event_data:
      condition: 12
  condition:
    condition: template
    value_template: >
      {{ trigger.event.data.reason|int in [1,2,3,4] }}
  action:
    service_template: persistent_notification.create
    data_template:
      title: "Bypass Request Failed"
      message: "{% set st = trigger.event.data.OpenZones %}
                Could not make the request to your alarm panel \n {{ trigger.event.data.Message|string }}
                {% if st|length > 1 %}
                    Also there are open zones, check the following
                    {% for ent in st %}
                        {{ '\n' ~ ' '|safe*30 ~ state_attr(ent, 'friendly_name') | string }}
                    {% endfor %}
                {% elif st|length == 1 %}
                    Also, the {{ state_attr(st[0], 'friendly_name') | string }} is open
                {% endif %}"

Of course you'll have to write your own scripts!

Attributes of the Alarm Panel Entity

This section shows the attributes that are created for the alarm_control_panel.visonic_alarm Entity.

Most of the attributes are created directly from the downloaded EPROM data that you can use in Automations etc. For attributes that start with a lower case letter, these are built-in HA attributes.

The following attributes are created from the data that is obtained from the panel using the various message data

Name Type Description
'Panel Status Code' Integer This is an integer representation of the main panel state. See Note 1
'Exception Count' Integer Counts how many comms disconnections there has been
'Download Timeout' Integer Counts how many failed attempts to download the panel EPROM data
'Download Retries' Integer Counts how many EPROM data blocks failed to upload and were re-attempted (max 30 and then stop)
'Watchdog Timeout' Integer Counts how many watchdog timeouts there has been (interruptions but not disconnected)
'Panel' Integer This is the panel number as set when the panel was created on the Integrations page
'Panel Mode' String Set to one of "Unknown", "Problem", "Starting", "Download", "Standard", "Standard Plus", "Powerlink"
'Model' String The model type of the alarm panel (or "Unknown")
'Panel Name' String The alarm panel name, type number and model number
'Door Zones' List of Strings A list of the Magnetic sensor names
'Motion Zones' List of Strings A list of the Motion sensor names
'Smoke Zones' List of Strings A list of the Smoke sensor names
'Other Zones' List of Strings A list of the Other sensor names
'Devices' List of Strings A list of the X10 switch names
'Power Master' String The Integration is connected to a PowerMaster series Panel, set to 'yes' or 'no'
'Panel Status' String See Note 2
'Plugin Version' String Set to the current plugin version
'Panel Ready' String Is the Panel Ready, set to 'yes' or 'no'
'Panel Alert In Memory' String Is there an alert in panel memory, set to 'yes' or 'no'
'Panel Trouble' String Is the Panel in the Trouble state, set to 'yes' or 'no'
'Panel Bypass' String Is the Panel Bypass set, set to 'yes' or 'no'
'Panel Armed' String Is the Panel armed, set to 'yes' or 'no'
'Panel Status Changed' String Has the panel state changed, set to 'yes' or 'no'
'Panel Alarm Event' String Has there been a Panel Alarm event, set to 'yes' or 'no'
'Panel Siren Active' String Is the Panel Siren Active, set to 'yes' or 'no'
'Panel Last Event' String Shows the last Panel Event, set to a mode string, a forward slash and then the zone string
'Panel Alarm Status' String The Panel Alarm Status, set to "None", "Intruder", "Tamper", "Panic", "Fire", "Emergency", "Gas", "Flood"
'Panel Trouble Status' String The Panel Trouble Status, set to "None", "Communication", "General", "Battery", "Power", "Jamming", "Telephone"
'Panel Last Event Data' Structure This is a data dictionary that contains a lot of information representing the state of the Panel

Note 1

  • -1 = Panel State Undefined (during Startup)
  • 0 = Disarmed
  • 1 = Arming Home
  • 2 = Arming Away
  • 3 = Entry Delay
  • 4 = Armed Home
  • 5 = Armed Away
  • 6 = Special ("User Test", "Downloading", "Programming", "Installer")

Note 2: Set to one of "Unknown", "Disarmed", "Home Exit Delay", "Away Exit Delay", "Entry Delay", "Armed Home", "Armed Away", "User Test", "Downloading", "Programming", "Installer", "Home Bypass", "Away Bypass", "Ready", "Not Ready", "Disarmed Instant", "Home Instant Exit Delay", "Away Instant Exit Delay", "Entry Delay Instant", "Armed Home Instant", "Armed Away Instant"

Extra Hidden Functionality

There are 2 extras that I include in the release

Using Powermaster Remote Programmer

If you connect to your panel using USB then you can plug that USB in to your Windows PC and use the Visonic Remote Programmer software directly

Download the software here

The user manual is here

You'll find the login username and password in the user manual.

"Powermaster Remote Programmer" Bridging

You can use the "Powermaster Remote Programmer" (PRP) from a Windows PC to connect to your panel if using the Ethernet option

  • Download and setup com0com on your PC with a Virtual RS232 connection using COM1 and COM2 (assuming these aren't existing real devices on your Windows PC)
  • Run bridge.py from a command prompt and connect to COM1 like this
python3 bridge.py -address 192.168.X.Y -port YourPort -usb COM1
  • Run PRP and connect to COM2

You can then use PRP with your panel, the bridge command prompt displays the messages going to/from the panel

The bridge can also be used to connect two COM ports together like this

python3 bridge.py -coma COM1 -comb COM2

For Testing without Home Assistant

I have included 2 python scripts that can be used for testing, they are located in the examples sub-directory. Disable the Integration in HA (or disable HA altogether) and use these scripts from a command line.

To install the necessary python libraries you must have an internet connection and type this

pip3 install -r requirements.txt

On Linux you may need to be logged in as root. Also, pip may need to be used instead of pip3.

There are 2 test scripts: a simple script that has a fixed interaction with the panel and a console based script using the library aconsole. Both can use ethernet or USB as the connection type and are configured from the command line.

python3 simple_example.py -address A.B.C.D -port YourPort
On Linux:   python3 simple_example.py -usb /dev/ttyUSB1
On Windows: python3 simple_example.py -usb COM1

Where A.B.C.D is the IP address of the hardware device you have in your panel e.g. 192.168.0.20 I've also used ttyUSB1 andCOM1 as examples, please use the correct port for your device.

It will perform as it does in HA but from the command line.

Note that the other settings from the configuration can be changed by editing either test file and changing the settings in "myconfig", these are the default values. With complete_example you can also change the settings from within aconsole, remember that some settings need you to disconnect and then connect to the panel. Type "v" for the variables list and to make a change type the number, an equals sign and then the new setting.

There is a console based test script.

python3 complete_example.py -address A.B.C.D -port YourPort
python3 complete_example.py -usb /dev/ttyUSB1                 <-- On Linux
python3 complete_example.py -usb COM1                         <-- On Windows

Hint: click in the bottom box of the aconsole and type "c" and then enter to connect, you'll see what I mean. Type "h" enter for help.

Troubleshooting

Getting the Panel to Connect to Home Assistant

If you have connected everything up and nothing works then set the HA logger settings to debug for this integration (see below). Go in to your config directory and view the HA log file home-assistant.log

If you use Ethernet, do you get this in the log file

Setting TCP socket Options Exception [Errno 111] Connection refused
Failed to connect into Visonic Alarm. Check Settings.

If so then there is no connection to the gadget you have inside your panel. It is likely that you have the IP address or port settings wrong. The only other alternative is that the TCP server in your gadget is not working or set up correctly.

Do you get [data receiver] entries in the log file. If not then we are not receiving any data from your alarm panel.

Especially if you get this in the log file:

[Controller] Visonic Plugin has suspended all operations, there is a problem with the communication with the panel (i.e. no data has been received from the panel)

Then there is no data coming from your panel and something is wrong with your hardware setup, port configuration or basic software configuration (outside of HA). If you're using a virtual machine or using docker then you may also need to pass through the USB/Ethernet connectivity for example.

If you have this in your log file

[Controller] Visonic Plugin has suspended all operations, there is a problem with the communication with the panel (i.e. data has not been received from the panel in 600 seconds)

Then the integration did start receiving data but then it stopped and nothing has been received from the alarm panel in the last approx 600 seconds (approx 10 minutes). Has the connection been broken, a wire became disconnected for example.

If you are getting [data receiver] entries in your log file then you are receiving some data from your panel, but you may still not get it working properly. So you've got it partially working but it's not quite there.... what can you do.

From experience, if the panel isn't doing what you think you should then leave it alone for a few hours. I believe, although I am not sure, that it has some kind of anti-tamper in the software for the RS232 interface and it stops allowing Powerlink connectivity. This is especially the case when you have been trying over and over again, eventually the panel stops interacting or, even worse, just starts sending the same message over and over again.

  • I try to get it in to Standard Plus or Powerlink mode but it only goes in to Standard mode

    • Check that Force Standard is set to 'no' (unticked)
    • If you have had anything connected to the panel in the past that has been in Powerlink mode then Do a Full Restart (see below what I mean *).
    • If you have a PowerMax+ or PowerMax Pro then check that Auto Enroll Supported is set to 'no' (unticked)
  • I try to get it in to Powerlink mode but it only goes in to Download mode

    • Has it been like this for less than 4 minutes, then wait as it can take a long time with some devices and panels
    • So it's more than 4 minutes, OK. Do a Full Restart Sequence as defined below.
    • Send me a log file (see below)

(*) Full Restart Sequence for Powerlink:

  • Stop HA
  • Restart the panel: Restart your Visonic panel by going in to and out of installer mode. Do not do any panel resets, the act of exiting installer mode is enough.
  • Wait for a couple of minutes for the panel to restart
  • Start HA.

Tips and Tricks

Loopback Test

I have introduced a loopback test in the integration.

So what does this mean and how does it work I hear you ask. In loopback mode, whatever data this integration sends then it will receive the same data back. You can therefore test your system without connecting to the panel to make sure all (most of) the hardware related settings and your wiring are correct.

What you need to do

If you disconnect both the Tx and Rx wires of your RS232 gadget from the panel and then connect the Tx to the Rx on your gadget (with a single wire) then you have a loopback. The data that the integration sends to the panel comes out of the gadgets Tx pin, as you have connected that to the gadgets Rx pin then the gadget believes it has received that data and passes it back to the integration. In other words, whatever data the integration sends to the panel, the integration receives the same data back. This is why it is called a loopback and the integration can be used to check the communication path.

You then need to restart the integration (deleting it and then adding it, or by simply restarting Home Assistant).

Notes:

  • You may still use power from the panel (leave ground and Vcc power wires connected) but connect the Rx to the Tx on the gadget (leave the Rx and Tx on the panel with nothing connected)
  • You may power a gadget (such as a Wemos) at your desk away from the panel and use this loopback test
  • This test validates your setup except for the RS232 settings (such as stop bits and baud rate). It is still possible that these are set incorrectly for your specific panel.

In normal operation, the first command that the integration sends to the panel is EXIT. This would exit any ongoing EPROM upload/download.

If the integration receives and detects this (as the panel never sends an EXIT command) then it enters in to LOOPBACK mode in the integration software. This suspends all other normal operation.

Note that in LOOPBACK mode:

  • The best way to see the output is to view the log file (although you should also see it on the Home Assistant "logs" page as I log the count output as a Warning)
  • No Home Assistant Entities are created i.e. alarm entity, X10 switches or sensors. You cannot see any entity attribute data so you need to look at the log file.
  • The integration sends an EXIT command every 5 seconds and increments a counter
  • By the time the EXIT command is received back the first time, the integration has already sent a few more commands (STOP, Start Download etc). Eventually it simply sends and receives the EXIT command and increments a counter
  • You should see "LOOPBACK TEST SUCCESS, Counter is 1" quickly after integration start but then it takes 10 seconds to get "LOOPBACK TEST SUCCESS, Counter is 2"

This is the output I get in the log file.

[Connection] Connected to local Protocol handler and Transport Layer
[_clearList] Setting queue empty
[StartDownload] Starting download mode
[sendPdu] Sending Command (Exit)    raw data 0d 0f f0 0a    waiting for message response []
[sendPdu]          Command has a wait time after transmission 1.5
[Controller] download_counter is 1
[handle_msgtype0F] LOOPBACK TEST SUCCESS, Counter is 1
........ connection made
[sendPdu] Sending Command (Stop)    raw data 0d 0b f4 0a    waiting for message response []
[sendPdu]          Command has a wait time after transmission 1.5
[handle_msgtype0B] Stop    data is
[sendPdu] Sending Command (Ack)    raw data 0d 02 fd 0a    waiting for message response []
[sendPdu] Resetting expected response counter, it got to 0   Response list length before 0  after 1
[handle_msgtype02] Ack Received  data =
[sendPdu] Setting Download Mode to true
[sendPdu] Sending Command (Start Download Mode)    waiting for message response ['0X3C']
[data receiver] Warning : Construction of incoming packet unknown - Message Type 0X24
[data receiver] Received Unknown PDU 0x24
[sendPdu] Sending Command (Ack)    raw data 0d 02 fd 0a    waiting for message response ['0X3C']
[handle_msgtype02] Ack Received  data =
[_clearList] Setting queue empty
[sendPdu] Sending Command (Exit)    raw data 0d 0f f0 0a    waiting for message response []
[sendPdu]          Command has a wait time after transmission 1.5
[handle_msgtype0F] LOOPBACK TEST SUCCESS, Counter is 2
[_clearList] Setting queue empty
[sendPdu] Sending Command (Exit)    raw data 0d 0f f0 0a    waiting for message response []
[sendPdu]          Command has a wait time after transmission 1.5
[handle_msgtype0F] LOOPBACK TEST SUCCESS, Counter is 3

You have it working using ethernet/wifi but it occasionally disconnects and doesn't reconnect

If you have it working but it occasionally disconnects (after hours or days of working OK) with the following in the log file

ERROR Connection Lost : disconnected because the Ethernet/USB connection was externally terminated.

This means that the connection between the Home Assistant device and the device in your alarm panel has been interrupted i.e. the TCP connection has been broken. If you are using wired ethernet then it is most likely that your home router is either re-booting itself or it is re-assigning IP addresses i.e. probably renewing the DHCP lease for the devices. If you are using wifi then as well as the above possibilities, it could also because you have a weak wifi signal that is dropping out. Is this a possibility? If it is then there is nothing I can do to help. If the connection between Home Assistant and the panel is lost, this will make my integration attempt to reconnect to the panel, it should succeed but sometimes it doesn't. Note also that restarting the integration in any way has the same error in the log file, are you calling the Home Assistant restart service?

When the siren is triggered, nothing shows in Home Assistant

First of all, you must have Home Assistant connected to your Alarm Panel in Powerlink Mode for this to work. Everything else should be working, except that when the siren is triggered, nothing shows up in Home Assistant. The Alarm Panel can be configured to provide a delay before reporting an alarm to the monitoring station (not applicable to alarms from FIRE, 24H SILENT, EMERGENCY, GAS FLOOD and TEMPERATURE zones). During this delay period, the external siren will not sound and the alarm is not reported. If the user disarms the system within the delay time, the alarm is aborted (and is not sent to Home Assistant). In this case, Home Assistant acts like a monitoring station as it is connected and mimics a Powerlink device.

In the alarm_control_panel.visonic_alarm Entity attributes in Home Assistant, find "Abort Time". This should be set to None.

On a PowerMaster the menu is: "10:ABORT TIME" under Operating Mode in the Installer Options, change it to 00 seconds.

Tamper setting for the Zones

I’ve done some experimenting and I think there are 3 tamper values. The first is the Main Panel Tamper, this is an attribute of alarm_control_panel.visonic_alarm called Tamper (the panel sends this through in the panel settings PDU A7).

Each zone then has 2 Tamper values, a zone tamper and a device tamper (through the zone settings PDU A5 message). I think that the device tamper is the raw data and the zone tamper is more like a logical setting.

Using a Supervised System (based on Debian) with a USB-to-serial adapter

If Debian is loaded with the USB-to-serial adapter plugged in the host, the OS will detect the serial device and assume it’s associated with a braille display. As a result, the brltty daemon will be loaded which prevents the Visonic integration from using the tty port. It has been this way for at least 8 years (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721763).

To detect if brltty is running, you can look for issues with the following commands

sudo dmesg | grep tty
sudo dmesg | grep USB
ps -ax | grep brltty

To remove brltty, the following commands can be used

sudo apt-get remove brltty
sudo apt autoremove

Alternately, brltty can be avoided by unplugging the USB serial cable prior to loading Debian.

Ubuntu, Ensure Modem Manager isn’t running

Ensure Modem Manager isn’t running. It’s not loaded by default on Debian, but I’m guessing it could be an issue on a Container or Core installation.

If it's a problem, these commands (or similar) should work:

To disable Modem Manager:

sudo systemctl stop ModemManager
sudo systemctl disable ModemManager

To remove it:

sudo apt remove modemmanager

Panel Interactions

For those interested I'm starting to document the details of the protocol to/from the panel.

We send and receive "Protocol Data Units" (PDU) to/from the panel. For the Visonic Panels, a complete PDU is constructed like this:

    A PDU header (0x0d)
    A PDU identifier byte
    The Message (0 or more bytes)
    A PDU checksum byte
    A PDU footer (0x0a)

All data will be represented as hex (as is the data above)

This is an example PDU received from the panel 0d a5 00 04 00 61 03 05 00 05 00 00 43 a4 0a

Most PDUs are of a fixed number of message bytes and so they are a fixed overall size. In the example, an "a5" PDU is always 15 bytes in total.

There are 3 PDUs that I cannot yet interpret

  • "F1" are variable length PDUs sent only by a Powermax+ panel
  • "22" no idea what this means
  • "B0" are PDUs that are only sent by a PowerMaster series panel. They give sensor updates I think but the functionality for this is very experimental.

Logger settings

If there are problems then set your logger: to output debug data to the log file for the visonic integration. The Home Assistant log file is called home-assistant.log and is located in your configuration directory. You'll have to upload your log file to pastebin, dropbox (or another) and put a link in your post so I can get it. Also, give me a bit of a description as to what you have tried and what goes wrong, what do you see in the frontend. Please post for help on the HA forum and not as an issue on Github, unless it is a properly confirmed issue.

In your configuration.yaml file do it exactly like this so I only get logged data from my Integration. You may have to comment out your existing logger: entry and replace it with this temporarily.

logger:
  default: error
  logs:
    custom_components.visonic: debug
    pyvisonic: debug
    custom_components.visonic.pyvisonic: debug
    custom_components.visonic.alarm_control_panel: debug
    custom_components.visonic.binary_sensor: debug
    custom_components.visonic.switch: debug
    custom_components.visonic.client: debug
    custom_components.visonic.config_flow: debug
    custom_components.visonic.create_schema: debug
    custom_components.visonic.select: debug
    custom_components.visonic.__init__: debug