Access number component from .h

Hi,

I want to create a number component so that the user can configure my device and then a custom component can use this number in its .h file to do calculations using this configured number.

I’ve had a look through the API and on this forum and just generally on search engines and I haven’t been able to find anything (it’s all been using the number component value in lambdas of other components).

Any help is greatly appreciated. Thanks :slight_smile:

I figured it out! Turns out I wasn’t using my C++ brain properly.

I just added the configuration Number as an argument to the custom component class, and then made a function in the .h for updating that value and updated the yaml on the Number to have a lambda to use that function on_value.