Disable Physical Button on ESP8266 Smart Plug

Hi All,

First post here from down under! Long time Lurker and very grateful for all the dedication and help from the HA community!

Just a quick one I was working on tonight. I couldnt find another thread that did what I was looking for so i fumbled my way through an automation and I think I have it down… feel free to correct me if I dont or if there was an easier way!

The Problem: electric heater on a manual timer that my kid keeps mucking around with.
Requirements: Set an on/off time and disable the physical button to not let him turn it on during a certain period
The solution: using one of these https://www.bunnings.com.au/deta-grid-connect-smart-rewireable-plug_p0098810
and following this awesome dudes example: https://schinckel.net/2019/11/18/hacking-the-deta-rewireable-plug/
and this pinout diagram: https://docs.tuya.com/en/iot/device-development/module/wifi-module/wifie2smodule?id=K9605u79tgxug

I soldered on some jumpers and flashed via serial for ESPhome. Then I wrote this automation:

- id: 'xxxxxxxx'
  alias: 'Heater DISABLE '
  description: ''
  trigger:
  - entity_id: switch.heater_relay
    platform: state
  condition:
  - after: 05:45:00
    before: '18:00:00'
    condition: time
  action:
  - device_id: xxxxxxxx
    domain: switch
    entity_id: switch.heater_relay
    type: turn_off

Essentially during the prescribed period, if the button is pressed, it quickly turns it back off.

Thanks again for everyones contributions!

Kade