iantrich / restriction-card

🔒 Apply restrictions to Lovelace cards
MIT License
270 stars 23 forks source link

Can it be used with other custom cards? #14

Closed byff closed 4 years ago

byff commented 4 years ago

For example,I used ‘multiple-entity-row’ card,now I want to block toggle2,can this be achieved? I have many try and none works.

      - type: entities   
        entities:
          - entity: switch.phicomm_dc1_2_switch3
            type: 'custom:multiple-entity-row'
            name: room
            state_header: toggle3
            state_color: true 
            toggle: true
            secondary_info: sensor.phicomm_dc1_2_power
            entities:
              - entity: switch.phicomm_dc1_2_switch1
                name: toggle1
                toggle: true
                state_color: true 
              - entity: switch.phicomm_dc1_2_switch2
                name: toggle2
                toggle: true
                state_color: true 

image

Sorrry for my poor English and Thank you very much for this great and really useful card!

iantrich commented 4 years ago

No, it can only be used on the row/card

firestrife23 commented 3 years ago

I was searching for a solution and found your post here with a similar issue. But I found a working solution for restriction-card and multiple-entity-row. The only caveat it will only block the entire row, not the individual toggles.

Feel free to include this snippet in your list of examples.

type: entities
entities:
  - card:
      entity: group.bedroom_lamps
      type: custom:multiple-entity-row
      show_state: false
      secondary_info: last-changed
      entities:
        - entity: light.left_lamp
          toggle: true
        - entity: light.right_lamp
          toggle: true
    restrictions:
      block:
        exemptions:
          - user: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    type: 'custom:restriction-card'
    row: true