Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

Can't use the device list #4

Closed
martin67 opened this issue Nov 24, 2017 · 3 comments
Closed

Can't use the device list #4

martin67 opened this issue Nov 24, 2017 · 3 comments

Comments

@martin67
Copy link

I get an error when I try to include a list of devices:

martin@mahler:~$ xiaomi2mqtt -d /etc/xiaomi2mqtt.conf`
2017-11-24 10:46:16.793 <info>  xiaomi2mqtt 1.0.0 starting
2017-11-24 10:46:16.850 <info>  Loading devices from: /etc/xiaomi2mqtt.conf
/etc/xiaomi2mqtt.conf:2
  "device_id": "Nice name",
             ^

SyntaxError: Unexpected token :
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:599:28)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at fs.access (/usr/local/lib/node_modules/xiaomi2mqtt/src/bridge.js:21:19)
martin@mahler:~$

The file looks like this:

{
  "device_id": "Nice name",
  "158d00016c8dfb": "Sovrum",
  "158d0001b8f5ed": "Ivars rum",
  "158d0001ddae03": "Märtas rum",
  "158d00019cb8ff": "Nils rum",
  "158d0001c03460": "Källartrapp",
  "158d00018b39c4": "TV"
}

Everything else works fine (when I don't include the file)

@soundman666
Copy link

soundman666 commented Nov 29, 2017

You need to rename file xiaomi2mqtt.conf to xiaomi2mqtt.json

svrooij pushed a commit that referenced this issue Dec 22, 2017
This fix #4 no more crash when loading incorrect device list.
@ghasemikasra39
Copy link

Would it be alright if you explain the xiaomi2mqtt.json file?
The question is asked here:
https://stackoverflow.com/questions/52269938/how-is-xiaomi2mqtt-connected-to-aquara-hardware-device

@svrooij
Copy link
Owner

svrooij commented Sep 12, 2018

This question is pretty unrelated to this issue. Please check out the wiki

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants