iMicknl / LoctekMotion_IoT

Learn how to connect your Flexispot (LoctekMotion) desk to the internet. This repository contains a collection of scripts to get your started, combined with research and instructions.
MIT License
550 stars 56 forks source link

No Issue | Tip for a Mushroom-Desk-Card #59

Open guevara777 opened 1 year ago

guevara777 commented 1 year ago

Hi. Thanks to this project i can move my desk up and down with home assistant. awesome.

I've made a card that uses custom:button-card and custom:mushroom-card to create a mushroom-like desk-card.

The card looks like this (with the typical big padding for mushroom cards) image

or like this (with my smaller paddings around the card) image

The Buttons on the right side on the card... 1.) turn on the switch.down-entity 2.) turn off the switch.up and switch-down-entity 3.) turn on the swith.up-entity 4.) call the button.sit-entity 5.) call the button.stand-entity

To do this you need:

alias: schreibtisch anhalten
sequence:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.up
        - switch.down
mode: single

And this yaml-code

type: custom:button-card
entity: cover.desk
show_name: false
show_state: false
show_icon: false
styles:
  card:
    - overflow: unset
    - padding: 3px
  grid:
    - grid-template-areas: '"mushroom colors"'
    - grid-template-columns: auto 15rem
custom_fields:
  mushroom:
    card:
      type: custom:mushroom-template-card
      entity: '[[[ return entity.entity_id ]]]'
      tap_action:
        action: more-info
      icon_color: blue
      primary: '{{ state_attr(entity,"friendly_name") }}'
      secondary: >-
        {{ states("sensor.desk_height") }} {{
        state_attr("sensor.desk_height","unit_of_measurement") }}
      icon: '{{ state_attr(entity,"icon") }}'
      card_mod:
        style: |
          ha-card {
            padding: 3px 3px 3px 3px !important; #comment this line out if you want the bigger paddings around the card
            text-align: left !important;
            border: none !important;
            box-shadow: none !important;
          }
  colors:
    card:
      type: grid
      columns: 5
      square: false
      cards:
        - type: custom:button-card
          tap_action:
            action: call-service
            service: switch.turn_on
            service_data:
              entity_id: switch.down
          size: 70%
          show_state: false
          show_name: false
          show_icon: true
          icon: mdi:arrow-down
          styles:
            card:
              - padding: 3px
              - height: 40px
              - width: 2.5rem
              - box-shadow: none
              - border: none
              - background: var(--secondary-background-color)
        - type: custom:button-card
          tap_action:
            action: call-service
            service: script.schreibtisch_anhalten
          size: 70%
          show_state: false
          show_name: false
          show_icon: true
          icon: mdi:pause
          styles:
            card:
              - padding: 3px
              - height: 40px
              - width: 2.5rem
              - box-shadow: none
              - border: none
              - background: var(--secondary-background-color)
        - type: custom:button-card
          tap_action:
            action: call-service
            service: switch.turn_on
            service_data:
              entity_id: switch.up
          size: 70%
          show_state: false
          show_name: false
          show_icon: true
          icon: mdi:arrow-up
          styles:
            card:
              - padding: 3px
              - height: 40px
              - width: 2.5rem
              - box-shadow: none
              - border: none
              - background: var(--secondary-background-color)
        - type: custom:button-card
          tap_action:
            action: call-service
            service: button.press
            service_data:
              entity_id: button.sit
          size: 70%
          show_state: false
          show_name: false
          show_icon: true
          icon: mdi:chair-rolling
          styles:
            card:
              - padding: 0px
              - height: 40px
              - width: 2.5rem
              - box-shadow: none
              - border: none
              - background: var(--secondary-background-color)
        - type: custom:button-card
          tap_action:
            action: call-service
            service: button.press
            service_data:
              entity_id: button.stand
          show_state: false
          show_name: false
          show_icon: true
          icon: mdi:human-handsup
          size: 70%
          styles:
            card:
              - padding: 0px
              - height: 100%
              - width: 2.5rem
              - box-shadow: none
              - border: none
              - background: var(--secondary-background-color)
KrX3D commented 11 months ago

thanks for that card. It looks really nice, better than the one i had before

for the pause/stop button:

Since i use a cover in EspHome

cover:
  - platform: template
    # icon: mdi:table-chair
    # icon: mdi-human-male-height-variant
    name: "${device_name} Tisch"
.....

i just added

    stop_action:
      - logger.log: "Executing stop command"
      - switch.turn_on: switch_up
      - switch.turn_on: switch_down

an that stops the movement

i also added it in my config here:

https://github.com/iMicknl/LoctekMotion_IoT/issues/35