Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token ] in JSON at position 13 #126

Open
2 of 3 tasks
bjoernmayer opened this issue Aug 11, 2021 · 3 comments
Open
2 of 3 tasks

SyntaxError: Unexpected token ] in JSON at position 13 #126

bjoernmayer opened this issue Aug 11, 2021 · 3 comments
Labels
bug A CONFIRMED bug in the plugin code

Comments

@bjoernmayer
Copy link

bjoernmayer commented Aug 11, 2021

Confirm you have checked the WIKI for troubleshooting first
_Fill out and check ([x]) the boxes which apply.

  • Homebridge version: 1.3.4
  • Plugin version: v2021.32.1
  • OS, including release name/version: Alpine Linux (3.12.7)
  • Homebridge-Onkyo installed via OS/distribution mechanisms
  • You installed using homebridge-config-ui-x
  • You enabled homebridge debug output

Describe the bug
Full Error Message:

SyntaxError: Unexpected token ] in JSON at position 13
    at JSON.parse (<anonymous>)
    at OnkyoAccessory.createRxInput (/homebridge/node_modules/homebridge-onkyo/index.js:218:19)
    at OnkyoAccessory.setUp (/homebridge/node_modules/homebridge-onkyo/index.js:149:8)
    at new OnkyoAccessory (/homebridge/node_modules/homebridge-onkyo/index.js:145:8)
    at /homebridge/node_modules/homebridge-onkyo/index.js:37:22
    at Array.forEach (<anonymous>)
    at OnkyoPlatform.createAccessories (/homebridge/node_modules/homebridge-onkyo/index.js:30:13)
    at new OnkyoPlatform (/homebridge/node_modules/homebridge-onkyo/index.js:23:8)
    at /usr/local/lib/node_modules/homebridge/src/server.ts:440:40
    at Array.forEach (<anonymous>)
    at Server.loadPlatforms (/usr/local/lib/node_modules/homebridge/src/server.ts:372:27)
    at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:159:29)

To Reproduce
Information on your Onkyo receiver:

  1. HT-R990

Information on your configuration:
Using homebridge-config-ui-x this is the resulting config:

{
    "receivers": [
        {
            "name": "AV Receiver",
            "model": "HT-R990",
            "ip_address": "192.168.178.36",
            "filter_inputs": true,
            "max_volume": 30,
            "volume_type": "none",
            "zone": "main"
        }
    ],
    "platform": "Onkyo"
}

Information from the log:
A few log lines:

[8/11/2021, 2:34:48 PM] [Onkyo] Initializing Onkyo platform...
[8/11/2021, 2:34:48 PM] [Onkyo] **************************************************************
[8/11/2021, 2:34:48 PM] [Onkyo]   homebridge-onkyo version 2021.32.1
[8/11/2021, 2:34:48 PM] [Onkyo]   GitHub: https://github.com/ToddGreenfield/homebridge-onkyo 
[8/11/2021, 2:34:48 PM] [Onkyo] **************************************************************
[8/11/2021, 2:34:48 PM] [Onkyo] start success...
[8/11/2021, 2:34:48 PM] SyntaxError: Unexpected token ] in JSON at position 13
    at JSON.parse (<anonymous>)
    at OnkyoAccessory.createRxInput (/homebridge/node_modules/homebridge-onkyo/index.js:218:19)
    at OnkyoAccessory.setUp (/homebridge/node_modules/homebridge-onkyo/index.js:149:8)
    at new OnkyoAccessory (/homebridge/node_modules/homebridge-onkyo/index.js:145:8)
    at /homebridge/node_modules/homebridge-onkyo/index.js:37:22
    at Array.forEach (<anonymous>)
    at OnkyoPlatform.createAccessories (/homebridge/node_modules/homebridge-onkyo/index.js:30:13)
    at new OnkyoPlatform (/homebridge/node_modules/homebridge-onkyo/index.js:23:8)
    at /usr/local/lib/node_modules/homebridge/src/server.ts:440:40
    at Array.forEach (<anonymous>)
    at Server.loadPlatforms (/usr/local/lib/node_modules/homebridge/src/server.ts:372:27)
    at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:159:29)
[8/11/2021, 2:34:48 PM] Got SIGTERM, shutting down Homebridge...
[8/11/2021, 2:35:43 PM] [Onkyo] Initializing Onkyo platform...
[8/11/2021, 2:35:43 PM] [Onkyo] Creating 1 receivers...
[8/11/2021, 2:35:43 PM] [Onkyo] Creating new connection for ip 192.168.178.36
[8/11/2021, 2:35:43 PM] [Onkyo] **************************************************************
[8/11/2021, 2:35:43 PM] [Onkyo]   homebridge-onkyo version 2021.32.1
[8/11/2021, 2:35:43 PM] [Onkyo]   GitHub: https://github.com/ToddGreenfield/homebridge-onkyo 
[8/11/2021, 2:35:43 PM] [Onkyo] **************************************************************
[8/11/2021, 2:35:43 PM] [Onkyo] start success...
[8/11/2021, 2:35:43 PM] [Onkyo] Debug mode enabled
[8/11/2021, 2:35:43 PM] [Onkyo] name AV Receiver
[8/11/2021, 2:35:43 PM] [Onkyo] IP 192.168.178.36
[8/11/2021, 2:35:43 PM] [Onkyo] Model HT-R990
[8/11/2021, 2:35:43 PM] [Onkyo] Zone main
[8/11/2021, 2:35:43 PM] [Onkyo] volume_type: none
[8/11/2021, 2:35:43 PM] [Onkyo] filter_inputs: true
[8/11/2021, 2:35:43 PM] [Onkyo] poll_status_interval: 0
[8/11/2021, 2:35:43 PM] [Onkyo] defaultInput: undefined
[8/11/2021, 2:35:43 PM] [Onkyo] defaultVolume: undefined
[8/11/2021, 2:35:43 PM] [Onkyo] maxVolume: 30
[8/11/2021, 2:35:43 PM] [Onkyo] mapVolume100: true
[8/11/2021, 2:35:43 PM] [Onkyo] avrSerial: 192.168.178.36
[8/11/2021, 2:35:43 PM] SyntaxError: Unexpected token ] in JSON at position 13
    at JSON.parse (<anonymous>)
    at OnkyoAccessory.createRxInput (/homebridge/node_modules/homebridge-onkyo/index.js:218:19)
    at OnkyoAccessory.setUp (/homebridge/node_modules/homebridge-onkyo/index.js:149:8)
    at new OnkyoAccessory (/homebridge/node_modules/homebridge-onkyo/index.js:145:8)
    at /homebridge/node_modules/homebridge-onkyo/index.js:37:22
    at Array.forEach (<anonymous>)
    at OnkyoPlatform.createAccessories (/homebridge/node_modules/homebridge-onkyo/index.js:30:13)
    at new OnkyoPlatform (/homebridge/node_modules/homebridge-onkyo/index.js:23:8)
    at /usr/local/lib/node_modules/homebridge/src/server.ts:440:40
    at Array.forEach (<anonymous>)
    at Server.loadPlatforms (/usr/local/lib/node_modules/homebridge/src/server.ts:372:27)
    at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:159:29)
[8/11/2021, 2:35:43 PM] [Onkyo] eventDebug: INFO (connected) Connected to 192.168.178.36:60128 (model: HT-R990)
[8/11/2021, 2:35:43 PM] [Onkyo] eventConnect: 192.168.178.36
[8/11/2021, 2:35:43 PM] Got SIGTERM, shutting down Homebridge...

Expected behavior
Plugin shouldn't crash Homebridge

@bjoernmayer bjoernmayer added the bug A CONFIRMED bug in the plugin code label Aug 11, 2021
@bjoernmayer
Copy link
Author

I did some experiments (also tried out different plugins) and now it works. Might be caused by the model not being present in the eiscp-commands.json.
My config:

{
    "receivers": [
        {
            "name": "Onkyo",
            "model": "TX-NR609",
            "ip_address": "192.168.178.36",
            "inputs": [
                {
                    "input_name": "game",
                    "display_name": "Xbox"
                }
            ],
            "filter_inputs": true,
            "max_volume": 30,
            "volume_type": "none",
            "zone": "main"
        }
    ],
    "platform": "Onkyo"
}

@gymrat801
Copy link

I can confirm that when your listed model is not in the eiscp-commands.json, this is the error you get. It might be helpful for a lot of people to do a check up front to see if your listed model is in the list and if it is not, halt with an error or default to TX-NR609 with a warning in the log.

@GarthDB
Copy link

GarthDB commented Oct 27, 2022

I saw the same issue with TX-NR6100 so I just changed the config to TX-NR616 which is the closest in the eiscp-commands.json list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A CONFIRMED bug in the plugin code
Projects
None yet
Development

No branches or pull requests

3 participants