feat: add fan controls#269
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new Home Assistant automation blueprint for controlling/displaying fan speed on a HASPone slider with an overlaid on/off icon, and documents it in the blueprints README.
Changes:
- Introduces
hasp_Display_Fan_Speed_with_Icon.yamlblueprint implementing fan speed + toggle + icon overlay via MQTT/JSON events. - Adds “Display Fan Speed with Icon” entry and import link to
Home_Assistant/blueprints/README.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| Home_Assistant/blueprints/hasp_Display_Fan_Speed_with_Icon.yaml | New automation blueprint implementing fan speed control + icon overlay behavior. |
| Home_Assistant/blueprints/README.md | Documents the new blueprint and provides a one-click import link. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| triggers: | ||
| - trigger: state | ||
| entity_id: !input fan | ||
| - trigger: template | ||
| value_template: "{{ is_state(haspsensor, 'ON') }}" | ||
| - trigger: homeassistant | ||
| event: start | ||
| - trigger: mqtt | ||
| topic: "{{jsontopic}}" | ||
| - trigger: mqtt | ||
| topic: "{{selectedfgtopic}}" | ||
| - trigger: mqtt | ||
| topic: "{{selectedbgtopic}}" | ||
| - trigger: mqtt | ||
| topic: "{{unselectedfgtopic}}" | ||
| - trigger: mqtt | ||
| topic: "{{unselectedbgtopic}}" |
There was a problem hiding this comment.
I think this is out-of-date knowledge. This pattern matches with the rest of the repo.
| fanbutton: "{{haspbutton|int}}" | ||
| togglebutton: "{{fanbutton-3}}" | ||
| fanobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}' | ||
| toggleobject: '{{ "p[" ~ hasppage ~ "].b[" ~ togglebutton ~ "]" }}' |
There was a problem hiding this comment.
This is the same pattern used in the other dimmer blueprints, but this could conceivably be changed to:
togglebutton: "{{haspbutton|int - 3}}"I'll let the maintainer change all instances in other blueprints if this is needed.
| haspsensor: >- | ||
| {%- for entity in device_entities(haspdevice) -%} | ||
| {%- if entity|regex_search("^sensor\..+_sensor(?:_\d+|)$") -%} | ||
| {{ entity }} | ||
| {%- endif -%} | ||
| {%- endfor -%} |
There was a problem hiding this comment.
The surrounding {%- ... -%} blocks trim the whitespace already.
| topic: "{{jsoncommandtopic}}" | ||
| payload: '["ref {{togglebutton}}","delay=1","xstr {{xpos}},{{ypos}},{{iconwidth}},{{iconheight}},{{iconfont}},{{selectedfg}},0,1,1,3,\"{{icon}}\"","delay=1","vis {{fanbutton}},1"]' |
There was a problem hiding this comment.
I don't think this is valid; this follows the pattern used by the other blueprints.
| togglebutton: "{{fanbutton-3}}" | ||
| fanobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}' | ||
| toggleobject: '{{ "p[" ~ hasppage ~ "].b[" ~ togglebutton ~ "]" }}' | ||
| commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ fanobject }}' |
There was a problem hiding this comment.
True, but this is a cosmetic issue.
| togglecommandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ toggleobject }}' | ||
| jsontopic: '{{ "hasp/" ~ haspname ~ "/state/json" }}' | ||
| jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}' | ||
| isbr: "{% if wrap == true %}1{% else %}0{% endif %}" |
There was a problem hiding this comment.
True, but this is a cosmetic issue. Additionally wrap would be unreferenced if isbr were removed.
| activepage: >- | ||
| {%- set activepage = namespace() -%} | ||
| {%- for entity in device_entities(haspdevice) -%} | ||
| {%- if entity|regex_search("^number\..*_active_page(?:_\d+|)$") -%} | ||
| {%- set activepage.entity=entity -%} | ||
| {%- endif -%} | ||
| {%- endfor -%} | ||
| {{ states(activepage.entity) | int(default=-1) }} |
There was a problem hiding this comment.
This follows the pattern from the other blueprints, so it should be changed all together if it needs to be changed.
| name: "HASPone Button Font" | ||
| description: "Select the text font for this button label. Refer to the HASPone Font reference above." |
There was a problem hiding this comment.
That would be useful; it should be added to all blueprints if wanted.
Add a blueprint to control fan speed with the dimmer screens. The room I used this in had a Big Ass Haiku fan with a dimmable light and a variable speed controller. This makes it a bit easier to control the light and speed on one screen.
This fixes #233