Skip to content

πŸ›βœ… fix Sensor silently collapsing for multi-variable output onto one column - #27

Open
Tesshub wants to merge 1 commit into
mainfrom
fix-sensor-multi-variable-collapse
Open

πŸ›βœ… fix Sensor silently collapsing for multi-variable output onto one column#27
Tesshub wants to merge 1 commit into
mainfrom
fix-sensor-multi-variable-collapse

Conversation

@Tesshub

@Tesshub Tesshub commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

When a Sensor was created with a list of variables (e.g. heating + cooling energy), all the results ended up merged into a single column instead of one column per variable β€” silently, with no error.

Two bugs combined to cause this:

  1. Sensor.post_process gave every variable's columns the exact same name.
  2. get_output_variable's suffix-stripping used unescaped text in a regex, which broke in an unexpected way for lists of variables.

Both are fixed now: each variable gets its own correctly named columns, and the regex is safe. Added tests covering multi-variable sensors to prevent this from happening again.

Sensor.post_process tagged every variable's columns with the same
f"_{self.variables}" (the whole list stringified), and get_output_variable's
drop_suffix regex embedded the raw variables param unescaped, turning it into
a corrupted character class - both caused columns from different variables to
end up identically named and get deduplicated away downstream.

Sensor.post_process now loops per variable so each gets its own correctly
tagged columns, and get_output_variable builds its strip regex from the
already-parsed/escaped variable_names_list instead of the raw param.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Tesshub
Tesshub requested a review from BaptisteDE July 24, 2026 13:33
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.

1 participant