add device info to show homeplate in device registry#11
Conversation
| StaticJsonDocument<devcapacity> deviceinfo; | ||
| deviceinfo.clear(); | ||
| deviceinfo["manufacturer"] = "e-radionica"; | ||
| deviceinfo["model"] = "Inkplate 10"; |
There was a problem hiding this comment.
Can this be set using macros so other Inkplate devices like the Inkplate6 can work as well?
There was a problem hiding this comment.
edit: it does not need to be macros. Ideally I'd like to avoid hardcoding a specific model here.
There was a problem hiding this comment.
I'll have a look at it, how to get the info for which model the code is build. I think compile time via macro or config.h makes sense because usually you're building it for a specific device. Maybe added to platformio.ini under the corresponding env section?
There was a problem hiding this comment.
As long as its not hard-coded I'm happy with it. Using config.h or platform.ini seem like good options.
There was a problem hiding this comment.
You could use the build flags chosen by the build environment (I should have a pull request soon to add more build envs) and then an #ifdef statement - something like this:
#if defined(ARDUINO_INKPLATE6PLUS)
deviceinfo["model"] = "Inkplate 6PLUS";
#elseif defined(ARDUINO_INKPLATE10)
deviceinfo["model"] = "Inkplate 10";
#else
deviceinfo["model"] = "Inkplate (other)";
#endif
The disadvantage here is that a model needs to be added for each plausible build environment. I don't know if there is already a variable somewhere that includes a friendly model name of the board.
There was a problem hiding this comment.
Unfortunately I don't think such a model exists yet, so I'm happy to have it added to the platformio.ini file in this repo.
There is an official inkplate platformio repo but it does not seem to be regularly updated or maintained as compared to the Arduino library I use here.
There was a problem hiding this comment.
I suppose the build env could just define a friendly model name, and this section pulls that definition. If the definition is empty, then a sensible default is used.
| deviceinfo["manufacturer"] = "e-radionica"; | ||
| deviceinfo["model"] = "Inkplate 10"; | ||
| deviceinfo["name"] = "HomePlate"; | ||
| deviceinfo["identifiers"][0] = "homeplate"; |
There was a problem hiding this comment.
This should be unique to the specific device in case there are multiple homeplate's on the same network. I think it should be the device's mac address so that device tracker integrations can identify it as well.
There was a problem hiding this comment.
Good point, I think this should be extended to the mqtt topics and unique_ids as well. That would make discovery less error prone. For the activity-topic the hostname could be used (ex. "homeplate//activity"). Any thoughts?
There was a problem hiding this comment.
I think using a unique name for the activies would be a very welcome improvment. I noted that it should be done a while back but never got around it it. You are welcome to tackle that if you would like. :)
| deviceinfo.clear(); | ||
| deviceinfo["manufacturer"] = "e-radionica"; | ||
| deviceinfo["model"] = "Inkplate 10"; | ||
| deviceinfo["name"] = "HomePlate"; |
There was a problem hiding this comment.
Should this be the hostname? (which defaults to "homeplate")
There was a problem hiding this comment.
Easiest would be hostname. Extra friendly name seems to be overkill and name can be easily changed in HA.
e0eda55 to
0fc4579
Compare
|
Modified the patch to make device model, name and identifier configurable by config.h, put sensible defaults in place. |
|
This looks great, thanks for the PR! |





Quick hack for the homeplate to show up in HA Device Registry via MQTT Discovery