Labels

Monday, October 12, 2020

IP Power Strip #04 - the Strikedown Container

I had suspected that the fastest way to build this was to use node red, at least I know that shutdown and reboot are easily implemented.  The issue is Mac and Ubuntu computers.  I don't think that  I will need to consider PCs (except for the Atom HA-IOT Server which runs Ubuntu).  I got the initial sequence done in node red, however I have not set it up yet to do an actual shutdown/restart - still figuring out the MQTT messages to use.  I decided on the following messages

  • relay/strikedown along with relay/strikedown_answer
    • reboot: 0/1, name: IP1, ping: 0/1
    • if reboot is 0 then does a shutdown
    • if reboot is 1 then does a restart
    • if ping is 1 then starts ping message sequence (5 times with 2 sec in between)
    • note when ping is 1, upon restart the ping sequence will start up
  • relay/myping
    • name: IP1, ping: 0/1
    • if ping is 1 then starts ping message sequence (5 times with 2 sec in between)
    • if ping is 0 then stops ping
    • note when ping is 1, upon restart the ping sequence will start up
  • relay/ping
    • name: IP1

strikedown, the Docker container in node red, will always use port 1885 on each host.  That way, I will be able to get to the node red invocation to make changes.  For strikedown on Raspberry Pi, theer is a node red contrib library that does both functions.  For the one on Ubuntu servers it will have to be made specific to the server.  I am thinking of using Python since there is a Python function node in the contrib library.

The strikedown node red sequence is in two parts, the startup and the strikedown sequence.  The startup sequence is:


The strikedown node red sequence is:


Update: I have since discovered that the Shutdown and Restart Nodes in this sequence do not work under a Docker Container running on RPi.  So I will have to figure out how to accomplish the task in another way.