plaksnor / HASS-JablotronSystem

Jablotron component for Home Assistant
20 stars 11 forks source link

issues connecting central unig #9

Open rampie opened 4 years ago

rampie commented 4 years ago

Hey, Could someone help me?

If i look to the command with dmesg | hid i get the following result: afbeelding

so i assume i need to add the following code: jablotron_system: port: /dev/hidraw3 code: xxxx (where xxxx is either a service code or a code to (de-)activate the zones

When i try this, i come up with the following error: ERROR (MainThread) [homeassistant.components.hassio] Component error: jablotron_system - Integration 'jablotron_system' not found.

anything i'm missing?

Shamshala commented 4 years ago

@rampie Is that from config check? (before restart of HA) If so, try to restart it first without the config.yaml part for 'jablotron_system' (or comment it out) and then paste the config and restart it again.

rampie commented 4 years ago

This is after a restart of HA. and nothing configured yet, just added it in configuration.yaml

Shamshala commented 4 years ago

Ok, what version of HA do you use? Where did you place the jablotron_system folder? Did you edit the code according to the few pull requests?

rampie commented 4 years ago

Home Assistant 0.110.4

jablotron_system folder? is in \config\custom_components\jablotron_system

i just totally rebooted averything and i don't receive the error now. So i thin k it is regsitered, however I don't find the Jablotron back under my Entities*....

rampie commented 4 years ago

But i do get this under logs:

19:44:31 jablotron_2 turned off 19:44:29 jablotron_2 turned on

so i guess something is going on now...

but i do get this error in logs 2020-06-04 19:51:11 ERROR (MainThread) [homeassistant.components.alarm_control_panel] Error while setting up jablotron_system platform for alarm_control_panel Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/config/custom_components/jablotron_system/alarm_control_panel.py", line 24, in async_setup_platform async_add_entities([JablotronAlarm(hass, config)]) TypeError: Can't instantiate abstract class JablotronAlarm with abstract methods supported_features

Shamshala commented 4 years ago

Ok, same error as in previous thread afterall :laughing:

If you use just @plaksnor 's code you need to: 1) add the green lines from this ff52ddb in your alarm_control_panel.py 2) replace AlarmControlPanel in line 26 for AlarmControlPanelEntity to your alarm_control_panel.py 3) replace BinarySensorDevice in line 65 and line 93 for BinarySensorEntity in binary_sensor.py. 4) delete the __pycache__ folder from \config\custom_components\jablotron_system 5) restart HA

Then it should work (hopefully) Points 2) and 3) are just for future compatibility since 0.110 :slightly_smiling_face:

rampie commented 4 years ago

did i miss something in green? 2020-06-04 20:10:09 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 139, in component_platform_discovered await self.async_setup_platform(platform, {}, info) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 229, in async_setup_platform self.hass, self.config, self.domain, platform_type File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in async_prepare_setup_platform platform = integration.get_platform(domain) File "/usr/src/homeassistant/homeassistant/loader.py", line 273, in get_platform f"{self.pkg_path}.{platform_name}" File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 724, in exec_module File "<frozen importlib._bootstrap_external>", line 860, in get_code File "<frozen importlib._bootstrap_external>", line 791, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/config/custom_components/jablotron_system/alarm_control_panel.py", line 19 SUPPORT_ALARM_ARM_NIGHT)from homeassistant.core import callback ^ SyntaxError: invalid syntax

rampie commented 4 years ago

i just rechecked all and can tell the following:

result: 2020-06-04 20:20:25 ERROR (MainThread) [custom_components.jablotron_system.alarm_control_panel] Unexpected error: expected str, bytes or os.PathLike object, not NoneType

Shamshala commented 4 years ago

Upload the files you've modified somewhere, i'll check it. :slightly_smiling_face:

rampie commented 4 years ago

Here are the modified files.

files.zip

Shamshala commented 4 years ago

Ok, the problem is that you've modified a lot more than i've said. It took me some time to realized that :laughing: You know what, try my fork, i've done the modifications few minutes ago (i hope it's done right) and i added the one you've tried to add as well...

You are gonna be my guinea pig :smiling_imp: (haven't tried that though, so let me know)

rampie commented 4 years ago

OK, removed old files, downloaded yours and restarted HA.

Result: 2020-06-04 22:24:09 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 139, in component_platform_discovered await self.async_setup_platform(platform, {}, info) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 229, in async_setup_platform self.hass, self.config, self.domain, platform_type File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in async_prepare_setup_platform platform = integration.get_platform(domain) File "/usr/src/homeassistant/homeassistant/loader.py", line 273, in get_platform f"{self.pkg_path}.{platform_name}" File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 724, in exec_module File "<frozen importlib._bootstrap_external>", line 860, in get_code File "<frozen importlib._bootstrap_external>", line 791, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/config/custom_components/jablotron_system/alarm_control_panel.py", line 139 def supported_features(self) -> int: ^ IndentationError: unexpected unindent

but i do see your fork is las updated 2hours ago?

Shamshala commented 4 years ago

I'm dumb and blind. :laughing: Try it now. (don't forget to delete the __pycache__ before restart)

rampie commented 4 years ago

i'm deleting entire folder of jablotron_system so i_psycache is gone also ;)

At the moment no more errors at the log. i'm still seeing the jablotron_1 entity but can't adjust them. I'm going to test if i can see those entities geting registered now...

rampie commented 4 years ago

i'm seeing the jablatron_2 sensor is going on and off, but can't change entitie names.

What i do see is that i have a visual control panel, which i didn't have before. I'll keep testing and ask feedback where needed :)

Shamshala commented 4 years ago

Add this to your configuration.yaml and try to trigger your sensors, then check loggs for "packets".

logger:
  logs:
    custom_components.jablotron_system: debug
    custom_components.jablotron_system.alarm_control_panel: debug
rampie commented 4 years ago

you mean these?

2020-06-04 23:17:16 DEBUG (ThreadPoolExecutor-1_1) [custom_components.jablotron_system.binary_sensor] PortScanner._triggersensorupdate(): Send packet 52 01 02

For some reason it's not getting a unique ID, which is causing i can't change the friendly name.

Also, if i add those to my dashboard, The first sensor goes on and off when triggered, the second or third activated sensor, stays off. I think it's all connected, just wanted to be complete with this.

Shamshala commented 4 years ago

Nope, you need strings starting by 55 08..., 55 09... or d8 08...

Generating unique ID isn't part of the code. Here is a pull request which should cover it but i hadn't time to look more into it. Are you unable to change the names even via customize.yaml? (at least i've done it in a past and it still works for me) bgyshtyhfdxjgfxkmhzxcdhrfhrdfyx

rampie commented 4 years ago

OK, the friendly names i could change using the customize.yaml so that's galready great.

The strings starting with 55 08.., 55 09.., d8 08.. are not showing up in my system....

Just noticed: i as of 15minutes ago, the control panel is not working anymore, it can't find the entitie anymore...
I did not change anytihng in the config so seems strange to me...

My bad, it changed USB-ports. Don't know how comes but first it was at hidraw3 now at hidraw2...

Also if i enable it using HA, it only arms 1 segment, not all segments...

Shamshala commented 4 years ago

OK, the friendly names i could change using the customize.yaml so that's galready great.

The strings starting with 55 08.., 55 09.., d8 08.. are not showing up in my system....

Ok, that looks like an issue which i had and therefore i had to change the method of how to get the info.

Also if i enable it using HA, it only arms 1 segment, not all segments...

Unfortunally that's a problem of the code itself or rather various possible ways of how Jablotron reports states. (i have only two systems, so i'm not able to explore other variants) And there are even other flaws like alarm states are not read correctly - "triggered" missing, the rest won't work for everybody, (probable) error codes used as a normal state as well, etc.

How many zones do you have and what is the configuration? I can partially edit my fork to what i'm using now but who knows if it'll gonna work for you or not. Or you can try to sniff the packets via Wireshark+USBPcap (for example: Windows PC, Wireshark, USB connection to your Jablotron, F-Link and you'll trigger everything you can and look through recorded communication).