custom-cards / slider-button-card

A button card with integrated slider
MIT License
105 stars 16 forks source link

Add support for script domain #11

Open lizsugar opened 2 years ago

lizsugar commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Is https://github.com/custom-cards/slider-button-card/pull/11/commits/8c57bf8e5aa6d8ac1733cd205a00554935d081cd 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 commented 2 years ago

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).