Skip to content

Add State machine to sensors #8

@yatharthranjan

Description

@yatharthranjan

Adding a state machine to sensors will help in keeping track of any changes in sensors.
This will also help in reporting these to a status/<sensor-name> in the pub sub system similar to #5 .

State machine libraries for py-

Custom Implementation -

EDIT- A really simple way would be using http://liftoff.github.io/onoff/

EDIT 2 - Nice tutorial using the python-statemachine library -- https://www.askpython.com/python-modules/state-machines-python

### Tasks
- [x] Read the code and understand what needs to be changed and come up with an plan for implementation. Only the python module is involved in this currently.
- [x] Add new abstract functions in the sensor class to expose the states
- [ ] Add states that a sensor can use.
- [ ] Push sensor states when a state change happens (can also use pull using functions above)
- [ ] Publish to the pub/sub broker using Publisher, similar to the way other data is published.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions