Visonic Powermax and Powermaster Component


I have to admit that I can’t figure out what the HA exception is and why I’m causing it. It seems to be that self.hass is set to None which I thought could never happen, I might have to ask an HA expert on this one.

So, I have removed the update call from an A3 message, the effect of this will be a delay until the zone name shows up in HA so not a problem for now until I get more time to investigate or get some guidance on fixing it.

Can you please try, apart from checking that there are no exceptions can you also check that the information such as this is correct i.e. is Zone 1 the Front Door sensor?

Are all the other zones correct and can you tell me the “Message Count is” values. Another fragment of your log file would be much appreciated again please.

Also, are there any A6 messages in your log file, can you search for “handle_MsgTypeA6”
This should log the Zone type in to the log file

And lastly, I know that you probably know this already but setting this:

force_standard: 'yes'

Will always force it in to Standard mode, it will not try to get in to PowerLink mode


Thx for the improvements. This is what I did: Installed Restarted. No errors.

After the first handle_msgtypeA5 the znames are reported None. But zone names are coming in at the first handle_MsgTypeA3 message. Message counts in all those handle_MsgTypeA3 messages are 4 for all zones. After that, there is a handle_msgtypeA5 message again with correct znames.

I don’t see handle_MsgTypeA6 messages.

Yes, I know. I will test later if it will enter into PowerLink. It wouldn’t succeed on the first day I tried the component (and gave some errors), so I’ll decided to start with StandardMode. I saw in the documentation that entering could be troublesome sometimes but that you gave some tips there. Will try soon.


Tried to enter PowerlinkMode today (force_standard: 'no') after a Full Restart Sequence. Didn’t succeed.

  • After 2 minutes there is a Download Timer has Expired, Download has taken too long message.
  • No zone names anywhere in the log.
  • The first handle_msgtype06 is after 13 minutes (since start). They all are
    [handle_msgtype06] Timeout Received data.
  • Still in DownloadMode after 18 minutes (since start).
  • I see a pattern of
    • msgType not in self.pmExpectedResponse Waiting for next PDU : expected ['0X2'] got 0X6
    • [pmSendPdu] waiting for message response ['0X2']
    • msgType not in self.pmExpectedResponse Waiting for next PDU : expected ['0X2'] got 0XA5
    • [pmSendPdu] waiting for message response ['0X2']

I switched back to StandardMode again, because that’s working fine for me.


Just a quick status update…:slight_smile:

That’s good, it’s what I would expect. The message count of 4 means it’s good, every message holds 8 zones, 4 messages makes 32 zones in total and that’s the correct number. The zone names no longer get pushed through with an A3 message, we need to wait until the A5 message which is a few seconds later so not really an issue I don’t think. The fact that there aren’t any A6 messages is also not a problem, if the panel sends them then it’s a bonus in Standard Mode.

As for you trying PowerLink and it staying in Download, thanks for giving it a try, I’ve never seen an 06 message in my setup before so it’s not really something I’ve tested properly. I do receive them and I’ve updated the processing of them to try to do something more sensible, I’ll upload a new version to Github soon. Like I’ve said before though, I believe that getting it in to PowerLink state is very timing dependant and because HA runs on different hardware types and because different HA installations use different Components then the timing can be different between installations.

I’m also trying to update the Component to remove any existing entities when it starts so we don’t get the “Entity ID already exists” exceptions but I’m still working on it. I need a way to remove the entity and not just its state which is all I’ve managed to do so far.


first of all I would like to thank you for all the work done! It is very good and has helped me to “relive” my Visonic alarm.
Once I have everything installed I would like the sensors, could be seen in Apple’s homekit! For now I have not found the way and humbly believe that it is because the HA does not correctly interpret the sensors of the alarm.
I have a camera of Netatmo and HA apart from the camera detects two more sensors. Do you know if there is any way to do it?

Thank you so much!
46 02



I’m new to HA and I like it so far. Very straight forward in configuring, but now I have a problem installing/configuring Visonic.
I get an error message saying “ImportError: No module named ‘serial_asyncio’”.

Checked every requirement I could find, reinstalled them again, but no luck. I’m sure the connection works, because when I ran Wouter his visonic script I get response from the panel.
Anyone an idea?

Some snippets from the log file:

_2019-01-15 20:56:46 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.visonic. Make sure all dependencies are installed_

_ Traceback (most recent call last):_
_ File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/”, line 92, in get_component_
_ module = importlib.import_module(path)_

_ File “”, line 222, in call_with_frames_removed
_ File “/home/homeassistant/.homeassistant/custom_components/”, line 13, in _
_ import custom_components.pyvisonic as visonicApi # Connection to python Library_
_ File “/home/homeassistant/.homeassistant/custom_components/”, line 36, in _
_ from serial_asyncio import create_serial_connection_
_ ImportError: No module named ‘serial_asyncio’_
_ 2019-01-15 21:08:14 ERROR (MainThread) [homeassistant.loader] Unable to find component visonic_
_ 2019-01-15 21:08:14 ERROR (MainThread) [homeassistant.setup] Setup failed for visonic: Component not found._


I’m not sure why HA didn’t automatically install the necessary library “pyserial-asyncio” but I did notice in the HA documentation that I should be calling on them “on demand”. I’ve just uploaded version, please give it a try. If this doesn’t work and you have direct access to the command line then try this

pip install pyserial-asyncio

and then restart HA.

The version I’ve uploaded may help with this too, the sensors are no longer “Binary”, they are derived directly from the HA Entity, this means that they are and can be multistate.


Hi Dave,

Thanks for the response and the new version. Will try it later on.
The ‘pyserial-asyncio’ is already installed, also all other required modules. So that is not the problem.
Will give you an update after installing the new version.

I did some checking on Python, because I was sure I installed all modules files needed. Unfortunately it seemed that Python2.7 became my default Python version again, despite the fact I changed that earlier on. Fix that, removed and install all modules again.
Then downloaded you’re new version, not tested says HA :grinning:, started it again…and yep there it is. My Visonic button for arming and disarming and no errors in the HA log anymore.
Will now look at further configuring possibilities.
For now ‘muito obrigado’!
(many thanks)


Hi Dave,
thank you very much for all your contributions, it is incredible that someone is so good in the times they run today.
I have installed your update and … it has not recognized the sensors. the alarm if I see it and I can interact with it but the sensors have disappeared. I have force_standard, yes and no, tried with the same result.
Should I do something that escapes me?
He sends me an error several times (one per sensor)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/”, line 352, in _async_add_entity
await entity.async_update_ha_state()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/”, line 272, in async_update_ha_state
device_class = self.device_class
File “/config/custom_components/sensor/”, line 85, in device_class
return self.visonic_device.stype.lower()
AttributeError: ‘NoneType’ object has no attribute ‘lower’

Regars and thanks in advance


OK thankyou, I’ve repaired the error that I introduced in the conversion to an HA Entity and I’ve uploaded version, please give it a try.


Good morning, with this update I have recovered the sensors in homeassistant, everything and I can not connect with powerlink. A part of this, which could be unimportant, Apple’s homekit, I still detect the alarm, but not the binary sensors. regards.


Are you able to execute python3 from a command prompt? If so then I have just included a test script called to GitHub. First of all stop Home Assistant as you cannot have more than 1 client connecting to the Alarm Panel. You can then use the test script as follows.

python3 -address a -port p
    e.g. python3 -address -port 10454

Although I haven’t tested the USB (for RS232) connectivity, this should also work

python3 -usb /dev/ttyUSB1

To get help using it, type this

python3 -h

It will try to connect in Powerlink mode by default, I may put more command line options in later if this is useful.

If you see this line in your command line window, then you have connected in Powerlink mode:

INFO:pyvisonic:[handle_msgtypeAB] ***************************** Got PowerLink Keep-Alive ****************************

I hope this makes sense. By running it from the command line it takes most (but not all) of the timing problems away and has a higher success rate of connecting in Powerlink mode. If you see this line then stop the test script and start HA straight after, the Visonic Component in HA then has a pretty good chance to “inherit” the Powerlink mode from what you did at the command line.

I hope this helps you if you’re still trying to achieve Powerlink mode, let me know if you try it and if it helps!


I’m sorry but I’m not sure why this isn’t working with Apple’s homekit. It is not something that I have so I can’t try it. I create HA sensors as standard HA Entities so I don’t know why they aren’t coming through.

Do you have other sensors that do appear in Homekit, if you can give me a list of sensors that work I can take a look at their python code to see what they may do different to what I do. I looked at the Netatmo python source and I couldn’t see any difference.


Hi Dave, thx for your reply. I’m fine with standard mode and a bit hesitating to do extra steps on command line to make it connect. But if I find time somewhere I will test it, because it can give you more information for improving your component. I’m running on Hassio though not sure if python3 command can be given to it…


Good morning Dave,
I am very grateful for the interest in solving the problems I am reporting.
As for the HA sensors that are seen in Hk, if you have already reviewed those of netatmo, the truth is that I do not know where the “error” may be. For now, I will continue working like this.

Once the subject of the sensors is parked, now I would like to be able to connect by means of powerlink since it only does it in standard (force_stardand: no)

in the debug I get the following:
debug.yaml (8.0 KB)



Hi, I’m going to need a lot more of the log file please, and from the beginning so I can see the sequence of what happens

Can you put something like this in your configuration.yaml please

  default: error
    custom_components.visonic: debug
    custom_components.sensor.visonic: debug
    custom_components.pyvisonic: debug

Have you tried doing what I suggest in post 132 of this thread and use a command line to run

I’ll also take another look at the Netatmo sensors, just in case I missed a difference between it and my sensor code.


Good afternoon Dave, I’ll attach the requested file.home-assistant.yaml (105.2 KB)

As for the instructions in message 132, I use Hassio and I have tried to do it but I guess that because of the permissions it does not leave me! So I can not prove it.

For the issue of sensors if you need me to send something, you just have to tell me. I have sensors in a netammo camera (those included) in HA and in HK.



I think that I’ve fixed it and have what you need now. However, it is a breaking change to what was there before hence the version change to that I’ve uploaded to Github.

There are 2 main *** breaking changes ***

  1. I have converted each sensor entity to a binary_sensor. The impact is:
    • The states are no longer “-”, “T” and “O”, they are off or on.
    • Essentially on is a combined “T” or “O”.
    • They come up blue and not orange in HA.
    • If you have used “sensor.visonicXXXXX” you’ll need to change to “binary_sensor.visonicXXXXX”
  2. I set the device_class correctly. See my Github page for how you can override my defaults to set your own device class for each sensor. For more info on the device classes see here

Please give it a try and apologies to those that currently use, but give a go :smile:


Good morning Dave,
spectacular, inclinable! Now Homekit recognizes the sensors and it is also possible to interact with them. Bravo!!!

As for the connection via powerlink I have not yet been able to solve the problem. Currently in the App Homekit tells me that the battery level of the sensors is 0% so I suppose that if we connect Powerlink mode that field would also be updated.

Now I’m going to configure the siren (which I have to add to the powermax) and then two X10 elements (light and blind).

I’ll leave you commenting!

Thankful for all your project and your attention



Regarding the issue of the battery, I think I have found the error

BatteryLevel: value = None is not a numeric value.

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/concurrent/futures/”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/homekit/”, line 127, in update_battery
File “/usr/local/lib/python3.6/site-packages/pyhap/”, line 197, in set_value
value = self.to_valid_value(value)
File “/usr/local/lib/python3.6/site-packages/pyhap/”, line 146, in to_valid_value
raise ValueError(error_msg)
ValueError: BatteryLevel: value=None is not a numeric value.