-
Notifications
You must be signed in to change notification settings - Fork 0
Pub Sub messages
Pub/Sub messages
If an entity has a sub-state (substate)
, the following subscriptions can be available:
(entity)/(substate)/get
-
(entity)/(substate)/set
(if appropriate) -
(substate)/get
(useful to enumerate different entities that all support a given(substate)
If(substate)
changes, the entity publishes: -
(entity)/(substate)
with all information that concerns this substate.
-
(substate)
:temperature
- For sensors, this would only implement theget
subscriptions, but possibly for a heating system, that could also provideset
subscriptions. -
(substate)
:led
- A led can be a compound substate: on/off state, blink frequency, brightness, r-g-b colors. Possibly, a led could export(ledname)\state\get
, answering with a state that contains (onoffstate, mode(blinking?), brightness, color), and possibly sub-states like(ledname)\brightness
. A(ledname)/state/set
could contain one or several of the sub-states within the message. Also abbreviations (on/off etc.) should be discussed.
Each published substate should contain within it's json message:
"timer": millis();
-
"time": util::msgtime::ISOnowMillis();
(only, if a valid system-time is available)
Both time
and timer
reference the moment, the current state was assumed. (e.g. the moment a switch was pressed, or the moment, the sensor data was actually measured.)
Each entity subscribes to (entity)/info/get
and info/get
-
(entity)/info/get
publishing to this enumerates all substates of an entity, publishing(entity)/info
-
info/get
publishing to this enumerates all entities and causes all of them to publish(entity)/info
-
Mastertime subscribes to
*/time
-
Time-providers entities subscribe to
(entity)/time/get
,time/get
, and, if they can change their clock/time:(entity)/time/set
andtime/set
. -
Mastertime publishes
time/get
-
All time-entites publish
(entity)/time
, both on receive oftime/get
and periodically. -
On each receive of a
(entity)/time
, Master-time selects the time-source with the hightest precision, and periodically uses that information to publishtime/set
. -
Time-entities that have subscribed to a
time/set
, change their internal clocks accordingly.