Temperature Condition

Ok i feel like this should be simple to figure out but i cant seem to find what i need to change. I have a window unit in my computer room that has an outlet controlled by a shell pm. I also have a zooz q sensor that handles motion to turn lights when we enter the room that has temperature in it. I want to use the temp in the motion sensor to set a condition that the window unit AC only kicks on above 71.5°. currently im in the room with the zooz reading 73.98° and the ac wont kick on. What am i just not seeing on my conditions??

alias: Computer Room AC On
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.computer_room_motion_motion
    from: "off"
    to: "on"
condition:
  - condition: state
    entity_id: switch.shelly1pm_b91067
    state: "off"
    for:
      hours: 0
      minutes: 2
      seconds: 0
  - condition: state
    entity_id: person.jonathan
    state: home
  - condition: numeric_state
    entity_id: sensor.computer_room_motion_air_temperature
    above: "71.50"
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.shelly1pm_b91067
mode: single

Thank you for any help! Im trying my best to learn all of these things just some are kicking my butt for some reason.

Noticed that the binary_sensor.computer_room_motion_motion has the word motion twice, is that correct for your sensor?
Are you able to use the debug automation to help you trace where it might be getting tripped up?
Also for my triggers I have found leaving the from: empty and only using the to: "on" works more reliably in times when a sensor may be unknown or unavailable before it is on.
image

What’s the purpose of this condition?

  - condition: state
    entity_id: switch.shelly1pm_b91067
    state: "off"
    for:
      hours: 0
      minutes: 2
      seconds: 0

If I’m reading it correctly, it’s going to only succeed if the AC unit is off for two minutes after the trigger event, and I’m not sure what that’s going to do to the conditional, as I’ve only used the for section in triggers. It could end up always being False, which means the action will never get fired.

This is a common technique to use with motion detection so that devices don’t turn back on when you are leaving a room, especially if it’s something that someone might manually or verbally switch off. The correct read of the condition is “only allow the switch to be turned back on if it has been off for at least the last 2 minutes preceding the trigger event”.

1 Like

I just tried that and it came back with this error…

Error: In 'numeric_state': In 'numeric_state' condition: entity sensor.computer_room_motion_air_temperature state '°F' cannot be processed as a number

Ok so now im stumped on how to correct this where i can use the temperature as a condition.

Also i will get rid of the from: off just to be sure thats not causing any issues.

I put that condition in to stop short cycling the compressor if someone was to walk in right as it turned off.

From the error it seems that your sensor state may have the unit added to it by the device. You may need to use a template condition instead of a numeric state condition to work around that.

Can you post the output for your sensor(s) from the Developer Tools > States tool?

First time trying to upload a screen shot. Hopefully that worked.

You posted a screenshot for:

sensor.computer_room_temperature

However, the error message refers to a different entity:

sensor.computer_room_motion_air_temperature

We need to see a screenshot of that one.

My apologizes. I forgot there is a nest sensor in that room as well. Here is the motion air temperature…