Closed Faewks closed 7 months ago
Thanks @Faewks, what do you think about using the pattern in esphome subsitution to have a 'Inkbird_IHT_2PB.yaml' file with the IHT_2PB code and then 2 files 'ESP32C3_Inkbird_IHT_2PB.yaml' and 'ESP32doit_Inkbird_IHT_2PB.yaml' for the board specific code?
This would look nice. I just had a quick look on it so I am not sure if it is included, but is it possible with this to just select the proper board and than it will take the right code for the selected board?
I will have a proper read this weekend.
I'm not sure it can select the board automatically. You probably still need to create specific yaml file with the part specific to the board. The part that is independent of the board could be in a share yaml.
Ok, I think I understand where you're going with this. The otherwise repetitive part will be saved in 'Inkbird_IHT_2PB.yaml' and the board specific part will be saved in a board specific '.yaml'. And the board specific '.yaml' loads the 'Inkbird_IHT_2PB.yaml'. So, users just choose the yaml-file for their board and they are golden. And changes to the common code base is automatically loaded for the board specific files which reduces maintenance because you don't need to change it for every board.
I quite like it. Makes things easier. I changed the files. Does it automatically synchronize with the Pull Request? For me it looks like it does.
But I just encountered a problem: I'm quite new to HA and ESPHome and up to now I just copied the code from a '.yaml' when I created a new EspHome device. So do I need to install the board with the bare minimum and then change the '.yaml' for the board and specify
packages:
# Git repo examples
remote_package:
url: https://github.com/Faewks/ESPHome-Inkbird-ITH-2PB/
ref: main # optional
files: [ESP32C3_Inkbird_IHT_2PB.yaml, Inkbird_IHT_2PB.yaml]
refresh: 1d # optional
and that's it? Because right now I can only specifiy one '.yaml' for a board and I don't know where to safe the second one (using ESPHome in Docker).
If you can just load it from GitHub, then I would also like to be able to define a name:
and maybe friendly_name:
. Do you think this is possible (all considering that up to this point I'm understanding this right...)? Or should we exclude the "name" and let users add it to the base '.yaml' before they load the stuff from Github? So like:
substitutions:
devicename: <AddDeviceName>
friendly_name: <AddDeviceFriendlyName>
packages:
# Git repo examples
remote_package:
url: https://github.com/Faewks/ESPHome-Inkbird-ITH-2PB/
ref: main # optional
files: [ESP32C3_Inkbird_IHT_2PB.yaml, Inkbird_IHT_2PB.yaml]
refresh: 1d # optional
and in the board-yaml:
esphome:
name: $devicename
friendly_name: $friendly_name
I guess I'm missing something here: https://esphome.io/guides/configuration-types.html#remote-git-packages
Added .yaml file for ESP32-C3. Edited the original .yaml file name to be able to distinguish between the different esp32s. Added info for ESP32-C3 to the README.