Cant reach MSR after mowing my Pi
-
I decided to move my MSR pi to a permanent place and after that i cant connect to it. I can se in the logs that it has connection with hubitat ..
I says
2021-04-22T20:11:54.649Z Controller:ERR SystemController#reactor_system disk usage not available: Error: Cannot find module 'diskusage-ngWhat has happened? I did a hard remove by powercable....
/MattiasFull log
2021-04-22T20:10:56.493Z Controller:NOTICE Controller HubitatController#hubitat is now online.
2021-04-22T20:10:56.497Z app:NOTICE Starting Reaction Engine...
2021-04-22T20:10:56.498Z Engine:INFO Reaction Engine starting
2021-04-22T20:10:56.499Z Engine:INFO Checking rule sets...
2021-04-22T20:10:56.514Z Engine:INFO Checking rules...
2021-04-22T20:10:56.559Z default:ERR [IndividualFileStrategy#/home/pi/reactor/storage] failed to read cs-rule-knbyvokt in /home/pi/reactor/storage/states/cs-rule-knbyvokt.json: SyntaxError: Unexpected end of JSON input
Trapped unhandled Promise rejection SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IndividualFileStrategy.getDataObject (/home/pi/reactor/server/lib/IndividualFileStrategy.js:126:38)
at Container.getDataObject (/home/pi/reactor/server/lib/Container.js:91:53)
at Rule.getRuleStates (/home/pi/reactor/server/lib/Rule.js:601:98)
at Rule.getConditionState (/home/pi/reactor/server/lib/Rule.js:626:46)
at new Rule (/home/pi/reactor/server/lib/Rule.js:491:47)
at Function.getInstance (/home/pi/reactor/server/lib/Rule.js:500:36)
at /home/pi/reactor/server/lib/Engine.js:584:50
at Array.forEach (<anonymous>)
at Engine.checkData (/home/pi/reactor/server/lib/Engine.js:582:36)
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IndividualFileStrategy.getDataObject (/home/pi/reactor/server/lib/IndividualFileStrategy.js:126:38)
at Container.getDataObject (/home/pi/reactor/server/lib/Container.js:91:53)
at Rule.getRuleStates (/home/pi/reactor/server/lib/Rule.js:601:98)
at Rule.getConditionState (/home/pi/reactor/server/lib/Rule.js:626:46)
at new Rule (/home/pi/reactor/server/lib/Rule.js:491:47)
at Function.getInstance (/home/pi/reactor/server/lib/Rule.js:500:36)
at /home/pi/reactor/server/lib/Engine.js:584:50
at Array.forEach (<anonymous>)
at Engine.checkData (/home/pi/reactor/server/lib/Engine.js:582:36)
Promise {
<rejected> SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IndividualFileStrategy.getDataObject (/home/pi/reactor/server/lib/IndividualFileStrategy.js:126:38)
at Container.getDataObject (/home/pi/reactor/server/lib/Container.js:91:53)
at Rule.getRuleStates (/home/pi/reactor/server/lib/Rule.js:601:98)
at Rule.getConditionState (/home/pi/reactor/server/lib/Rule.js:626:46)
at new Rule (/home/pi/reactor/server/lib/Rule.js:491:47)
at Function.getInstance (/home/pi/reactor/server/lib/Rule.js:500:36)
at /home/pi/reactor/server/lib/Engine.js:584:50
at Array.forEach (<anonymous>)
at Engine.checkData (/home/pi/reactor/server/lib/Engine.js:582:36)
}
Trace
at process.<anonymous> (/home/pi/reactor/app.js:197:151)
at process.emit (events.js:315:20)
at process.EventEmitter.emit (domain.js:467:12)
at processPromiseRejections (internal/process/promises.js:245:33)
at processTicksAndRejections (internal/process/task_queues.js:94:32)
2021-04-22T20:10:56.599Z Controller:WARN HubitatController#hubitat 'Allow control of HSM' appears to be disabled in your Maker API configuration
2021-04-22T20:10:56.604Z Controller:NOTICE HubitatController#hubitat current mode is Kv\u00e4ll (131)
2021-04-22T20:11:54.649Z Controller:ERR SystemController#reactor_system disk usage not available: Error: Cannot find module 'diskusage-ng'
Require stack:- /home/pi/reactor/server/lib/SystemController.js
2021-04-22T20:12:16.879Z Controller:ERR HubitatController#hubitat mapped capability x_hubitat_healthcheck has no implementation
- /home/pi/reactor/server/lib/SystemController.js
-
Did you shut down in an orderly way before disconnecting power?
-
Did you shut down in an orderly way before disconnecting power?
@toggledbits No I think I was so stupid that I just unplugged the power.......
-
@rafale77 has the right steps to begin: reinstall Reactor as if updating, and then run
npm update --no-save
in the reactor install directory.There is at least one damaged state file, I can see from your log post, so remove all the files in
storage/states/
. The loss of states may cause some rules to re-run, but once it recovers it should be fine from there. Do not remove files from other directories. Then start Reactor.If that doesn't come up, and you don't have a backup, we'll see what we can do to untangle anything else that may be damaged.
-
@rafale77 has the right steps to begin: reinstall Reactor as if updating, and then run
npm update --no-save
in the reactor install directory.There is at least one damaged state file, I can see from your log post, so remove all the files in
storage/states/
. The loss of states may cause some rules to re-run, but once it recovers it should be fine from there. Do not remove files from other directories. Then start Reactor.If that doesn't come up, and you don't have a backup, we'll see what we can do to untangle anything else that may be damaged.
-
@toggledbits @rafale77 npm Update and erasing storage /states did it. No it is up and running. Does this mean the same could happen in a power outage?
Thanx a lot
@matteburk I have yet to test MSR, but I think it may be more of a Raspberry Pi question. Regarding Pi I think there are a few steps that one can take to make the setup more dependable.
The first step is to run it on a SSD and not on a SD card. SD cards are quite bad at constant read/write and are initially made for e.g. digital cameras. It is very easy to migrate the installation from the SD to a cheap SSD. I do not remember your setup, but if you have not done this I would say it is step number one.
The next step is to power the Pi via an UPS. The cheapest way is to buy a regular UPS, this is what I have done for my servers. Even the cheapest you can find has ample power for running a Pi for quite a long outage. You can also set it up on the Pi via e.g. PiJuice Hat, but this is more costly. Also the regular UPS can be used to power/protect other devices such as you router, NAS or similar.
The third step would be to backup the SSD at times. This can be done either via simply cloning the SSD to an image with e.g. Win32 Disk Imager or also setting it up to run in the background on the Pi. I think there are some tips in the forum on how to set up this.
-
@matteburk I have yet to test MSR, but I think it may be more of a Raspberry Pi question. Regarding Pi I think there are a few steps that one can take to make the setup more dependable.
The first step is to run it on a SSD and not on a SD card. SD cards are quite bad at constant read/write and are initially made for e.g. digital cameras. It is very easy to migrate the installation from the SD to a cheap SSD. I do not remember your setup, but if you have not done this I would say it is step number one.
The next step is to power the Pi via an UPS. The cheapest way is to buy a regular UPS, this is what I have done for my servers. Even the cheapest you can find has ample power for running a Pi for quite a long outage. You can also set it up on the Pi via e.g. PiJuice Hat, but this is more costly. Also the regular UPS can be used to power/protect other devices such as you router, NAS or similar.
The third step would be to backup the SSD at times. This can be done either via simply cloning the SSD to an image with e.g. Win32 Disk Imager or also setting it up to run in the background on the Pi. I think there are some tips in the forum on how to set up this.
-
Good recommendations all. In terms of architecture, I can personally vouch for using a PoE hat and powering the Pi from a UPS-backed PoE switch. If you have IP cameras, you may already have such a switch. While this is really no different in effect from plugging a Pi's regular AC power adapter into a UPS, it gives you vastly more choice on the location of the Pi, which may be important if you are using a Z-Stick, etc. Being able to distribute stable power over a wide area because of PoE is a huge win. I've also powered my Vera via PoE for a long time now (using a PoE adapter).
And, backing up Reactor is as easy as backing up the "storage" and "config" subdirectories. Any way you do that is probably OK. Depending on what else you might be doing with the Pi, it's likely sufficient to back up storage/config often, but make SSD images only very rarely. Even if the image is a year old, an
apt upgrade
will quickly bring the OS back to current, and then the MSR upgrade and storage/config restore and you'll quickly be back on line in a blink. -
T toggledbits locked this topic on