Skip to content

Functions high level overview

Mitra Ardron edited this page May 18, 2025 · 3 revisions

DRAFT !! Frugal IoT - functions high level

This is a high level view of the functions that occur on lots of classes of Frugal IoT

Abbreviations Means
S, A, or C. An Actuator, Sensor or Control
INxxx or OUTxxx An INuint16 INbool INcolor etc

Incoming to Actuators

Function
mqtt.dispatch(path, payload) if isSet calls Actuator.dispatchTwigAll
A.dispatchTwigAll(twig,payload,isSet) calls all A.dispatchTwig
A.dispatchTwig(id, leaf, payload, isSet=true) Calls each INxxx.dispatchLeaf then A.act if any change
A.act() Reads from INxxx.value etc and takes action (such as changing outputs)

Incoming to Sensors -

As for Actuators:

mqtt.dispatch => (if isSet) Sensor.dispatchTwigAll -> s.dispatchTwig -> OUTxxx.dispatchLeaf but doesnt call act

Outgoing sensor readings

Function
Loop (or periodically) readAndSet
S.readAndSet reads physical sensor, calls S.set or OUTxxx.set directly
S.set(...) calls OUTxxx.set
OUTxxx.set If changed calls Mqtt.messageSend and sendWired
OUTxxx.sendWired calls Mqtt.messageSend

Incoming to Control

Function
mqtt.dispatch(path, payload) calls Control.dispatchTwigAll and Control.dispatchPathAll
C.dispatchTwigAll calls each INxxx & OUTxxx.dispatchLeaf then if changed C.act()
C.act() Makes state changes, the result of one or more messages being received, may call OUTxxx.set
OUTxxx.set see Outgoing sensor readings

Clone this wiki locally