add sensor module that defines some basic sensor metadata

This commit is contained in:
Travis Shears 2026-03-24 11:35:21 +01:00
parent af4f5a850c
commit 4b766f54ae
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
3 changed files with 47 additions and 5 deletions

View file

@ -1,9 +1,10 @@
import gleam/erlang/process
import gleam/list
import gleam/otp/actor
import sensors
pub type Subscriber =
process.Subject(String)
process.Subject(sensors.SensorReading)
pub type Message {
Subscribe(subscriber: Subscriber)
@ -24,7 +25,10 @@ fn handle_message(
}
Proc -> {
list.each(subscribers, fn(subscriber) {
process.send(subscriber, "Hello from dummy mqtt action")
process.send(
subscriber,
sensors.SensorReading(sensors.Temperature, 26.6),
)
})
actor.continue(subscribers)
}