-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Utilize packages to reduce code duplication #6
Utilize packages to reduce code duplication #6
Conversation
With the reorg, is there any reason to keep the top level bed-presence-mk1.yaml? |
I believe the top level file is needed for the existing devices If you're not concerned in maintaining support for existing devices, we can delete the top level file and change the |
That is fair. At this point, it's only the beta devices, but it would be nice to keep those working. The Made for ESPHome project also links to that location. What I'm considering is actually leaving the top level yaml files in the top directory, then they can still reference the base.yaml and sensor.yaml files in the underlying folder. |
Symlinking should achieve the same result (that's how the ratgdo project does it) |
When I click on one of their top level symlinks, I still arrive at a page telling me where it's pointing versus going to the file itself. For example, this link https://github.com/ratgdo/esphome-ratgdo/blob/main/v25board_esp32_d1_mini.yaml still gets you to a file that contains I don't think I see a downside to storing the main file at the top. If I find a downside later, I can always move the file down and add a symlink. |
Sounds good. Are you going to make that change? Or do you want me to? |
I can put in the leg work. Thanks for all the effort to simplify this! |
I made a few changes for better organization in the YAML:
bed-presence
folder so that it can live alongside the new packages that it depends on.bed-presence-mk1.yaml
in the root of the repo that is simply a pointer to the new one (needed for dashboard import to continue to work.sensor.yaml
file in thebed-presence
folder that uses substitutions to avoid code duplication for the left/right sensors.base.yaml
file in thebed-presence
folder that wraps the inclusion and templating of thesensor.yaml
file as well as includes the other buttons and sensors that were being created.bed-presence/base.yaml
file as a remote package from inside the newbed-presence-mk1.yaml
file which still handles all of the rest of the ESPHome setup. This allows users (such as myself) to simply copy thepackages
block from that file and integrate it into an existing ESPHome configuration while still getting updates to the sensors defined.Note (because of how the ESPHome remote packages work), the remote package will not work until this is merged in. You can test it from my repo meanwhile by making a quick change in
bed-presence-mk1.yaml
locally:Let me know if you have any questions.