Custom component dont load anymore (hail mary longshoot)

I have used a component (worked some HA releases ago) that has been developed by someone else and I have trouble getting it to work now. The guy that made this component seems to have abandoned it. I believe that the fault is that the file structure of the component is not supported anymore.
The component is located directly in custom component folder and is called visonicalarm.py.
the visonic import (row 3) seems to work but the component uses two platform that does not load anymore. That part in the code that I think needs changing is:

def setup(hass, config):
    """ Setup the Visonic Alarm component."""
    from visonic import alarm as visonicalarm
    global HUB
    HUB = VisonicAlarmHub(config[DOMAIN], visonicalarm)
    if not HUB.connect():
        return False

    HUB.update()

    # Load the supported platforms
    for component in ('sensor', 'alarm_control_panel'):
        discovery.load_platform(hass, component, DOMAIN, {}, config)

    return True

And the file structure is like this:

Custom_components(folder)
	visonicalarm.py
	sensor(folder)
		visonicalarm.py
	alarm_control_panel(folder)
		visonicalarm.py
	visonic(folder)
		alarm.py
		__init__.py

My thinking is that the file structure needs to be changes somehow and the platforms needs to be started in another way.
This is a loooong shot, that the solution might be this easy, but atm my coding skills are to poor.
Hoping that there are a easy fix, any ideas?

Hi,
i created a small zip

just put it in custom_components folder

i just didnt figure out yet why sensor isnot working

Cool, thanks. Will try it when I get home. Currently I have a raspberry with 0.89 running this component and sends alarmdata to my main home assistant pi via mqtt.
I have never got the sensors to work, just the panel.

Did you have to modify any of the code in the files?

Yes i modified some imports of the HUB for get the plugin work again with the new system of hassio

Today i managed to get the sensor works, my sensor was of type “CONTACT_AUX” and not contact

try this out, i made a new repo… just copy custom components folder in urs

Later i will try to get Motion sensor work as well

Hmm, it loads for the first time on releases over 0.90.x… great work. Panel gets up nice
However I get critical errors from the sensor.py

Any ideas?

None

18:24 custom_components/visonicalarm/sensor.py (CRITICAL) - message first occured at 18:24 and shows up 7 times

INDOOR

18:24 custom_components/visonicalarm/sensor.py (CRITICAL)

LCD_KEYPAD

18:24 custom_components/visonicalarm/sensor.py (CRITICAL)

BASIC_KEYFOB

18:24 custom_components/visonicalarm/sensor.py (CRITICAL)

MOTION

18:24 custom_components/visonicalarm/sensor.py (CRITICAL) - message first occured at 18:24 and shows up 5 times

SMOKE_HEAT

18:24 custom_components/visonicalarm/sensor.py (CRITICAL) - message first occured at 18:24 and shows up 2 times

CONTACT

18:24 custom_components/visonicalarm/sensor.py (CRITICAL) - message first occured at 18:24 and shows up 5 times

MOTION_CAMERA

18:24 custom_components/visonicalarm/sensor.py (CRITICAL)

Tried update changing back to CONACT from CONTACT_AUX, made even more errors, so it was not that :slight_smile:

Oh, i left some debug messages

i updated github repo with fixes… contact sensor should work fine now (just redownload from github custom_components)

im trying to get motion sensor works but idk what configuration it needs in Alarm System … it doenst show any changes in the VisonicApp when i trigger them

Hmmm… I put visonicalarm in custom_components…
Still unfortunately sensors:

Log Details (ERROR)
Sun Jun 09 2019 18:21:12 GMT+0200 (centraleuropeisk sommartid)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 338, in _async_add_entity
    suggested_object_id or entity.name or DEVICE_DEFAULT_NAME
  File "/config/custom_components/visonicalarm/sensor.py", line 60, in name
    return 'Visonic Alarm Contact ' + self._id
TypeError: can only concatenate str (not "NoneType") to str