Good colleagues, I’m starting with Home Assistant and now everything seems like an uphill. I need to lock a button on the lovelace panel of a smart plug that connects a hard drive. I want the button to stay locked during the disk mounting process (to avoid double pressing it, or turning it off while it’s mounting the hard drive).
I have made an automation when the plug is activated that calls a script that mounts the disk (shell_command.mount_disk). That script sends process data to a sensor (sensor_log). I want to disable (or lock) the button on the smart plug until the sensor shows “DISK MOUNTED”, at which point, I want the button to no longer be locked.
Here I show you the automation:
alias: Mount disk
description: ''
trigger:
- platform: state
entity_id: switch.disk_1
from: 'off'
to: 'on'
condition: []
action:
- service: shell_command.mount_disk
data: {}
mode: single
I imagine that it will be necessary to add an action that once the button is pressed, that blocks it until the moment the sensor shows “DISC MOUNTED”. But how do I do it? are there ways to lock the button with some sort of padlock? Sorry for my English, I’m not very good at it… Here’s the code (configurator.yaml) for that sensor, the sensor is always active receiving info from that log file.
Companion. I just installed the addons with HACS, but I don’t know how to implement it or where to put the code. Sorry for my ignorance, I’ve only been with HA for a few days and for me any nonsense means climbing Everest.
I want to use this code to test if it locks the button, does this go in configuration.yaml?
Tom I have a problem. When I lock the card, by clicking with the mouse to a specific area that a gray circle appears, the button is unlocked. It is very dangerous that it is triggered at the moment when I am mounting or unmounting the hard drive. Do you know how I could fix it? Thank you very much.