add sensor module that defines some basic sensor metadata
This commit is contained in:
parent
af4f5a850c
commit
4b766f54ae
3 changed files with 47 additions and 5 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue