Hide button on web interface but not in Home Assistant

Is there a way to hide a button or switch on the esphome web interface but not on the home assistant interface?

I’ve tried a couple things, setting the button to internal obviously hides it from both, setting it to disabled_by_default just hides it under a “show all” button in the web interface but user can still access.

Basically I’m wanting to expose the web interface on an esp board to users without giving them access to home assistant so they can independently monitor the status of sensors but not be able to press buttons or change switches.

I don’t think that use case is supported unless you replace or augment the stock CSS/JavaScript with custom stuff served from your own web server or embedded into the device.

See the css_url:, css_include:, js_url:, js_include: & possibly local: configuration variables.

You can see more readable versions of the default JS/CSS at https://oi.esphome.io/v1/webserver-v1.js & https://oi.esphome.io/v1/webserver-v1.css.

actions = [
    ["switch", ["toggle"]],
    ["light", ["toggle"]],
    ["fan", ["toggle"]],
    ["cover", ["open", "close"]],
    ["button", ["press"]],
    ["lock", ["lock", "unlock", "open"]],
    ];
multi_actions = [
    ["select", "option"],
    ["number", "value"],
    ];

If you replace the above (from the compressed ‘min’ version) with

actions = [];
multi_actions = [];

it’ll not add click actions but still show state.

Of course a clever user could bypass the JavaScript and go straight to the REST API using curl or similar.

You could create a feature request to have a new pair of sub-keys of auth: called say, read_only_username: read_only_password:.

With those, REST POST wouldn’t work and the click handlers wouldn’t be installed.

Worth a try!