Make input_* uneditable in UI

Dear all,

i am using input_number entities as internal variables, e.g. to track a numeric state over time that cannot be read directly. Although those helpers do have an “editable” attribute, changing it’s value to false in customization still allows changing their value in (autogenerated) lovelace UI.

Is there a way to make those helpers read-only for the UI while still allowing to set their value using services?

I use this:

You can restrict a whole card or just selected rows.

I have most of my restrictions set up to use a PIN, or check a “lock override” input boolean (that is also protected with a PIN). For quick adjustments I use the card/row PIN and they auto lock again after a short time but if I’m doing something more extensive I use the override switch that keeps them unlocked until I turn it off.

Thanks, but …

Use HACS or follow this guide

Always found my way around HACS, not only since the recent security findings. I’ll guess I go for a custom lovelace dashboard.

For the convenience HACS offers the risk is low but you can install it without hacs. You even included the link to the instructions yourself.

Understood, but still: I would need to disable automatic Lovelace, so I could also simply hide the input_number entity

You can have an auto generated dashboard and one you have taken control of.

1 Like

editable just relates to whether you can configure it in the UI. Even if that’s false - as is the case when you add them with YAML - you can still change the values in the UI.

2 Likes

Having a display only field would be useful. In my project going to try just creating a dummy sensor. The configuration recompile (restart) seems to accept it. Also, Developer Tools States allows change of the state value. So later it should be possible to reference the entity and update the value. Below example the plan is to calculate and update the fluid level state in pyscript.

sensor:
    - platform: template
      sensors:
          esp32_fluid_level:
              unit_of_measurement: 'oz'
              value_template: 0
1 Like

Here too I have some things in automations that I use input helpers for to expose what’s happening in Lovelace. But this should not be editable in lovelace.

If you want the value to show, but not be editable, you could create a template sensor based on the input and set the input to hidden.

That means a lot of entities though…

1 Like

I don’t fully understand why, but creating an entity using the hass.states.set method in a python script results in a read-only entity. Through limited testing, the only ways I found to edit it are using the python script method or via the states tab under developer tools. No other places in the standard UI or home assistant service calls seem to be able to effect any change.

Use card-mod to disable input.
Goto card-mod thread → 1st post → link at the bottom → accumulative post → find links to style helpers & switches.

image

image

image

image

image

If you want to display the input_* value in an entities card, a simple workaround is to use the multiple-entity-row. Installed either manually or through HACS.

For demonstration both rows use the same input_text entity, whereas the second is rendered with the multiple-entity-row:
image

My entities card YAML looks like this (only one additional line and no CSS/HTML hacks):

type: entities
entities:
  - entity: input_text.android_tv_current_app
  - type: custom:multiple-entity-row
    entity: input_text.android_tv_current_app
title: Input Helpers

You find the multiple-entity-row here:

4 Likes

Sorry for the necromantic work here, but this is the first result in my Google searches…
The solution to the given problem, if you’re not using an automatic dashboard, is to use type: simple-entity on the entities card, as explained in this other post, which links to this part of the docs.

There’s no need for a custom component nowadays, if you were to install it just for this.

1 Like