doudz / homeassistant-zigate

zigate component for Home Assistant
MIT License
48 stars 15 forks source link

Install PiZigate for Hassio #47

Closed cobch closed 5 years ago

cobch commented 5 years ago

Hi Doudz, I have installed the PiZigate on Raspbian on a separate RPI and wanted to connect it to Hassio (using another RPI).

I have installed the Zigate platform in config file but Hassio return the following error Zigate platform is not set up.

Is it possible to use the PiZigate as I have done? Why Zigate platform does not load on Hassio?

Sorry about easy question but really little info with PiZigate and Hassio install.

Charles

doudz commented 5 years ago

Maybe you could try this :

If you need GPIO on Raspberry Pi 3 for your Z-Wave ZiGate :smile: module, add the following line into config.txt (you have to access that on the SD card directly. Simply plug it into your PC and edit it there. The config.txt is not accessible from your Hass.io system, you may need to open the SD card on a Windows or Linux system.):

dtoverlay=pi3-miniuart-bt

port could be something like /dev/ttyAMA0

cobch commented 5 years ago

Hi, Thanks a lot. I will give a try this week end. You mean that thanks to this command it will deactivate the bluetooth as well as configure the GPIOs according to the set up described on your tutorial? (https://zigate.fr/documentation/compatibilite-raspberry-pi-3-et-zero-w/ and https://zigate.fr/documentation/parametrer-la-pizigate/ )

Will it work afterwards by simply add this on my config.yawl:

Enable PiZiGate

zigate: gpio: true

Or should I add the port /dev/ttyAMA0 by myself on the config.yawl?

doudz commented 5 years ago

it will not desactivate bluetooth but configure bluetooth to use a soft uart, so pizigate will use hardware uart I suggest you to not specified the port

zigate:
  gpio: true

And if it doesn't work, try adding the port

zigate:
  gpio: true
  port: /dev/ttyAMA0

The GPIO configuration is automatically done by the plugin

cobch commented 5 years ago

_On my Hassio (0.92.1) I have tried to add the following command: test 1: dtoverlay=pi3-miniuart-bt test 2: enable_uart=1 dtoverlay=pi3-miniuart-bt The blue light of the Zigate is never strong, is that normal??? I get an error message in Hassio "The following components and platforms could not be set up: Zigate" IMG_6954

_As a test I have plug my SD card running raspbian with HA (I have followed the tutorials on Zigate.fr and the test shows that the Zigate is working well), the blue light is stronger after start but I get the same message error in HA.

I have no idea why in both case the Zigate component is not loaded in HA. Any ideas???

doudz commented 5 years ago

You should enable debug log in HA to see what happens

cobch commented 5 years ago

2019-05-10 14:29:51 ERROR (MainThread) [homeassistant.setup] Setup failed for zigate: Integration not found.

doudz commented 5 years ago

We don't support "Integration" it's a custom_component did you copy all the files in the custom_components folder ?

cobch commented 5 years ago

Yes. See below my folder from Hassio IMG_6955

I have done exactly what is on the github link below: https://github.com/doudz/homeassistant-zigate

Why it is coming as integration and not a component?

doudz commented 5 years ago

ok I see the problem, the folder structure should be

custom_components/
└── zigate
    ├── __init__.py
    ├── services.yaml
    ├── switch.py
    ├── sensor.py
    ├── light.py
    └── binary_sensor.py

(there's no zigate folder in your custom_components)

cobch commented 5 years ago

Ok, so bad from me... I have changed the folder and now I get the following errors:

2019-05-10 15:17:31 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for zigate which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant. 2019-05-10 15:17:35 ERROR (MainThread) [homeassistant.setup] Setup failed for introduction: Integration not found. 2019-05-10 15:18:11 ERROR (MainThread) [homeassistant.setup] Error during setup of component zigate Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 156, in _async_setup_component component.setup, hass, processed_config) # type: ignore File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/zigate/init.py", line 218, in setup import zigate ModuleNotFoundError: No module named 'zigate' 2019-05-10 15:18:33 ERROR (MainThread) [frontend.js.es5.201904240] http://hassio.local:8123/frontend_es5/chunk.1f7fc64bdbcaf1df8d01.js:2:314941 Uncaught TypeError: Cannot read property 'isOff' of undefined

cobch commented 5 years ago

Hi again. I find my problem. I had to change the config.yawl and remove the port and now my PiZigate is working (-: So happy!!! Thanks a million for all support. I will try to add my celiane dimmer and smart plug. Do you have a tutorial somewhere?

doudz commented 5 years ago

Congratulation ! :congratulations: You have to put zigate in permit join mode using the service zigate.permit_join and put the device in join mode too, typically by pushing a pairing button

pedlou commented 3 years ago

Hi, I am new working hassio and I am having same issue with pizigate interworking. I followed above procedures but in hassio I do have available the service zigate.permit_join. Can you provide some assistance? Thanks in advance

doudz commented 3 years ago

@pedlou could you explain your problem ? Eventually providing some log

pedlou commented 3 years ago

Hi @doudz, thanks for your reply. Just for additional info, I did the home assistant manual installation procedure using docker. When trying to "To pair a new device, go in developer/services and call the 'zigate.permit_join' service" I do not have it available in the developer/services. It should be listed like other services right? I was doing some troubleshooting and after reboot I see in Configuration/Logs the following:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/core.py", line 29, in post
    errors = await async_check_ha_config_file(request.app["hass"])
  File "/usr/src/homeassistant/homeassistant/config.py", line 857, in async_check_ha_config_file
    res = await check_config.async_check_ha_config_file(hass)
  File "/usr/src/homeassistant/homeassistant/helpers/check_config.py", line 115, in async_check_ha_config_file
    integration = await async_get_integration_with_requirements(hass, domain)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 48, in async_get_integration_with_requirements
    integration = await async_get_integration(hass, domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 444, in async_get_integration
    integration = Integration.resolve_legacy(hass, domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 234, in resolve_legacy
    comp = _load_file(hass, domain, _lookup_path(hass))
  File "/usr/src/homeassistant/homeassistant/loader.py", line 504, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 779, in exec_module
  File "<frozen importlib._bootstrap_external>", line 916, in get_code
  File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/zigate/__init__.py", line 6

Thanks again

doudz commented 3 years ago

Looks like something is missing, did you copy all the content of the zigate folder ? (including manifest.json) I recommend you to use HACS https://hacs.xyz/

pedlou commented 3 years ago

Hi, I just installed HACS. It seems there is some issue here also :( I get following error once I reach step "configuration options": 2020-08-14 18:01:44 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/hacs/operational/relaod.py", line 10, in async_reload_entry await async_setup_entry(hass, config_entry) File "/config/custom_components/hacs/operational/setup.py", line 61, in async_setup_entry return await async_startup_wrapper_for_config_entry() File "/config/custom_components/hacs/operational/setup.py", line 86, in async_startup_wrapper_for_config_entry startup_result = await async_hacs_startup() File "/config/custom_components/hacs/operational/setup.py", line 188, in async_hacs_startup await async_setup_frontend() File "/config/custom_components/hacs/operational/setup_actions/frontend.py", line 36, in async_setup_frontend hacs.hass.components.frontend.async_register_built_in_panel( File "/usr/src/homeassistant/homeassistant/components/frontend/init.py", line 204, in async_register_built_in_panel raise ValueError(f"Overwriting panel {panel.frontend_url_path}") ValueError: Overwriting panel hacs

pedlou commented 3 years ago

Hi doudz, I managed to use hacs for zigate installation. Now I see the 'zigate.permit_join' service option. Will try later if I can integrate my sensors. Thanks

pedlou commented 3 years ago

Hi, I was trying to integrate Xiaomi Motion Sensor without success. During integration I get the following error: "2020-08-14 23:59:41 DEBUG (Thread-65) [zigate] Auto saving /config/zigate.json 2020-08-14 23:59:41 DEBUG (Thread-65) [zigate] Saving persistent file 2020-08-14 23:59:41 DEBUG (Thread-65) [zigate] Acquire Lock to save persistent file 2020-08-14 23:59:41 DEBUG (Thread-65) [zigate] Release Lock of persistent file 2020-08-14 23:59:41 DEBUG (Thread-65) [zigate] REQUEST : 0x0010 2020-08-14 23:59:41 DEBUG (Thread-65) [zigate] Msg to send b'0010000010' 2020-08-14 23:59:41 DEBUG (Thread-65) [zigate] Encoded Msg to send b'01021010021002101003' 2020-08-14 23:59:41 DEBUG (Thread-65) [zigate] Waiting for status message for command 0x0010 2020-08-14 23:59:46 WARNING (Thread-65) [zigate] No response after command 0x0010 (240) 2020-08-14 23:59:47 DEBUG (MainThread) [zigate] REQUEST : 0x0010 2020-08-14 23:59:47 DEBUG (MainThread) [zigate] Msg to send b'0010000010' 2020-08-14 23:59:47 DEBUG (MainThread) [zigate] Encoded Msg to send b'01021010021002101003' 2020-08-14 23:59:47 DEBUG (MainThread) [zigate] Waiting for status message for command 0x0010 2020-08-14 23:59:47 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x02\x10\x02\x10\x02\x15\x95\x02\x10\x02\x10\x02\x10\x10\x02\x10\x03\x01\x80\x10\x02\x10\x02\x15\x8f\x02\x10\x02\x13\x02\x13\x1a\x02\x10\x03' 2020-08-14 23:59:47 ERROR (ZiGate-Listen) [zigate] Malformed packet received, ignore it 2020-08-14 23:59:47 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED 2020-08-14 23:59:47 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8010: b'0003031a' 2020-08-14 23:59:47 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8010 - Version list : major:3, installer:31a, lqi:0, version:3.1a 2020-08-14 23:59:47 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED 2020-08-14 23:59:52 WARNING (MainThread) [zigate] No response after command 0x0010 (241) 2020-08-14 23:59:52 WARNING (MainThread) [zigate] Failed to retrieve zigate firmware version 2020-08-15 00:00:00 DEBUG (SyncWorker_2) [zigate] REQUEST : 0x0015 2020-08-15 00:00:00 DEBUG (SyncWorker_2) [zigate] Msg to send b'0015000015' 2020-08-15 00:00:00 DEBUG (SyncWorker_2) [zigate] Encoded Msg to send b'01021015021002101503' 2020-08-15 00:00:00 DEBUG (SyncWorker_2) [zigate] Waiting for status message for command 0x0015 2020-08-15 00:00:00 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x02\x10\x02\x10\x02\x15\x90\x02 `r \x1a\xe0' 2020-08-15 00:00:05 WARNING (SyncWorker_2) [zigate] No response after command 0x0015 (242) ... 2020-08-15 00:19:47 DEBUG (MainThread) [zigate] REQUEST : 0x0010 2020-08-15 00:19:47 DEBUG (MainThread) [zigate] Msg to send b'0010000010' 2020-08-15 00:19:47 DEBUG (MainThread) [zigate] Encoded Msg to send b'01021010021002101003' 2020-08-15 00:19:47 DEBUG (MainThread) [zigate] Waiting for status message for command 0x0010 2020-08-15 00:19:47 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x02\x10\x02\x10\x02\x15\x95\x02\x10\x02\x10\x02\x10\x10\x02\x10\x03\x01\x80\x10\x02\x10\x02\x15\x8f\x02\x10\x02\x13\x02\x13\x1a\x02\x10\x03' 2020-08-15 00:19:47 ERROR (ZiGate-Listen) [zigate] Malformed packet received, ignore it 2020-08-15 00:19:47 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED 2020-08-15 00:19:47 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8010: b'0003031a' 2020-08-15 00:19:47 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8010 - Version list : major:3, installer:31a, lqi:0, version:3.1a 2020-08-15 00:19:47 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED 2020-08-15 00:19:52 WARNING (MainThread) [zigate] No response after command 0x0010 (257) 2020-08-15 00:19:52 WARNING (MainThread) [zigate] Failed to retrieve zigate firmware version "

Not sure how to analyze this... Also I get the following errors in LOG: "2020-08-15 12:48:17 ERROR (SyncWorker_20) [homeassistant] Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/zigate/init.py", line 396, in start_zigate if version < '3.1a': TypeError: '<' not supported between instances of 'NoneType' and 'str'"

Any clue on this? Thanks

doudz commented 3 years ago

Probably the port isn't the right one

doudz commented 3 years ago

Or something is missing in your Rpi config

pedlou commented 3 years ago

Hi, if I reboot the Pi and perform the zigate test procedure things seem to be OK. "pi@raspberrypi:~/PiZiGate-tools/test $ sudo ./PiZiGate_test /dev/ttyAMA0 RPI Model searching ... Warning !!! you must modify /boot/config.txt Verifying /boot/cmdline.txt ...