Visonic Powermax and Powermaster Component

I found test.py by looking back through the code in github.

It looks like the last release that included test.py available on github is release 0.5.0.1 and is missing on releases after that one.

I’ll download it and try it.

When I tried to run the test.py from version 0.5.0.1 with the code in 0.6.6.0 I get the following error:

â  visonic python3 test.py -usb /dev/ttyUSB0
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    import pyvisonic
  File "/config/custom_components/visonic/pyvisonic.py", line 53, in <module>
    from .pconst import PyConfiguration, PyPanelMode, PyPanelCommand, PyPanelStatus, PyCommandStatus, PyX10Command, PyCondition, PyPanelInterface, PySensorDevice, PyLogPanelEvent, PySensorType, PySwitchDevice
ImportError: attempted relative import with no known parent package

Seems like there is quite a difference in pyvisonic.py when a did a quick comparison.

So I removed the integration and manually installed version 0.5.0.1 from github.

When I now run test.py I get:

➜  visonic python3 test.py -usb /dev/ttyUSB0
DEBUG:asyncio:Using selector: EpollSelector
Traceback (most recent call last):
  File "test.py", line 47, in <module>
    conn = pyvisonic.create_usb_visonic_connection(port="//./" + args.usb, loop=testloop, event_callback=add_visonic_device)
TypeError: create_usb_visonic_connection() got an unexpected keyword argument 'port'

I checked test.py and pyvisonic.py and modified “port” to be “path” in test.py and reran with: “python3 test.py -usb /dev/ttyUSB0” and a whole bunch of messages started to scroll through the terminal window. Things such as:

0:00:03.084538 < 1809>    DEBUG   [pmSendPdu] Setting Download Mode to true
0:00:03.086108 < 1815>    DEBUG   [pmSendPdu] Sending Command (Start Download Mode)    raw data 0d 24 00 00 56 50 00 00 00 00 00 00 35 0a    waiting for message response ['0X3C']
0:00:03.120105 < 1652>     INFO   [data receiver] *** Received validated message 0X2 ***
0:00:03.121215 < 2652>    DEBUG   [handle_msgtype02] Ack Received  data = 
0:00:03.122287 < 1652>     INFO   [data receiver] *** Received validated message 0X8 ***
0:00:03.123080 < 2690>     INFO   [handle_msgtype08] Access Denied  len 0 data 
0:00:03.123880 < 2694>    DEBUG   [handle_msgtype08]                last command 24 00 00 56 50 00 00 00 00 00 00 
0:00:03.124560 < 2704>    DEBUG   [handle_msgtype08] Got an Access Denied and we have sent a Download command to the Panel
0:00:03.125243 < 2712>    DEBUG   [handle_msgtype08]                   Try to auto enroll
0:00:03.126413 < 1905>     INFO   [StartDownload] Starting download mode
0:00:03.127943 < 1879>    DEBUG   [pmSendPdu] Resetting expected response counter, it got to 4   Response list length before 0  after 1
0:00:03.238349 < 1815>    DEBUG   [pmSendPdu] Sending Command (Auto-Enroll of the PowerMax/Master)    raw data 0d ab 0a 00 00 56 50 00 00 00 00 00 43 60 0a    waiting for message response ['0X2']
0:00:03.263696 < 1652>     INFO   [data receiver] *** Received validated message 0X2 ***
0:00:03.264908 < 1666>    DEBUG   [data receiver] msgType 0X2 got it so removed from list, list is now []
0:00:03.265962 < 1672>    DEBUG   [data receiver] msgType 0X2 resetting expected response counter, it got up to 0
0:00:03.266913 < 2652>    DEBUG   [handle_msgtype02] Ack Received  data = 43 
0:00:03.268096 < 2655>     INFO   [handle_msgtype02]    Received a powerlink acknowledge, I am in DOWNLOAD mode

So it looks like something is working. Not sure what to do next.

It looks like it is receiving and transmitting data OK, in the output that you show it’s rejected the download code. Go back to using HA, delete the integration from HA and create it again, this time set the download code to AAAA and let me know if it works. Without that though it should get to Standard Mode and still work in HA, if the EPROM download works it goes to Standard Plus mode and if then it enrolls properly then I say it’s in Powerlink mode.

I’d need a log file to know more. Please can you do as I suggest with the change of download code and upload an HA log file to pastebin. Set the HA log file settings as per the wiki.

Excellent. The AAAA worked for the download code. I now see 3 devices. I’ll need to properly set up my zones/sensors now. It says it’s in Standard Plus mode but looks like it doesn’t say it’s in Powerlink mode.

I tried to define the path and file name for the log files but it did not create separate files. In any case, the visonic entries are found in the partial home-assistant.log found at this pastebin:

OK, that’s progress. I can see that you have a powermax+ panel and that it’s in “Standard Plus” Mode, as per the wiki you need to:

  • Untick “Synchronise Time with the alarm panel”
  • Untick “Auto Enroll Supported”
  • Manually enroll from your alarm panel. If you search the wiki page for “powermax+” you’ll find this information.

image

You also have force numeric keypad set so it will show you a keypad to enter the alarm code.

Nearly there :slight_smile:
D

first off - this is an amazing bit of work Dave - thank you.

I’ve got Powermaster 33 - and have the integration working for arm/disarm only - no devices being shown. The log file says the panel type is unknown and this appears: WARNING: Cannot process panel EPROM settings, the panel is too new.

It does appear to eventually get to see the sensors but they’re not passed to Home Assistant (I can only arm/disarm within HA)

In the log it’s seeing a cpl of unknown messages - logfile here: 2021-04-15 18:18:16 WARNING (MainThread) [homeassistant.loader] You are using a - Pastebin.com

Hopefully of some help with the PM33 integration - if I can do anything to help just let me know

I should add I enabled the B0 message handling at 1835 in the log file (didn’t notice I hadn’t enabled it)

Hi and welcome.
I’ve just updated the integration and uploaded to github, this will hopefully incorporate Panel Type 15 as a PowerMaster33. Can you please give it a try and do 2 things for me. Let me know what it does and doesn’t do, and also upload another log file to pastebin. That way I can look at the details to get some confidence that it works in a similar way to the existing panels that are supported.
:slight_smile:

Sorry about the long post. Thought this would be useful for others that may come across this, especially those with a Powermax+

OK. I’ve got it in Powerlink mode now. What exactly does going into Powerlink mode change do?

FYI, there is a good Powermax protocol thread at: Visonic Powermax Powerlink protocol description - Home Automation Domotica Forum Europe, Bwired Forum

Now, I have to set up the zones and sensors…

FYI, the wiki says that INSTALLER MODE → 5. DEFINE COMM → 27: MAST. DL CODE is where you enroll the Powerlink manually. That’s where you define or see the download code “AAAA”. The actual menu entry is INSTALLER MODE → 7. ENROLL PWRLNK → 01: INSTALL. When I did this, the logs started showing it was in Powerlink mode.

As well, I added and removed the integration several times. In between attempts, you need to remove the Powerlink from the alarm panel and then add it back in. I tried to re-add the integration without removing the Powerlink enrollment but the logs did not show Powerlink mode. I removed it from the alarm panel and re-added it and then the log showed Powerlink mode. I noticed that you need to enroll the Powerlink on the alarm panel before the Powerlink Counter in the log reaches the end…don’t know what the max counter is for that.

To remove the Powerlink enrollment, you do the same steps as enrolling it and then it will prompt to remove it instead. Then you add it back with the same method again.

QUESTION: The Wiki shows two Lovelace cards…one with the sensors (i.e. Kitchen, Lounge, Garage Door, etc) and the arm/disarm with the Alarm Status (i.e. Mode, siren, exception count, etc). Mine only has the arm/disarm with the numeric keypad. How do I get this additional info or different cards?

I uploaded a portion of my latest log here: 2021-04-16 03:19:00 DEBUG (MainThread) [custom_components.visonic.config_flow] V - Pastebin.com

I’m using a Raspberry Pi / Linux. The following applies to Raspberry Pi and/or Linux.

FYI, you mentioned about setting the parity, etc for the serial port. I checked the settings with:

stty -F /dev/ttyUSB0 -a

To set the parameters as 9600, 8 data bits, 1 stop bit, No parity (i.e. 9600 8, N, 1) you set the parameters with:

stty -F /dev/ttyUSB0 9600 cs8 -parenb -cstopb

Note that there may also be another device of /dev/ttyAMA0. I’m not sure if that’s the same device or not. From what I can tell, this is the ARM serial port definition. I set it to 9600 8N1 as well, although I’m not sure I had to.

Thanks for helping!

Hi,

That’s OK, I’ve updated the wiki page with some of the information you have provided here.

Added this description to the wiki.

Thankyou but I have quite a list of internet links and I already have that one. Although there aren’t that many :slight_smile:

I’ve updated the wiki, thankyou

Again, I’ve updated the wiki. For info, yours is the oldest model PowerMax+ that I’ve seen so it may be something to do with the firmware in the panel. Other Powermax+ users haven’t had that problem as far as I know.

I created entities from the attributes of the alarm_control_panel.visonic_alarm entity, something like this:

- platform: template
  scan_interval: 5
  sensors:
      visonic_exception_count:
        value_template: >-
                    {{ state_attr('alarm_control_panel.visonic_alarm', 'Exception Count') | int }}
        friendly_name: 'Panel Exception Count' 
      visonic_panel_status:
        value_template: >-
                    {{ state_attr('alarm_control_panel.visonic_alarm', 'Panel Status') | title  }}
        friendly_name: 'Panel Status' 
      visonic_panel_mode:
        value_template: >-
                    {{ state_attr('alarm_control_panel.visonic_alarm', 'Panel Mode') | replace("_", " ") | title  }}
        friendly_name: 'Panel Mode' 

then I added the entities to a card in the frontend.

Thanks for the stty commands, again I’ve added this information to the wiki.

hi again - apologies for the delay in testing: 2021-04-17 17:04:33 WARNING (MainThread) [homeassistant.loader] You are using a - Pastebin.com

doesn’t seem to make as much progress as 0.6.6.0 did unfortunately

thanks so much again,

Apologies it’s my fault, I forgot to extend an array enough in the code. I spotted it straight away using your log file.
I’ve just made a bugfix update to github as version 0.6.7.1
Please do the same again and upload to Pastebin
Thankyou
:slight_smile:

wow. immediate results - sensors showing in HA with status!

thank you again!

Let me know if you have any problems, thanks for the log file, it looks OK

hi again - the connectivity appears nice and stable - i tried arming and violating a zone to see if it would give a notification - it doesn’t - not sure if it’s my HA config - i can see it recognising the zone violation - would it also show siren sounding?

Thankyou :slight_smile:

https://pastebin.com/9skrKXa2

just a quick update - panel was reporting trouble for communication after changing state - not sure if there’s something in the log that might help (had been solid until then): https://pastebin.com/9FSbRh3h

It won’t let me see either file on pastebin, maybe you’ve uploaded too much of the file as I can still see your previous log file on pastebin.

apologies - had messed the permission - should be visible now

Morning - I followed the reset process on your wiki - and re-enabled comms this morning: 2021-04-18 10:40:52 WARNING (MainThread) [homeassistant.loader] You are using a - Pastebin.com

Reporting trouble on communication - apologies if i’m overdoing it with the logs.

Haha, as far as I’m concerned you can never over do the logs, the more info I have the better I can work out what’s going on.

After a quick look, it’s indicating “trouble” and a “communication failure” but not with the connection between the panel and this integration so I think it’s with something else. Do you have a telephone line connected to your panel? Either wired or mobile phone?
I’ll keep looking through the log to the end in case I spot something else

EDIT: It may be that you don’t have a telephone connection and the panel tried to use it. Check your panel settings please.

hi - i checked the comms settings - GPRS and PSTN weren’t configured but i did still have the receiver IP set to the powerlink server I’d been subscribed to - i had the IP of the HA server as secondary - could that be it? In any case I’ve removed the old IP and only got the HA server as the first IP.

New log - pastebin.com/1m0FQ28W

That looks OK now, do you still have the panel trouble status?

For this integration I don’t think that you need to set the IP address of the HA server either. This integration connects using RS232 (via USB or Ethernet) and does not use the IP from the panel. Please clear all IP addresses and see if this integration still connects to your panel, it should do. Is your panel connected directly to an Ethernet connection, to your home router? It doesn’t need to be for this integration. As I said, this integration uses the RS232 panel connection to either a USB or Ethernet passthrough device.

Anyway, back to the problem with the siren, if there is not a Trouble status, please try arming the panel and triggering the siren, disarming and then upload another log file please :slight_smile:

thanks so much again - using your option 2 for connectivity - USR-TCP232-E2. I set home and violated a zone in this log at 2021-04-18 13:26:55

i can see the violation and the alarm sounds - should i see a status change in HA?

log: 2021-04-18 13:25:21 DEBUG (MainThread) [custom_components.visonic.pyvisonic] [ha - Pastebin.com

just in case i was being stupid (and good chance i still am!) i set an automation in HA to send a notification if “Visonic Alarm Triggered” event occurs - it doesn’t seem to detect that it has: another log from zone violation in case it helps: 2021-04-18 16:07:57 DEBUG (MainThread) [custom_components.visonic.pyvisonic] [ha - Pastebin.com

sorry - 1 last tiny thing that’s just odd but just in case it helps - Zone 07 in the panel is called “Office” on the Visonic Control Panel but the integration detects it as “Guest Room” - not sure if that’s just a code lookup or weird PM33 stuff…

Thanks :smiley: