Skip to content

Regression: Generated stubs for light.turn_on are missing fields #866

Description

@Midbin

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

  1. Call the pyscript.generate_stubs service on an instance with at least one light entity.
  2. Open the generated pyscript_generated.py and find the light class / _light_state class.
  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions