You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression: Generated stubs for light.turn_on are missing fields #866
pyscript version: 2.1 Home Assistant version: 2026.8.3
Description
After the latest pyscript.generate_stubs run, the generated type stub for light.turn_on() / light.<entity>.turn_on() in pyscript_generated.py no longer includes several legitimate light.turn_on service fields, for example brightness and xy_color. These fields are still valid in runtime and also per the developer docs.
This is a recent regression, my scripts calling light.turn_on(brightness=..., xy_color=...) that previously type-checked cleanly now get false-positive "no parameter named X" errors after regenerating stubs. The dynamic runtime call itself is of couse unaffected, but it makes the generated stubs misleading.
I suspect this was introduced by #863 by @contagon, because before pyscript 2.1 the stubs generation worked fine. That update reworked stub generation to iterate the state machine instead of the entity registry. Possible "advanced" fields like brightness, xy_color, hs_color, color_temp, rgbw_color, rgbww_color, white, flash, profile get filtered out while keeping the "primary" fields (brightness_pct, rgb_color, color_temp_kelvin, brightness_step_pct, effect).
Steps to reproduce
Call the pyscript.generate_stubs service on an instance with at least one light entity.
Open the generated pyscript_generated.py and find the light class / _light_state class.
Inspect the turn_on / toggle signatures.
Expected
turn_on/toggle should keep accepting the full set of documented light.turn_on fields, including at least:
brightness
xy_color
hs_color
color_temp
rgbw_color
rgbww_color
white
flash
profile
Another Question: What does the additional_fields=None parameter mean? I couldn'T find anything in the documentation.
Not caused by #863 - HA renamed advanced_fields to additional_fields in home-assistant/core#171444, and the generator only matched the old name.
That's also why you saw a bogus additional_fields=None param. Fix incoming.
So I just dug into this to see what happened here.
This appears to be not a result of #863, but actually that HA recently renamed these advanced fields from "advanced_fields" to "additional_fields" (in home-assistant/core#171444 which happened last May) which broke the hardcoded service generator in ,
Activity
dmamelin commentedon Aug 31, 2026
Not caused by #863 - HA renamed
advanced_fieldstoadditional_fieldsin home-assistant/core#171444, and the generator only matched the old name.That's also why you saw a bogus
additional_fields=Noneparam. Fix incoming.contagon commentedon Aug 31, 2026
So I just dug into this to see what happened here.
This appears to be not a result of #863, but actually that HA recently renamed these advanced fields from "advanced_fields" to "additional_fields" (in home-assistant/core#171444 which happened last May) which broke the hardcoded service generator in ,
pyscript/custom_components/pyscript/stubs/generator.py
Line 190 in f6c1792
Just unfortunate timing that they both happened at the same time! I'll throw up a small PR with some tests to fix this.
EDIT: Woops! Beat me to it:)