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 script domain #11

Open
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

lizsugar
Copy link
Collaborator

@lizsugar lizsugar commented Jun 2, 2022

Example usage:

      - type: custom:slider-button-card
        entity: script.turn_off_front
        slider:
          direction: left-right
          background: solid
          use_state_color: false
          use_percentage_bg_opacity: false
          show_track: false
          disable_sliding: true
          force_square: false
          tap_action:
            action: call-service
            service: script.turn_off_front
        show_name: true
        show_state: true
        compact: false
        icon:
          show: true
          use_state_color: false
          tap_action:
            action: more-info
          icon: ''
        action_button:
          mode: toggle
          icon: mdi:power
          show: false
          show_spinner: true
          tap_action:
            action: toggle
        show_attribute: false

Looks like this:
image

and tapping the card runs the script, with a visual and state change while the script is running

lizsugar and others added 30 commits April 9, 2022 15:00
Makes it more visually distinguishable
Just uses the switch controller to toggle the automation on and off
Mouse or touch event can now continue outside of card bounds to continue
adjusting the slider by relative position change.  This is incredibly
helpful on small mobile displays.
Just uses the switch controller to toggle the automation on and off
Mouse or touch event can now continue outside of card bounds to continue
adjusting the slider by relative position change.  This is incredibly
helpful on small mobile displays.
Plus some default settings based on card type
FIX: No longer triggers the tap_action when sliding!
BUG: does not trigger tap_action unless slider is disabled
It is supposed to trigger tap_action at all times.

The goal is that this change will eventually result in "Act as a toggle (disable
sliding)" being removed. A toggle for disabling slider will remain, but
it will no longer add a tap action for toggle when enabled, as that will be attached to the
slider anyway (and can be defined as 'none' action if desired).
GUI and YAML options added, english translation added

Current bugs: if attribute value is too long, then state and attribute will
not stay on the same line.
Outstanding bug: Rounding error when input_number step is set to certain values (observed easily with step set to 2 or 3)
lizsugar added 11 commits April 27, 2022 11:13
Remove all references to hasToggle/has_toggle and replace appropriately with disableSliding/disable_sliding.

Added default configs for the controller types

tap_action works with both mouse and touch when sliding is disabled

current bugs, now better described after further testing:
- tap_action with sliding enabled works with touch but not mouse click
- tap_action with sliding enabled sometimes jumps to the value your finger is at
@lizsugar
Copy link
Collaborator Author

lizsugar commented Jun 2, 2022

whew, it included all the commits that haven't already been applied upstream even though i forked it much later 😅

well i honestly have no idea what this means, how it happened, or how to fix it wtf image

@rohankapoorcom
Copy link
Member

Is 8c57bf8 the only commit that should be part of this PR? If so, I think we can fix it by cherry-picking that commit onto a new branch that starts from this repo's main branch. If it's more than that one commit, you should be able to cherry pick each of them over to the newly created branch.

Let me know if that works or if you want me to give it a try.

@rohankapoorcom
Copy link
Member

rohankapoorcom commented Jun 5, 2022

I ran a rebase on this branch against the custom-cards/main branch with git rebase -i upstream/main, removing all but the commit I mentioned in my previous comment and then resolved any conflicts and pushed it up here: https://github.com/custom-cards/slider-button-card/tree/rebased_script_domain

Feel free to close this PR and make a new one from that branch or force push that branch onto your own. Either way should work (assuming I got the correct commit).

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