Trouble with input_select automation

I have a Sonoff S31power monitor outlet with an HA sensor (sensor.garage_refrigerator_amps) which anything over an amp is a good indication it is running. This is my input select:

input_select:
  refrigerator_status:
    name: Garage Refrigerator Status
    options:
      - Idle
      - Running

These are my automations.

automation 28:
  alias: Set refrigerator running
  trigger:
    - platform: numeric_state
      entity_id: sensor.garage_refrigerator_amps
      above: 1.1
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: input_select.refrigerator_status
        state: idle
      - condition: state
        entity_id: input_select.refrigerator_status
        state: running
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.refrigerator_status
        option: Running
automation 29:
  alias: Set refrigerator idle
  trigger:
    - platform: numeric_state
      entity_id: sensor.garage_refrigerator_amps
      below: 1.1
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_select.refrigerator_status
        state: running
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.refrigerator_status
        option: Idle

I can manually trigger the automations and it changes the state from Idle to Running and vice versa. However it will not do it automatically as it should. Stumped.

38%20AM

Silly question, why do you need an input_select + automations to track the status of your fridge?
Why not create a template sensor ?

sensor:
  - platform: template
    sensors:
      refrigerator_status:
        entity_id: sensor.garage_refrigerator_amps
        friendly_name: "Refrigerator Status"
        value_template: "{% if states('sensor.garage_refrigerator_amps') | float > 1 %}Running{% else %}Idle{% endif %}"
1 Like

Thank you. That does indeed work perfectly but now itā€™s a matter of I want to figure the input_select thing out ā€¦ just because :grinning:

This is a simplified single automation for your input_select:

automation 29:
  alias: Set refrigerator idle
  trigger:
    - platform: state
      entity_id: sensor.garage_refrigerator_amps
  action:
    - service: input_select.select_option
      data_template:
        entity_id: input_select.refrigerator_status
        option: "{% if states('sensor.garage_refrigerator_amps') | float > 1 %}Running{% else %}Idle{% endif %}"

Your input select wasnā€™t working because you were conditioning off of it equal to running and idle, not Running and Idle. Home assistant is case sensitive.

1 Like

Thanks guys. All that stuff worked. I appreciate the super fast and accurate help!

My next parlor trick will be to set up an automation which will let me know if the door is left open. When the light comes on in the fridge it draws exactly 0.41 amps. Iā€™ll set it up to where if it is between say 0.3 and 0.6 amps for more than 1 or 2 minutes then it will send me a text. That was kind of the whole learning process leading up to this :grinning:

I tried to tackle the same issueā€¦

I got a zigbee door sensor :slight_smile:

I think it will be hard to solve the puzzle with the amps, because the fridge will use more power once in a while to cool.

And my freezer does not have a light :wink:

I just got it figured out. At first I went for 0.3 to 0.6 amps and that was all wonderful until I figured out that if you leave the door open the compressor kicks on and the amp draw goes way out of that range and Open or Closed means nothing (with that configuration).

Then I noticed my fridge pulls around 160 to 180 watts max, running and opening the door and the (probably 40 watt lamp) makes it jump to 220 or so.

To be safe I set the sensor to watts and set a range of 190 to 250 watts for 45 seconds and has it send me a text after that. Just tested it like 10 times and it works great. Worst case scenario it takes about 5 or 6 minutes at the most before you get the text. That is if the refrigerator is cold and it takes a few minutes to kick on and I have the Tasmota flashed Sonoff S31 set to a TelePeriod of 60 seconds

automation 30:

  alias: Refrigerator Door Open
  trigger:
    - platform: numeric_state
      entity_id: sensor.garage_refrigerator_watts
      above: 190
      below: 250
      for: 
        seconds: 45
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: input_select.refrigerator_door_open
        state: Open
      - condition: state
        entity_id: input_select.refrigerator_door_open
        state: Closed
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.refrigerator_door_open
        option: Open
    - service: notify.clicksend
      data_template:
        title: "Garage Refrigerator Door Open"
        message: >-
          The Garage Refrigerator Door Is Open
automation 31:
  alias: Set refrigerator door closed
  trigger:
    - platform: numeric_state
      entity_id: sensor.garage_refrigerator_watts
      below: 190
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_select.refrigerator_door_open
        state: Open
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.refrigerator_door_open
        option: Closed

I have it figured out pretty well and made a blog page about it.

https://www.hagensieker.com/wordpress/2019/03/30/making-your-refrigerator-smart/?fbclid=IwAR2DiuyzcOiJ8JZDi7yVcqXLingzU-IS4Gagy1iPDxdMjoS7vT9MMrvdRwQ