pimoroni / enviro

MIT License
102 stars 79 forks source link

Add mac address and model name to output #29

Closed Godley closed 1 year ago

Godley commented 1 year ago

I'm requesting these are added to the mqtt output so my plugin will be nicer to use. 1) I'd like mac address added so that there's a unique indentifier on homebridge (I'll generate a UUID from it) 2) I'd like the model added so that I can add the right sensors to homebridge for the appropriate boards :) Might also use it to name the device within homebridge

Gadgetoid commented 1 year ago

There's also machine.unique_id() in MicroPython which gets the flash chip ID.

eg:

UID = ("{:02X}" * 8).format(*machine.unique_id())

Though I don't know if this is better in any sense.

Godley commented 1 year ago

Whichever one is less power intensive, I suppose, but I'm guessing it's much of a muchness?

lowfatcode commented 1 year ago

Why not both? :-)

Added in: https://github.com/pimoroni/enviro/commit/fab6e344a6036363042a0a26e23059cf32266c40

Decided that both had their use cases. MAC is easier if you're managing devices alongside other network settings. UID could be easier depending on how you're provisioning your devices.