uvjim / linksys_velop

Home Assistant integration for the Linksys Velop
MIT License
50 stars 7 forks source link

Lovelace card details removed from readme? #416

Closed dredjohn21 closed 1 year ago

dredjohn21 commented 1 year ago

First: looooove this integration

I did the recent update and noticed more buttons appearing on my Lovelace card (it’s a little crowded now and can’t read the text on mobile). I thought I would check the readme and see if there were any updates I should make and noticed all references were gone.

Or, did they get moved? Would love to see how you are displaying on front end

uvjim commented 1 year ago

The YAML for the cards was moved a while ago. There's been a number of changes going on in the integration and I just don't have the time to keep those cards up-to-date as well. I didn't realise people would be using them as daily drivers either and was starting to get a number of issues raised with them not keeping pace with the features being added or Home Assistant changes.

I don't use those cards anymore either, in favour of building out something new that was easier for me to use on mobile, if I need to use it at all.

dredjohn21 commented 1 year ago

Ahhh gotcha

I’m definitely a user (I have a tab for all my network stuff and occasionally check out which devices are connected to which node)

but get the situation and will take ownership from here on optimizing (I haven’t had any issues until noticing more buttons pop up today after upgrading)

uvjim commented 1 year ago

I've had a quick look at that bit and I guess you have a few options...

  1. Disable the Mesh buttons/switches that you don't use (that will remove them from the UI but also remove the functionality)
  2. Exclude them from the auto-entities card (that will take them off the UI but leave the functionality available on the Mesh device)
  3. Redo that area of the card completely to just handle what you're interested in.
dredjohn21 commented 1 year ago

Thanks so much

For anyone else that stumbles upon this #2 is super easy and how I chose to simplify the card (see last 2 rows):

  - type: custom:auto-entities
    card:
      type: horizontal-stack
    card_param: cards
    sort:
      method: friendly_name
    filter:
      include:
        - entity_id: /^(button|switch)\.(velop_)*mesh_/
          options:
            type: custom:button-card
            hold_action:
              action: more-info
            tap_action:
              action: >-
                [[[ return (entity.entity_id.startsWith("button")) ?
                "call-service" : "toggle" ]]]
              service: >-
                [[[ return (entity.entity_id.startsWith("button")) ?
                "button.press" : undefined ]]]
              service_data:
                entity_id: entity
            name: |-
              [[[
                let friendly_name = entity.attributes.friendly_name.replace(/Velop|Mesh|:/gi, "").trim()
                let idx = friendly_name.lastIndexOf(" ");
                let ret = friendly_name.substring(0, idx) + "<br />" + friendly_name.substring(idx + 1)
                return ret
              ]]]
            styles:
              card:
                - box-shadow: none
                - margin-bottom: 3px
              icon:
                - animation: |-
                    [[[
                      let ret
                      let speedtest_entity = states["binary_sensor.velop_mesh_speedtest_status"] || states["binary_sensor.mesh_speedtest_status"]
                      if (entity.entity_id.match(/button\.(velop_)*mesh_start_speedtest/) && speedtest_entity.state == "on") {
                        ret = "rotating 2s linear infinite"
                      }
                      return ret
                    ]]]
                - color: |-
                    [[[
                      let ret
                      let col_on = "darkcyan"
                      let col_off = "var(--primary-text-color)"
                      ret = (entity.state == "on") ? col_on : col_off
                      if (entity.entity_id.match(/button\.(velop_)*mesh_start_speedtest/)) {
                        let speedtest_entity = states["binary_sensor.velop_mesh_speedtest_status"] || states["binary_sensor.mesh_speedtest_status"]
                        ret = (speedtest_entity.state == "on") ? col_on : col_off
                      }
                      return ret
                    ]]]
              name:
                - font-size: smaller
                - color: |-
                    [[[
                      let ret
                      let col_on = "darkcyan"
                      let col_off = "var(--primary-text-color)"
                      ret = (entity.state == "on") ? col_on : col_off
                      if (entity.entity_id.match(/button\.(velop_)*mesh_start_speedtest/)) {
                        let speedtest_entity = states["binary_sensor.velop_mesh_speedtest_status"] || states["binary_sensor.mesh_speedtest_status"]
                        ret = (speedtest_entity.state == "on") ? col_on : col_off
                      }
                      return ret
                    ]]]
      exclude:
        - entity_id: switch.mesh_homekit_integration
        - entity_id: switch.mesh_wps