Skip to content

Add secondary option for cover entities#5556

Merged
bramkragten merged 3 commits intohome-assistant:devfrom
cdce8p:cover-secondary
Apr 22, 2020
Merged

Add secondary option for cover entities#5556
bramkragten merged 3 commits intohome-assistant:devfrom
cdce8p:cover-secondary

Conversation

@cdce8p
Copy link
Copy Markdown
Member

@cdce8p cdce8p commented Apr 16, 2020

Proposed change

Add position and tilt-position for cover as options for secondary_info.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

# Config
cover:
  - platform: demo

# ui-lovelace
- type: entities
  title: Cover
  entities:
    - entity: cover.hall_window
      secondary_info: position
    - entity: cover.living_room_window
      secondary_info: tilt-position

Additional information

Since last-triggered was added as an option (#4222), I think cover-position and tilt-position are useful as well.
Cover_secondary_line

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Comment thread src/panels/lovelace/components/hui-generic-entity-row.ts Outdated
Comment thread src/panels/lovelace/components/hui-generic-entity-row.ts Outdated
@cdce8p cdce8p requested a review from bramkragten April 19, 2020 20:10
"ui.panel.lovelace.cards.entities.never_triggered"
)
: this.config.secondary_info === "position" &&
stateObj.attributes.current_position
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current_position can be 0 I think? So we shouldn't do a falsy check, but check for undefined

Same for tilt.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. What do you think about just omitting the check itself? It would then be Position: undefined for not supported covers. This way you would instantly know that your ui-config is wrong.

I'll push the undefined check in a few minutes. Let me know if you should remove them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it won't print undefined

@bramkragten bramkragten merged commit c72bb5b into home-assistant:dev Apr 22, 2020
@bramkragten bramkragten mentioned this pull request Apr 22, 2020
@cdce8p cdce8p deleted the cover-secondary branch April 22, 2020 11:14
@lock lock Bot locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants