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

Sensors divided over source files #110

Open
rikki78 opened this issue Nov 18, 2022 · 0 comments
Open

Sensors divided over source files #110

rikki78 opened this issue Nov 18, 2022 · 0 comments

Comments

@rikki78
Copy link

rikki78 commented Nov 18, 2022

Hi,
First of all thanks for your great library. This is really useful for integrating remote sensors into Home Assistant.
In my case I have made one sketch that can be configured to use different sensors. So based on a config file for example temperature sensors or binary switches are defined which all use the same code. To make it readable I have spread the code over different files, where the temperature sensor HASensorNumber is in a different file as the devices HADevice and HAMqtt.
This gives issues as the order of initialisation of the global objects is not under my control, so I figured I need to create the sensors dynamically (like you suggested in this issue #103).
I haven't tested this but I guess it will work. The question I'm having now, is how to create multiple sensors dynamically? For examples if there are more binary switches.
Can you suggest how to do this?
thanks

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

1 participant