osdomotics / smart-sarah

smart-SARAH

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stateful nodes

GoestaSmekal opened this issue · comments

When nodes reboot (due to power loss, battery replacement, reset button, ...) they forget about their earlier state. This is a minor issue for pure sensor nodes that get polled from time to time. If the node is an actuator, or other nodes are observing the nodes' resources, things get more complicated.

For details about observing CoAP resources see:
https://datatracker.ietf.org/doc/draft-ietf-core-observe/?include_text=1

a) a pure sensor node would be just fine after reboot

b) a node with observers will lose its registrations and thus no further notifications will be sent. Observers will never notice they are no longer up to date, until their registration expires.

c) an actuator node will fall back to its default (a light switch might be turned off, garden hose closed, ...) and not be able to determine the "correct" state for the current situation

Possible solutions might be:

1.) the node writes the last PUT request for each resource into some NVRAM, restoring the values from there at each boot.

  • issue 1: flash memory gets worn out over time, depending on the number of put requests
  • issue 2: whatever the last PUT was, it might be inappropriate at the time, the node restarts (fishtank remains dark, bathroom light off while you are taking a shower ...)

2.) some "middleware" (linknx, OpenHAB, ...) cares about that. Nodes have to be actively monitored

  • issue 1: actively monitoring nodes creates otherwise unnecessary traffic, wearing out batteries
  • issue 2: this kind of overhead tends to be forgotten when configuring new nodes/connections

3.) observing every actuator node from the Smart-SARAH server (compare "freshnes checks" with Nagios (http://nagios.sourceforge.net/docs/nagioscore/3/en/freshness.html)

  • issue: this mainly overlaps with solution 2 plus adding the gap between the last notification and the end of the observation period.