ESP_Basic remote rollout facility
Posted: Fri Aug 05, 2016 11:01 am
I have been pondering the feasibility of being able to roll out live ESP_Basic script updates to ESP nodes, and I would appreciate any suggestions and comments.
I'm assuming more than one esp device, else there wouldn't be much benefit to be gained. But when you consider having several esp wifi nodes, especially if they are connectively related in any way, then it might be very useful when doing any program changes if you could roll out any or all of those program updates automatically in a controlled manner.
To put things into perspective with an easy-to-understand example, consider a relay 'alarm' node that can be triggered by several PIR sensor nodes. Say things already work fine, but you wish to update your little alarm 'system' so that all the sensors periodically report their presence to the alarm node, which then needs a capability for flagging up any offline sensors.
This would require program modifications to all nodes, but manually re-programming them takes time and causes system downtime. So I am trying to think of a better way.
In principle, it would probably be a matter of doing any relevent program changes on a local 'dev' node, then copying all program updates to sit on what would effectively be a central 'rollout' node, which might perhaps be the alarm node. Then it would just be a matter of all nodes (including the rollout node itself), to periodically 'check-in' to the rollout node to see if there was a new program update sat there for it, in which case it could download it to itself and reboot back online with its updated program.
So for instance, node PIR3 would have a small and simple bit of code causing it to periodically look for (or ask the rollout server for) any updated program, which it would download if and when available.
Another possibility is that the rollout server could notify any relevent nodes of any corresponding updates available for them, which they could then download when ready.
It would be a straightforward matter to include relevent checking/download commands into the EasyNet list of recognised local commands which could be controlled remotely.
And in the case of EasyNet nodes, all nodes would have unique specific node names available for naming the appropriate updated programs, but it should also work using nodes IP addresses for the appropriate updated program names.
The main problem is... how best to store and download the updates?
A couple of possible mechanisms that I can think of are...
1. O.T.A. - but I think that requires a special server, and I believe it requires splitting available memory into 2 alternative memory spaces which can be switched one for the other, therefore always wasting half.
2. Sending updated .bas files to the appropriate remote nodes spiffs, then triggereing the node to reboot - but I don't know if it's possible to 'send' files to spiffs on remote nodes, or trigger remote reboots (although I have included the remote udp reboot facility into EasyNet).
3. Using just a small header program for each node, which 'chains' in and runs an appropriate main program from local SPIFFs - but I'm not sure if 'chaining' works, or if it is possible to upload to local spiffs from a remote (rollout) node.
Perhaps it's not yet possible, but it could offer some good advantage if it was, so I welcome any comments and suggestions...
I'm assuming more than one esp device, else there wouldn't be much benefit to be gained. But when you consider having several esp wifi nodes, especially if they are connectively related in any way, then it might be very useful when doing any program changes if you could roll out any or all of those program updates automatically in a controlled manner.
To put things into perspective with an easy-to-understand example, consider a relay 'alarm' node that can be triggered by several PIR sensor nodes. Say things already work fine, but you wish to update your little alarm 'system' so that all the sensors periodically report their presence to the alarm node, which then needs a capability for flagging up any offline sensors.
This would require program modifications to all nodes, but manually re-programming them takes time and causes system downtime. So I am trying to think of a better way.
In principle, it would probably be a matter of doing any relevent program changes on a local 'dev' node, then copying all program updates to sit on what would effectively be a central 'rollout' node, which might perhaps be the alarm node. Then it would just be a matter of all nodes (including the rollout node itself), to periodically 'check-in' to the rollout node to see if there was a new program update sat there for it, in which case it could download it to itself and reboot back online with its updated program.
So for instance, node PIR3 would have a small and simple bit of code causing it to periodically look for (or ask the rollout server for) any updated program, which it would download if and when available.
Another possibility is that the rollout server could notify any relevent nodes of any corresponding updates available for them, which they could then download when ready.
It would be a straightforward matter to include relevent checking/download commands into the EasyNet list of recognised local commands which could be controlled remotely.
And in the case of EasyNet nodes, all nodes would have unique specific node names available for naming the appropriate updated programs, but it should also work using nodes IP addresses for the appropriate updated program names.
The main problem is... how best to store and download the updates?
A couple of possible mechanisms that I can think of are...
1. O.T.A. - but I think that requires a special server, and I believe it requires splitting available memory into 2 alternative memory spaces which can be switched one for the other, therefore always wasting half.
2. Sending updated .bas files to the appropriate remote nodes spiffs, then triggereing the node to reboot - but I don't know if it's possible to 'send' files to spiffs on remote nodes, or trigger remote reboots (although I have included the remote udp reboot facility into EasyNet).
3. Using just a small header program for each node, which 'chains' in and runs an appropriate main program from local SPIFFs - but I'm not sure if 'chaining' works, or if it is possible to upload to local spiffs from a remote (rollout) node.
Perhaps it's not yet possible, but it could offer some good advantage if it was, so I welcome any comments and suggestions...