After a bit of back and forth with @joshknz we came to the conclusion that the MQTT route would be the best to start from and see from there how the project evolves. Josh also made the point to look at Matter and see if that could be a more generic solution to make Nerves devices compatible with ecosystems like Apple HomeKit and Google Home instead of only Home Assistant. Home Assistant already supports Matter so that way would still be possible.
Inspiration came from GitHub - mtrudel/hap: A HomeKit Accessory Protocol (HAP) Implementation for Elixir · GitHub
We also talked about a more GenServer-ish implementation which could look like this:
defmodule LivingRoomTemo do
use HomeAssistantNerves.Sensor,
name: "Living Room Temperature",
unit_of_measurement: "°C",
device_class: :temperature,
update_interval: Duration.new(seconds: 60)
def handle_state(_temp) do
YourTempSensor.read()
end
end
defmodule Garage do
use HomeAssistantNerves.Switch,
name: "Garage Light"
def handle_state(_state) do
GPIO.read(pin)
end
def handle_command(:toggle, _state) do
GPIO.write(pin, !state)
end
end
The plan is to create a Repo and go from there and explore ideas. Will post the link here as soon as we have something to show!






















