Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reboot/Restart Via MQTT #855

Open
MagicMountainMan opened this issue Aug 6, 2021 · 3 comments
Open

Reboot/Restart Via MQTT #855

MagicMountainMan opened this issue Aug 6, 2021 · 3 comments

Comments

@MagicMountainMan
Copy link

MagicMountainMan commented Aug 6, 2021

Is your feature request related to a problem? Please describe.
Sometimes I need to reboot the device or restart the room-assistant service because room-assistant stops updating Home Assistant and usually stops detecting BLE devices.

Describe the solution you'd like
I would love a quick and easy way to restart the room-assistant service from Home Assistant. Ex: Send a command to restart the room-assistant service via MQTT and once the service successfully restarts it broadcasts via MQTT that it has restarted. If Home Assistant never sees that room-assistant gets successfully restarted then I could set up a notification to let me know and manually intervene.

Describe alternatives you've considered
I'm creating an automated way to restart the service with Node-Red and SSH but I haven't gotten it working yet and there would be no actual feedback to know if the service restart was successful or not anyway.

Overall I've found that occasionally restarting the room-assistant service on my RPiZeroWs makes then much more stable. I do have to completely reboot the devices sometimes, but that's beyond the scope of what a room-assistant enhancement could achieve anyway.

@saif-p
Copy link

saif-p commented Sep 16, 2021

I took your comment about using node-red / ssh and came up with a solution that works well enough for me:

  • In home assistant I created an input_boolean.reboot_room_assistant_nodes and an input_select.room_assistant_nodes which contains options for 'yellowpi', ;bluepi', 'redpi' , 'greenpi', and 'all' (the hostnames for each of my pi0ws)

  • In node red I have a flow that triggers when the input_boolean is turned on that checks the state of the input_select, sets the payload to 'sudo reboot' and sends that to the ssh node for the corresponding pi. It also turns the input_boolean back to off.

For the 'all' input_select, the flow sends the 'sudo reboot' payload to all 4 of the ssh nodes, with a 5 second delay between each one. I set the delay because I found that rebooting them all at once sometimes caused them to form into seperate clusters (I'm using the default cluster config).

Back in home assistant, I have an entities card that shows the cluster leader for each pi, so that as each pi gets rebooted, the state changes to unavailable.

Screen Shot 2021-09-16 at 11 24 19 AM

Screen Shot 2021-09-16 at 11 25 22 AM

@worm5406
Copy link

OK. I am curious. Explain more, please.

What does it reference? Does it check timestamp? What does the ssh look/send? My Pi's lag at times for 30 seconds on login etc. When it is dead/dying.

Sorry for just a few questions. I have more.

@worm5406
Copy link

I get an error also:

Permission denied, please try again.
Permission denied, please try again.
Redacted@192.168.30.2: Permission denied (publickey,password).

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

No branches or pull requests

3 participants