Skip to content

Add text sensor support to CYD config generator and YAML output#44

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-text-sensor-to-has-dashboard
Draft

Add text sensor support to CYD config generator and YAML output#44
Copilot wants to merge 3 commits intomainfrom
copilot/add-text-sensor-to-has-dashboard

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

This change adds first-class support for Home Assistant text-based sensors in the CYD dashboard flow. Users can now configure a slot as a text sensor in the generator and get valid ESPHome YAML that updates the displayed text value.

  • Config model + sensor type support

    • Added text to the SensorConfig union via TextSensorConfig (type, icon, iconColor).
    • Extended shared sensor key typing so text sensor fields are editable through existing update paths.
  • Generator UI updates

    • Added Text Sensor to the sensor type selector in SensorConfigPanel.
    • Added text-sensor-specific controls (icon picker + icon color).
    • Added text sensor type label entries across locale files.
  • Preview behavior

    • Updated CydScreenGrid to render text sensor icon/icon color and show a sample text value, matching the new type semantics.
  • YAML generation

    • substitutions now emits text sensor icon fields:
      • ${id}_type: "text"
      • ${id}_icon
      • ${id}_icon_color
    • Added text_sensor: Home Assistant block generation that updates tile value labels on on_value.
    • Wired text_sensor generation into the main generateYaml(...) composition flow.
    • Included text sensor icons in glyph de-duplication logic.
  • Focused coverage

    • Added textSensor.test.ts to verify:
      • substitutions for text sensors
      • glyph collection behavior
      • generated text_sensor YAML section and update lambda
# Generated for text sensor slots
text_sensor:
  - platform: homeassistant
    id: ha_r1c1
    entity_id: ${r1c1_entity}
    on_value:
      then:
        - lvgl.label.update:
            id: val_r1c1
            text: !lambda |-
              return x.c_str();

Text sensor configuration UI

Copilot AI linked an issue Apr 15, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 15, 2026 01:11
Copilot AI changed the title [WIP] Add text sensor support for HAS dashboard Add text sensor support to CYD config generator and YAML output Apr 15, 2026
Copilot AI requested a review from element-software April 15, 2026 01:15
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.

Text sensor...

2 participants