Questiong regarding conditions and tracking a device

I am not sure if this is the proper way to submit this request… but here it goes.

I am very new to HA and Hass.io, running latest update on Pi 1.

I have a heater on a wemo plug that I would like to track the on state and turn it off it is on for more than 1 hour. The kids sometimes turn it on and forget to turn it off. How in world would I do this, or is it even possible?

I have figured out how to turn it on automatically each day of the work week at a set time and of course can turn it off automatically but I would really like this safety check built in.

Thanks Matt

How are the kids turning it on? Is this a wemo plug with power monitoring?

It is the small rectangle wemo with front power switch.

I think I have it working, tests ok.

‘’’- id: “Bathroom heat on for to long”
alias: ‘Bathroom heat on for to long’
trigger:
platform: state
entity_id: switch.bathroom_heater
from: ‘off’
to: ‘on’
for:
hours: 1
minutes: 30
action:
service: switch.turn_off
entity_id: switch.bathroom_heater
‘’’

Can you please tell me what I have to do to display code blocks? Just tried enclosing in ‘’’ did not work.

The ``` have to be on a line by themselves.

But that automation looks good to me.

‘’’

  • id: “Bathroom heat on for to long”
    alias: ‘Bathroom heat on for to long’
    trigger:
    platform: state
    entity_id: switch.bathroom_heater
    from: ‘off’
    to: ‘on’
    for:
    hours: 1
    minutes: 30
    action:
    service: switch.turn_off
    entity_id: switch.bathroom_heater
    ‘’’

It is still eating my formatting…?

Those should be ` (back ticks) not ’ (single quotes).

- id: "Bathroom heat on for to long"
  alias: 'Bathroom heat on for to long'
  trigger:
    platform: state
    entity_id: switch.bathroom_heater
    from: 'off'
    to: 'on'
    for:
      hours: 1
      minutes: 30
  action:
    service: switch.turn_off
    entity_id: switch.bathroom_heater

I got it! Thanks a bunch!!! I am old, 52, so a learning curve…

This is so cool, I am trying to lessen my reliance on IFTTT and all of the independent clouds. That is the driver to building this system. I am finding that simple things like blinking lights are not so simple, will tackle that next. I would like to get Alexa working with it as well, but not sure that will fly since I want color changes and brightness changes to work.