Do not call update() in constructor #8878
Aug 8, 2017
5 checks passed
Maybe you can help me understand what you're trying to avoid in "Do not call update() in constructor", so I can fix it correctly. I modeled off some other switch where device attributes are set in the update, but that initial set of statuses can either duplicate that code or just call
You seem to want to be specifically avoiding that. I'm normally trying to avoid duplicating code, but this just suggests I'm doing something wrong in the first place.
Ultimately, the switch broke because this is one of those appliances with 8 switches on a parent switch. Discovery has to start with the parent and work it's way down to the individual switch. You had replaced the parent's
Even if update is called again, the @Throttle around the parent's update should make it continue on with cached data, right? Or am I mistaking how Throttle works?
Regardless, I have it working again in my environment by duping the code that would be in the