-
Notifications
You must be signed in to change notification settings - Fork 7
Description
I think it should be possible to do hack our way into this pretty easily at the moment, but it would require some fiddling with topics and such. Instead, I propose that I change to a model of commands generating a single topic output, which we can then reference easily per-device. For example, nvidia-smi
has a ton of great data, but we currently have to probe it multiple times. Why not re-use this output? For example, we could create a topic of /ha-mqtt-iot/<deivce>/state/gpu/0
which will carry a full JSON output of what we want, and then use value_template
on many entities to derive all the sensors we want. Probe once, post once, just tell HomeAssistant where to look.
In cases where we don't have more than one entity as a result of a command, we can still use the same format - keep it simple. Topic generation needs to be automatic.
A first thought at this is to name a command in one place, and reference it per entity - so each place we currently allow providing a function would now be a reference.