eigenein / my-iot-rs

Yet another home automation (alpha)
https://eigenein.github.io/my-iot-rs/html
MIT License
32 stars 5 forks source link

Composite readings #31

Closed eigenein closed 4 years ago

eigenein commented 4 years ago

Currently all the values are primitives. And for example a reading cannot be:

Also, I still have to implement sensor titles somehow (#10).

A draft idea is to replace the primitive value: Value with a HTTP-headers-like set of values. For example, an annotated image could look like:

vec![
    (Header::Image, Value::ImageUrl("https://...")),
    (Header::Title, Value::Text("Hello")),
    (Header::SensorTitle, Value::Text("Backyard Cam")),
    (Header::HasMotion, Value::Boolean(true)),
]

And then renderer picks up everything it's able to render. Automation has to be adjusted too. Perhaps relates to reading transformations (#30).

Open questions:

eigenein commented 4 years ago

Potentially this could also help to get rid of the special "one-off" message type, leaving only read and write ones. Whether it's persistent or not could be put into metadata

eigenein commented 4 years ago

Trying to evolve this idea I decided that it's better to add strongly typed fields, either on message or reading level, depending on whether they should be stored per sensor or per reading