virtualzone/landroid-bridge

Can not start brigde - Could not parse config.json

Opened this issue · 6 comments

Hello,

since two week I'm not longer able to start the brigde on my RPI3. When I try to start the bridge the following error appiers:

~/landroid-bridge$ node dist/server.js
/home/openhabian/landroid-bridge/dist/Config.js:29
throw new Error("Could not parse config.json");
^

Error: Could not parse config.json
at Config.loadConfig (/home/openhabian/landroid-bridge/dist/Config.js:29:19)
at new Config (/home/openhabian/landroid-bridge/dist/Config.js:13:14)
at Object. (/home/openhabian/landroid-bridge/dist/Config.js:36:19)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)

The bridge worked for month without Problems and I did not any changes on my config then on my overall setup.

Thank you for your help.
Jan

Same here. Any information on this?

Could you please paste your config.json that is causing the issue? Make sure to remove your email and password before you do.

You can try and check your file with a JSON validator. I'm a huge fan of http://json.parser.online.fr/beta/

Is the config.json in the same folder where you call the script? When you enter node dist/server.js the config.json should not be in the dist/ folder, afaik.

PS: You can use backticks (`) to format code in GitHub issues. So when you do this:

>  ```yaml
>  foo: bar
>  lorem:
>    ipsum: dolor
>  ```

or this:

>  ```json
>  {
>    "foo": "bar"
>    "num": 42
>  }
>  ```

You have to remove the arrow brackets, of course.
you should get much better formatting.

Here is your config nicely formatted:

{
  "http": {
    "port": 3000
  },
  "landroid-s": {
    "enable": true,
    "email": "mail@home.de",
    "pwd": "password",
    "dev_sel": 0
  },
  "mqtt": {
    "enable": true,
    "url": "mqtt://MYUSER:MYPASSWORD@localhost",
    "topic": "landroid"
  },
  "logLevel": "info",
  "scheduler": {
    "enable": false,
    "cron": false,
    "weather": {
      "provider": "wunderground",
      "apiKey": "YOUR_API_KEY",
      "latitude": 16.4711,
      "longitude": 2.34567
    },
    "db": "./scheduler.db",
    "earliestStart": 11,
    "latestStop": 21,
    "startEarly": false,
    "offDays": 2,
    "squareMeters": 300,
    "perHour": 50,
    "mowTime": 75,
    "chargeTime": 75,
    "daysForTotalCut": 2,
    "rainDelay": 120,
    "threshold": 30
  }
}

Hello,
some days ago I was able to fix my issue by adding one more line (topic or clientID) to the config.json.

So see here my actual config:
`{
"http": {
"port": 3010
},
"landroid-s": {
"enable": true,
"email": "xxx@yxx.de",
"pwd": "xxxxxx",
"dev_sel": 0
},
"mqtt": {
"enable": true,
"url": "mosquitto://user:pw@localhost",
"topic": "landroid",
"clientId": "openhab2",
"allowSelfSigned": true
},
"logLevel": "info",
"scheduler": {
"enable": false,
"cron": false,
"weather": {
"provider": "wunderground",
"apiKey": "YOUR_API_KEY",
"latitude": 50.0982164,
"longitude": 8.221404
},
"db": "./scheduler.db",
"earliestStart": 11,
"latestStop": 21,
"startEarly": false,
"offDays": 2,
"squareMeters": 300,
"perHour": 50,
"mowTime": 75,
"chargeTime": 75,
"daysForTotalCut": 2,
"rainDelay": 120,
"threshold": 30
}

So right now I can start the bridge again, but as my mover is not online yet I could not test it finally.

Thank you.
Jan

If you were able to fix, are you using this landroid-bridge, or iobroker instead?
If you are using the bridge, you will either running into same issue than some others (bridge reports mstt error when connectiong to mower) or you might have a different Version ;-)
So would you mind dropping your landroid for testing to see, if your bridge is 100% working?

The only difference I can spot is

@@ -12,6 +12,7 @@
         "enable": true,
         "url": "mosquitto://user:pw@localhost",
         "topic": "landroid",
+        "clientId": "openhab2",
         "allowSelfSigned": true
     },
     "logLevel": "info",

I will try this - hopefully tonight - and report back here if that makes a difference (which I doubt).