Skip to content
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

How to add sensor #90

Open
probablypablito opened this issue Jan 26, 2025 · 6 comments
Open

How to add sensor #90

probablypablito opened this issue Jan 26, 2025 · 6 comments
Assignees

Comments

@probablypablito
Copy link

Hi! I really like this project. I'm interesting in contributing my own binary sensor to it. I've successfully build HADC_Reborn using dotnet. I have made the code for my sensor, added in the Sensors directory, and also added it to the configuration.yaml. It shows up in Home Assistant, but seems to just stay as false. My questions are:

  • How do I define a new sensor
  • How do I pull the latest 1.0.0.4 version (I always seem to build version 1.0.0.0)
  • Why does the HA / test folder still exist in the main branch

Again, thank you for this project!

@GamerClassN7
Copy link
Owner

GamerClassN7 commented Jan 29, 2025

Hi @probablypablito, it is awesome to hear that you are enjoying the app and trying to implement new sensors :)

  • create new class inside HADC_REBORN/Class/Sensors each sensor class need to have at least GetValue method inside, which can have attributes parameters which you can later use inside of your configuration.yaml file
  • you cannot pull version please work on dev branch which is then pushed to master on release
  • They are remnants of previous versions :) will be deleted in future

How ever if i can suggest, clone dev branch try to add your code and then open merge request, so i can see your code and suggest what to fix ;)

@probablypablito
Copy link
Author

Hi! I successfully added my sensor into the Sensors class and it works great in HomeAssistant! The only thing that's still not clear to me before I make a PR is how to make sure my sensor gets added to the default configuration.yaml.

So far, I've had to add my sensor manually at the bottom of the generated config after the binary is built. I remember trying to add it to the HADC_REBORN/Resource/configuration.yaml, but maybe I did it wrong.

@GamerClassN7
Copy link
Owner

Hi, that is the correct file, however you need to clear the build directory since it is build only if it doesn't exist.

@GamerClassN7
Copy link
Owner

@probablypablito did you manage to create PR ? :)

@probablypablito
Copy link
Author

Hi sorry for the lack of response, I did not manage to get the configuration yaml to appear, doubly so because the dev branch doesn't seem to compile for me. I'll still PR my code tomorrow so you can take a look at it in case I just missed something obvious.

@GamerClassN7
Copy link
Owner

@probablypablito just tested dev branch, it compile correctly, so make PR and i will take a look. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants