normen / homebridge-landroid

Homebridge plugin to control Worx Landroid robo mowers through the Worx Cloud
24 stars 8 forks source link

SyntaxError: Unexpected end of JSON input #58

Closed my-axel closed 1 year ago

my-axel commented 1 year ago

Since a few days, I've been getting the following error message.

[7/1/2023, 2:20:17 PM] [homebridge-landroid] Restarting Process...
[7/1/2023, 2:20:18 PM] [homebridge-landroid] Launched child bridge with PID 59931
[7/1/2023, 2:20:19 PM] Registering platform 'homebridge-landroid.Landroid'
[7/1/2023, 2:20:19 PM] [homebridge-landroid] Loaded homebridge-landroid v0.11.9 child bridge successfully
[7/1/2023, 2:20:19 PM] [homebridge-landroid] DidFinishLaunching
[7/1/2023, 2:20:19 PM] Homebridge v1.6.1 (HAP v0.11.1) (homebridge-landroid) is running on port 55755.

/usr/lib/node_modules/homebridge-landroid/CloudAdapter.js:16
    this.objects = JSON.parse(fs.readFileSync(this.object_file, "utf8"));
                        ^
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Worx.Adapter.loadLandroidObjectData (/usr/lib/node_modules/homebridge-landroid/CloudAdapter.js:16:25)
    at HomebridgeAPI.<anonymous> (/usr/lib/node_modules/homebridge-landroid/index.js:47:47)
    at HomebridgeAPI.emit (node:events:513:28)
    at HomebridgeAPI.signalFinished (/usr/lib/node_modules/homebridge/src/api.ts:275:10)
    at ChildBridgeFork.startBridge (/usr/lib/node_modules/homebridge/src/childBridgeFork.ts:189:14)
[7/1/2023, 2:20:19 PM] [homebridge-landroid] Child bridge process ended
[7/1/2023, 2:20:19 PM] [homebridge-landroid] Process Ended. Code: 1, Signal: null

The plugin continuously restarts. It doesn't matter if it is in a child bridge or not. In a child bridge, my whole Homebridge doesn't restart. I've double checked the configuration. I even deleted the configuration, restarted Homebridge and put everything in again. Here's my configuration with user and pwd removed:

        {
            "email": "emailaddress",
            "pwd": "password",
            "cloud": "worx",
            "rainsensor": true,
            "homesensor": true,
            "partymode": true,
            "reload": false,
            "mowdata": true,
            "platform": "Landroid",
            "_bridge": {
                "username": "ipv6address",
                "port": 52824
            }
        },

I did not actively change anything. I've just installed 0.11.8 a few days and 0.11.9 a few hours ago. I'm completely blank at the moment as to what I could try next...

normen commented 1 year ago

Looks like for some reason the status file wasn't written completely. Delete the files in the plugin-persist/homebridge-landroid folder inside of your homebridge folder.

my-axel commented 1 year ago

Thank you very much, normen. That solved the problem. If others have the same problem: I've deactivated the plugin in homebridge and delete four json files in /var/lib/homebridge/plugin-persist/homebridge-landroid (the path can differ for you). Afterwards just activate the plugin again.