icanos / hassio-plejd

Hass.io add-on for Plejd home automation devices
Apache License 2.0
126 stars 36 forks source link

parse error: Expected string key before ':' at line 1, column 4 #17

Closed spripe closed 4 years ago

spripe commented 4 years ago

I've just now tried this addon, prior I used ha-plejd component from klali which worked just fine. So now to the problem / questions I've got.

The hassio log says:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 00-banner.sh: executing...


Hass.io Add-on: Plejd Adds support for the Swedish home automation devices from Plejd.

Add-on version: 0.1.0 You are running the latest version of this add-on. parse error: Expected string key before ':' at line 1, column 4 [09:09:59] ERROR: Unknown HTTP error occured System: (amd64 / qemux86-64) Home Assistant version: 0.103.3 Supervisor version: 193

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [09:09:59] INFO: Starting the Plejd service... [09:09:59] INFO: Verified permissions on startup script [09:09:59] INFO: Executing startup script [09:10:00] INFO: Wrote plejd.json [09:10:00] INFO: Running add-on noble warning: adapter does not support Bluetooth Low Energy (BLE, Bluetooth Smart). Try to run with environment variable: [sudo] NOBLE_HCI_DEVICE_ID=x node ... plejd-mqtt: connected to mqtt. discovered light: Hall with Plejd ID 19. discovered light: Spotligt tak with Plejd ID 18. discovered light: Taklampa Soffa with Plejd ID 11.

1) what does this error mean and how do I solve it? parse error: Expected string key before ':' at line 1, column 4 [09:09:59] ERROR: Unknown HTTP error occured

2) I got a message that my Bluetooth LOW Energy adapter is not supported "noble warning: adapter does not support Bluetooth Low Energy (BLE, Bluetooth Smart). Try to run with environment variable: [sudo] NOBLE_HCI_DEVICE_ID=x node ..." Even though it works just fine with the ha-plejd component, any idea?

axlthorell commented 4 years ago

Could you try updating to the 0.1.1 version? I think you can ignore the HTTP-error, it seems everyone has that. What hardware are you using? RPi 4?

spripe commented 4 years ago

How do I update to the 0.1.1 Version? Do I need to do a manually git clone with some tag for that?

When I install via HassIO store I got 0.1.0. Then I've just tried manually git clone the dev branch, but the problem persists in the logs.


Hass.io Add-on: Plejd Adds support for the Swedish home automation devices from Plejd.

Add-on version: 0.1.0 You are running the latest version of this add-on. parse error: Expected string key before ':' at line 1, column 4 [10:34:53] ERROR: Unknown HTTP error occured System: (amd64 / qemux86-64) Home Assistant version: 0.103.3 Supervisor version: 193

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [10:34:54] INFO: Starting the Plejd service... [10:34:54] INFO: Verified permissions on startup script [10:34:54] INFO: Executing startup script [10:34:54] INFO: Wrote plejd.json [10:34:54] INFO: Running add-on noble warning: adapter does not support Bluetooth Low Energy (BLE, Bluetooth Smart). Try to run with environment variable: [sudo] NOBLE_HCI_DEVICE_ID=x node ... plejd-mqtt: connected to mqtt. discovered light: Hall with Plejd ID 19. discovered light: Spotligt tak with Plejd ID 18. discovered light: Taklampa Soffa with Plejd ID 11.

spripe commented 4 years ago

The hardware is an ordinary laptop with Bluetooth LE adapter

axlthorell commented 4 years ago

If you go to the add-on store in the Hass.io menu and click the refresh button in the upper right corner the update should be visible in the plejd add-on.

icanos commented 4 years ago

We're using different BLE libraries, so I'm guessing your device id isn't recognized by noble. Could you give me your VID/PID and I'll add that to the list of recognizable devices.

icanos commented 4 years ago

And, can you check if your laptop has a builtin bluetooth adapter as well? In that case, you might need to specify the NOBLE_HCI_DEVICE_ID environment variable to point to the correct BL adapter.

spripe commented 4 years ago

Bus 001 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) idVendor 0x0a12 Cambridge Silicon Radio, Ltd idProduct 0x0001 Bluetooth Dongle (HCI mode)

The laptop have builtin bluetooth adapter, but no Bluetooth LE. That's why I bouht this USB Bluetooth LE dongle and tried with ha-plejd component from klali - which worked. For that to work - I didn't need to set the NOBLE_HCI_DEVICE_ID variable.

Should we try first to specify above VID/PID as recognized?

I've also clicked the refresh button in the upper corner bild

But it still show version 0.1.0 bild

icanos commented 4 years ago

The noble library doesn't work the same way as bluepy which requires you to specify which device to use, default is that the one listed first is that, that is used. If that device doesn't support LE we're out of luck. That's where the NOBLE_HCI_DEVICE_ID comes into play, you need to specify which Bluetooth adapter to use.

Use hcitool (if on Linux) and list your Bluetooth devices, note if your USB device is hci0 or 1. Set the NOBLE_HCI_DEVICE_ID to 0 or 1 depending on which hci interface it is assigned. Please try again after that :-)

spripe commented 4 years ago

Will test that as soon I'm back from holiday. Do you have any syntax example to set NOBLE_HCI_DEVICE_ID to 1?

icanos commented 4 years ago

You can try using export NOBLE_HCI_DEVICE_ID=1 :)

spripe commented 4 years ago

root@ubuntu:~# hcitool dev Devices: hci1 CC:AF:78:F0:8A:8B < Vendor: Hon Hai Precision Ind. Co.,Ltd. hci0 00:1A:7D:DA:71:04 < Vendor: cyber-blue(HK)Ltd

Even with NOBLE_HCI_DEVICE_ID set; root@ubuntu:~# export NOBLE_HCI_DEVICE_ID=1 root@ubuntu:~# echo $NOBLE_HCI_DEVICE_ID 1

lsbusb output shows;

Bus 001 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 224 Wireless bDeviceSubClass 1 Radio Frequency bDeviceProtocol 1 Bluetooth bMaxPacketSize0 64 idVendor 0x0a12 Cambridge Silicon Radio, Ltd idProduct 0x0001 Bluetooth Dongle (HCI mode) bcdDevice 88.91 iManufacturer 0 iProduct 2 CSR8510 A10 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 177 bNumInterfaces 2 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xe0 Self Powered Remote Wakeup MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 1 Bluetooth iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0010 1x 16 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 1 Bluetooth iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0000 1x 0 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0000 1x 0 bytes bInterval 1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 1 bNumEndpoints 2 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 1 Bluetooth iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0009 1x 9 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0009 1x 9 bytes bInterval 1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 2 bNumEndpoints 2 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 1 Bluetooth iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0011 1x 17 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0011 1x 17 bytes bInterval 1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 3 bNumEndpoints 2 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 1 Bluetooth iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0019 1x 25 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0019 1x 25 bytes bInterval 1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 4 bNumEndpoints 2 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 1 Bluetooth iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0021 1x 33 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0021 1x 33 bytes bInterval 1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 5 bNumEndpoints 2 bInterfaceClass 224 Wireless bInterfaceSubClass 1 Radio Frequency bInterfaceProtocol 1 Bluetooth iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0031 1x 49 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 1 Transfer Type Isochronous Synch Type None Usage Type Data wMaxPacketSize 0x0031 1x 49 bytes bInterval 1 Device Status: 0x0001 Self Powered

After setting above variable, I've also tried push rebuild and restart. I've alsor tried with/without protection mode off, just in case

I got the same problem


Hass.io Add-on: Plejd Adds support for the Swedish home automation devices from Plejd.

Add-on version: 0.2.0 You are running the latest version of this add-on. parse error: Expected string key before ':' at line 1, column 4 <<<<<< Question 1 [11:28:10] ERROR: Unknown HTTP error occured <<<<<< Question 2 System: (amd64 / qemux86-64) Home Assistant version: 0.103.5 Supervisor version: 193

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [11:28:10] INFO: Starting the Plejd service... [11:28:10] INFO: Verified permissions on startup script [11:28:10] INFO: Executing startup script [11:28:10] INFO: Wrote plejd.json [11:28:10] INFO: Running add-on starting Plejd add-on v. 0.2.0 plejd-api: got session token response plejd-api: got sites response noble warning: adapter does not support Bluetooth Low Energy (BLE, Bluetooth Smart). Try to run with environment variable: [sudo] NOBLE_HCI_DEVICE_ID=x node ... plejd-mqtt: connected to mqtt.

1) What does "parse error: Expected string key before ':' at line 1, column 4" mean? 2) What does "ERROR: Unknown HTTP error occured" mean?

spripe commented 4 years ago

Github editor changed the font-size, Think its easier to read if you just copy above text to notepad :)

spripe commented 4 years ago

Did you made the change to approve this vendor or wasn't it necessary? idVendor 0x0a12 Cambridge Silicon Radio, Ltd idProduct 0x0001 Bluetooth Dongle (HCI mode)

spripe commented 4 years ago

Adapter specific known issues

Some BLE adapters cannot connect to a peripheral while they are scanning (examples below). You will get the following messages when trying to connect : Sena UD-100 (Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)) : Error: Command disallowed Intel Dual Band Wireless-AC 7260 (Intel Corporation Wireless 7260 (rev 73)) : Error: Connection Rejected due to Limited Resources (0xd) You need to stop scanning before trying to connect in order to solve this issue. https://github.com/noble/noble

spripe commented 4 years ago

I forgot to mention that i've also tried export NOBLE_HCI_DEVICE_ID=0 which seems to be the right adapter Without success

spripe commented 4 years ago

just bought a raspberry pi 4 to test this addon.

Have tried installation both manual (local addon) and via hassio. In both cases i get below error in my hassio log

20-01-14 09:19:07 INFO (MainThread) [hassio.store.git] Update add-on https://github.com/icanos/hassio-plejd.git repository 20-01-14 09:19:09 INFO (MainThread) [hassio.store] Load add-ons from store: 64 all - 1 new - 0 remove 20-01-14 09:19:17 INFO (MainThread) [hassio.addons] Create Home Assistant add-on data folder /data/addons/data/local_plejd 20-01-14 09:19:17 INFO (SyncWorker_8) [hassio.docker.addon] Start build local/armv7-addon-plejd:0.2.2 20-01-14 09:19:23 ERROR (SyncWorker_8) [hassio.docker.addon] Can't build local/armv7-addon-plejd:0.2.2: The command '/bin/bash -o pipefail -c apk add --no-cache --virtual .build-dependencies g++=8.3.0-r0 gcc=8.3.0-r0 libc-dev=0.7.1-r0 linux-headers=4.19.36-r0 make=4.2.1-r2 python=2.7.16-r1 bluez=5.50-r3 eudev-dev=3.2.8-r0 && apk add --no-cache git nodejs=10.16.3-r0 npm=10.16.3-r0 && npm config set unsafe-perm true' returned a non-zero code: 2

which resulting in that the installation exits.

Any clue?

spripe commented 4 years ago

The Raspberry pi 4 image I used is: Raspberry Pi 4 Model B 32bit (recommended) https://github.com/home-assistant/hassos/releases/download/3.8/hassos_rpi4-3.8.img.gz

spripe commented 4 years ago

I understand if your time is limited to work with this project

But do you have any idea whats the problem is in this case or my other "newely created" case(https://github.com/icanos/hassio-plejd/issues/32) with rpi4, feel free to update.

Otherwise I have to look for something else.

icanos commented 4 years ago

Look at my comment in that thread :) please try the new version

spripe commented 4 years ago

:) Works, I think.

Is this a good sign?

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [17:59:57] INFO: Starting the Plejd service... [17:59:57] INFO: Verified permissions on startup script [17:59:57] INFO: Executing startup script [17:59:58] INFO: Wrote plejd.json [17:59:58] INFO: Running add-on starting Plejd add-on v. 0.2.3 plejd-api: login() logging into Hemma plejd-api: got session token response plejd-api: getCryptoKey() plejd-api: got sites response wireEvents() onInterfaceStateChanged(poweredOn) scan() plejd-mqtt: connected to mqtt. discovered light: Taklampa Hall with Plejd ID 19. discovered light: Spotligt tak with Plejd ID 18. discovered light: Taklampa Soffa with Plejd ID 11. discovered light: Vardagsrum Matsal with Plejd ID 20. scan completed, found 5 device(s). onDeviceScanComplete() trying to connect to the mesh network. connecting to e54a5b66fa80 with addr e5:4a:5b:66:fa:80 and rssi -33 onDeviceConnected() authenticate() startPing() plejd: connected via bluetooth.

icanos commented 4 years ago

I would say a very good sign :)

spripe commented 4 years ago

Perfect, I Think we can close this and the other issue I've created. When I will work further with this setup on my rpi4

icanos commented 4 years ago

The first BLE device is not supported by Noble (the BLE library used by this addon), please make a request in the noble repository for a fix if needed. Using RPi 4, the bug is fixed in 0.2.3.

Good luck :-)