Skip to content

fix: YAML boolean state parsing issue#220

Merged
hugobloem merged 1 commit intohugobloem:mainfrom
shaungrady:fix/yaml-boolean-state-conversion
Oct 21, 2025
Merged

fix: YAML boolean state parsing issue#220
hugobloem merged 1 commit intohugobloem:mainfrom
shaungrady:fix/yaml-boolean-state-conversion

Conversation

@shaungrady
Copy link
Contributor

@shaungrady shaungrady commented Oct 20, 2025

YAML's FullLoader parses unquoted 'on' and 'off' as boolean values (True/False) instead of strings. This caused scene state matching to fail because Home Assistant entity states are strings ("on"/"off"), not booleans.

The fix converts boolean state values to their string equivalents after loading from YAML, ensuring compatibility with both quoted and unquoted state values in scenes.yaml files.

Fixes scene evaluation when using unquoted state values like:

  state: on  # parsed as True, now converted to "on"
  state: off # parsed as False, now converted to "off"

YAML's FullLoader parses unquoted 'on' and 'off' as boolean values (True/False)
instead of strings. This caused scene state matching to fail because Home Assistant
entity states are strings ("on"/"off"), not booleans.

The fix converts boolean state values to their string equivalents after loading
from YAML, ensuring compatibility with both quoted and unquoted state values in
scenes.yaml files.

Fixes scene evaluation when using unquoted state values like:
  state: on  # parsed as True, now converted to "on"
  state: off # parsed as False, now converted to "off"
@shaungrady shaungrady force-pushed the fix/yaml-boolean-state-conversion branch from 9c03a5e to 4b23bb3 Compare October 20, 2025 01:10
@shaungrady shaungrady changed the title Fix YAML boolean state parsing issue fix: YAML boolean state parsing issue Oct 20, 2025
@hugobloem
Copy link
Owner

Brilliant, thank you!

@hugobloem hugobloem merged commit 153f477 into hugobloem:main Oct 21, 2025
5 of 7 checks passed
@shaungrady shaungrady deleted the fix/yaml-boolean-state-conversion branch October 21, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants