Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sensor domain and binary_sensor domain #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lizsugar
Copy link
Collaborator

@lizsugar lizsugar commented Jun 2, 2022

This adds sensor and binary_sensor controllers. These are read-only entities, so by default the slider is disabled.

Sensor domain requested in mattieha#111
Binary_sensor domain requested in mattieha#128

Screenshot:
image

Notes:

Currently, tapping the card tries to trigger a non-existent toggle or turn_off/turn_on service. Neither of these domains have such services.
This is actually resolved by a separate feature I am working on to add configurable tap actions to cards regardless of slider being enabled or disabled (https://github.com/lizsugar/slider-button-card/tree/slider_tap_action), but that is not ready yet and it is larger than just these sensors cards. Once that is ready and merged, then these cards can be configured to have a tap_action of none, or more-info, or call-service, or whatever the user desires.

Sensors do not have built in min or max values, so they cannot be programmatically generated for the card per entity. The user has to add manual min: and max: values to the slider: section of the card's YAML (no GUI config for min or max exist at this time). For example:

type: custom:slider-button-card
name: Local AQI
entity: sensor.purple_air_aqi
slider:
  max: 70

The max is set to 70 because that's the AQI at which I start to have breathing problems.

or

type: custom:slider-button-card
name: Pixel 6 Battery Level
entity: sensor.pixel_6_battery_level
slider:
  max: 100

a max of 100 for batteries.

@rohankapoorcom
Copy link
Member

This looks great! And I think it's ready to merge. Do you want to do a README change on this branch or include that separately with a global README change?

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