AalianKhan / mushroom-strategy

A strategy to automatically generate a dashboard using mushroom cards
MIT License
373 stars 37 forks source link

Setting to hide devices and/or entities #10

Closed ajagnanan closed 1 year ago

ajagnanan commented 1 year ago

Is your feature request related to a problem? Please describe. I wanted to "hide" certain devices and/or entities from showing up on the generated dashboard.

Describe the solution you'd like Add a setting with a list of entity/device ids that get excluded from showing up on just the mushroom strategy dashboard.

Describe alternatives you've considered There's the setting to "hide" entities available through HASS, but this hides it globally.

Additional context Discussed here: https://github.com/AalianKhan/mushroom-strategy/issues/8#issuecomment-1502174783

AalianKhan commented 1 year ago

Hey, Which other dashboards do you use that hides entities that are in hidden status? I think most users would like to hide entities from all dashboards. Can you explain your scenario more?

ajagnanan commented 1 year ago

I'm making User specific dashboards for wall mounted tablets in each room. These should hide the devices/entities that shouldn't be customized. An Admin/Manager dashboard would edit them as needed. Hope that gives some insight. Thanks for looking at it too.

AalianKhan commented 1 year ago

Ahh, that makes alot of sense. This does seem like a valuable option. I will probably add this feature soon.

ajagnanan commented 1 year ago

Awesome, thanks

DigiLive commented 1 year ago

I've created a pre-release which you could try. @ajagnanan Any feedback would be appreciated.

Otherwise this issue will be closed for being fixed or stale.

ajagnanan commented 1 year ago

I gave it a try, but couldn't get it working. Is my config correct? I think it would be an entity config property.

strategy:  type: custom:mushroom-strategy  
options:
...
  entity_config:
      - entity: fan.master_bedroom_fan
        type: custom:mushroom-fan-card
        hidden: true
...
DigiLive commented 1 year ago

🤔 It might be I've mixed up the expected format of the dashboard configuration.

I'll check and let you know soon.

In your example you have dots. Be aware they shouldn't exist in your yaml. Alse make sure you use correct indentations.

ajagnanan commented 1 year ago

Oh the dots are just before/after options I have set. The part I was trying to configure was entity_config. Also, will there be a way to hide devices too? Maybe a device_config that hides all entities under it. Thanks

DigiLive commented 1 year ago

Thank you for testing.

Hiding entities (or devices) isn't possible in release 1.0.0-alpha.1 indeed. I've mistaken about that due the massive code change of that release, but it's pretty much on top of my todo list.

Hang on.

ajagnanan commented 1 year ago

@DigiLive I was trying the update today and it seems like it's still not working. I double checked that I used the right entity ids, tried different types of entities etc. and it won't hide the entity.

DigiLive commented 1 year ago

Can you post your configuration? Also, make sure the old JavaScript isn't cached.

ajagnanan commented 1 year ago

Ugh, the cache got me. I cleared it out and it's working now. Can this be expanded to cover a Device? (all entities would be hidden belonging to the device) Thanks

DigiLive commented 1 year ago

Nice to hear it works. I'll create a pre release soon.

I'm not sure how to discover devices and how to link them to entities.

ajagnanan commented 1 year ago

@DigiLive Can we maybe do a wildcard (regex style) exclude on entities instead? There tends to be a lot of entities per Area.

DigiLive commented 1 year ago

Do you have an example on how this would give a benefit in general?

ajagnanan commented 1 year ago

Yea, so some integrations add a few entities per device which adds up when doing them individually e.g. sensor.light_charging sensor.light_battery_usage sensor.light_clock etc.

The name usually equals the <entity_type>.<device_name>_<entity_name> format. Hiding a device would be ideal since it'll hide all entities, but if that's not possible maybe we piggy back on hiding entities, but with a regex: sensor.light_*

ajagnanan commented 1 year ago

@DigiLive Think this is a good addition? I can make a separate issue for it if so.

DigiLive commented 1 year ago

I think it's ok to create another issue or an discussion for it. (https://docs.github.com/en/discussions)

The proposal only works if the naming convention is always as proposed, but I'm not actually sure about it.

ajagnanan commented 1 year ago

Got it https://github.com/AalianKhan/mushroom-strategy/issues/48