Closed lupiter closed 4 years ago
I'm actually having the same issue that sometimes the python wideq lib is corrupting its own state file. Still looking for a solution though
The same here. I didn't know why it sometimes failed me and it was because of a json error in that file.
After a day running, stop working with this log:
File "example.py", line 310, in <module>
main()
File "example.py", line 306, in main
example(args.country, args.language, args.path, args.verbose, args.cmd, args.args)
File "example.py", line 219, in example
state = json.load(f)
File "/usr/lib/python3.8/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "example.py", line 310, in <module>
main()
File "example.py", line 306, in main
example(args.country, args.language, args.path, args.verbose, args.cmd, args.args)
File "example.py", line 219, in example
state = json.load(f)
File "/usr/lib/python3.8/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
(node:4541) UnhandledPromiseRejectionWarning: Error: Could not change isOn state of the AC unit!
at LgAircoController.setPowerState (/homebridge/node_modules/homebridge-lg-airco/src/lg/lg-airco-controller.ts:45:23)
(node:4541) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4541) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[7/3/2020, 9:30:42 AM] [Camera ffmpeg] Snapshot from Default Camera at 480:270
Traceback (most recent call last):
File "example.py", line 310, in <module>
main()
File "example.py", line 306, in main
example(args.country, args.language, args.path, args.verbose, args.cmd, args.args)
File "example.py", line 219, in example
state = json.load(f)
File "/usr/lib/python3.8/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Exp
Yeah the issue keeps happening to me too. I'm investigating it.
For now I have made a backup of the state file (wideq_state2.json) and when this happens I copy over the state file with the backup. cp wideq_state2.json wideq_state.json
The newest version should have fixed this (0.1.4)
I've updated to the latest (0.1.2) and I was at quite an old version (0.999). I deleted the wideq_state in the node_modules and in the homebrew dir, and re-ran example.py.
But it seems to be writing a wideq_state that isn't valid JSON. It is frequently raising an exception like the one below:
I turned on the debug mode in config, and that's showing that it is correctly reading the information sometimes. Sometimes it will fail at homebridge start. It seems like perhaps there's some concurrent access to the state file happening?
I have opened the state file to look at the JSON, and sometimes its fine and sometimes it seems to have gotten truncated.
Let me know if there's anything else I can do to help debug this for you, and thanks very much for making this module!