I’m developing a custom component for a gesture-based light switch / dimmer on VL6180X ToF range sensor.
The hard part is already done: interfacing with the hardware, state machine and the logic to recognize gestures, etc etc. As a result I can toggle a standard PWM output (ESP32 ledc platform) with a gesture, dim it, etc.
However, the issue is that these changes are not reflected in HA “Light” entity state: it’s not toggled, brightness is not changed.
What would be the proper way to propagate changes made to light::LightOutput class physical state back to the user? this->lightstate_->toggle(), this->lightstate_->publish_state(); appear to do nothing.
I’ve set up a small example of the code, taking empty_light example and having it to set the output to random values periodically here: vl6180x-gesture-switch/empty-light-example at main · k-korn/vl6180x-gesture-switch · GitHub
The actual code is here, on line 19. There should be something to propagate the changed state back to HA, but I have not found anything close in other Light/Dimmer components or in the docs.