architecture icon indicating copy to clipboard operation
architecture copied to clipboard

Read-only property for entities

Open Misiu opened this issue 6 years ago • 5 comments

Context

Sometimes you want to show the status of a switch or other entries in Lovelace UI. A simple use case can be a read-only view for a non-admin user or showing the status of switches that are changed via automation. The current workaround is to create a template entity, but if You have 30 switches then You must create 30 templates. If we would be able to add read-only: true to the entity then the problem would be solved.

this is already used for example in toggle switch - https://github.com/home-assistant/home-assistant-polymer/blob/dev/src/components/entity/ha-entity-toggle.ts#L34

As discussed in https://github.com/home-assistant/home-assistant-polymer/issues/3933, for now, we can use custom:hui-text-entity-row but this has a disadvantage:

image

When you click on entity details You can still edit its value.

Another option is to use a template, but you won't get history, icon colors won't change and you must create entity just to have a read-only version

Proposal

I'd like to propose having a property for the front for each entity and card: read-only: true|false This way we will be able to display the current state, value, and history without allowing the user to change the value.

Consequences

It will be much easier to show a read-only entity.

Misiu avatar Oct 07 '19 11:10 Misiu

To put it in perspective, the home automation software I've been using for over a decade (Premise, and it's much older than that) allows you to specify ReadOnly (among other things). Here's an example of setting a text-field called HeartbeatStatus so that it is displayed as read-only. The same can be done for booleans, sliders, etc.

Screenshot from 2019-10-25 10-51-14

I support the ability to have the same degree of control in Home Assistant.

tdejneka avatar Oct 25 '19 15:10 tdejneka

this is ok for yaml, but what about UI? How this should be configured there?

fjufju avatar Apr 29 '20 11:04 fjufju

no configuration possible only when not admin ?

letroll avatar Jul 19 '20 18:07 letroll

+1 for this feature

matthyne avatar Jun 15 '22 11:06 matthyne

This seems like such a basic feature. Almost every development platform supports the ability to make visual controls non-editable.

Why is this such a problem where it's so basic of a concept for the HA team? This issue has been open since 2019...

There's the restricted-card and card-mod that attempt to do this and I use all the time to show states of variables that I don't want changed (such as short cycle protection logic for compressor automation).

Can we get an update as to why this isn't getting the attention it deserves? Has it already been addressed in some other issue?

sfrappier avatar Oct 11 '22 11:10 sfrappier

This architecture issue is old, stale, and possibly obsolete. Things changed a lot over the years. Additionally, we have been moving to discussions for these architectural discussions.

For that reason, I'm going to close this issue.

../Frenck

frenck avatar May 11 '23 13:05 frenck