Nest + Dark Sky Automation Help

I am having some weird issues with a Nest/Dark Sky automation. To explain…

If the temperature hits below a certain threshold (in my case, 55F), then turn on my Nest thermostat to 71F. Unfortunately for some reason it isn’t working.

I did search the forums, and the closes thing I got to finding a solution was this. Not 100% sure how this would tie in or if I am missing something else though.

Code is here:

- id: temp-below-55F-Heat-71F
  alias: "If the temperature falls below 55F, turn the heat to 71F"
  trigger:
    platform: numeric_state
    entity_id: sensor.dark_sky_temperature
    below: 55
  action:
    - service: climate.set_temperature
      data:
        entity_id: climate.living_room
        temperature: 71
        operation_mode: Heat

Hoping for any help but also an explanation so I can figure out how to do this in the future :smiley:

So after browsing the code, I’m pretty sure the Nest climate platform ignores operation_mode in the climate.set_temperature service. Also, I’m pretty sure it wants heat to be all lower case. So you could try:

- id: temp-below-55F-Heat-71F
  alias: "If the temperature falls below 55F, turn the heat to 71F"
  trigger:
    platform: numeric_state
    entity_id: sensor.dark_sky_temperature
    below: 55
  action:
    - service: climate.set_operation_mode
      data:
        entity_id: climate.living_room
        operation_mode: heat
    - service: climate.set_temperature
      data:
        entity_id: climate.living_room
        temperature: 71

Also, this automation will trigger at startup of sensor.dark_sky_temperature’s state evaluated as a number is below 55. After that, the value has to rise to 55 or above, and then dip below 55 before it will trigger again.

One way to test an automation is to manually trigger it. That will cause the action(s) to run unconditionally. If that works but the automation doesn’t seem to run when it should, then the problem is the trigger (or condition, if there are any.)

@pnbruckner

I love you, and I hate YAML sometimes :smile: That worked like a charm!
What confuses me slightly is that the documentation lists it as an operating function, but its fine. I am just glad to finally get it working.

Thank you!

Well, to be fair, this isn’t "YAML"s fault. :wink: The climate “component level code” (meaning the part that is common to all climate entities) defines an API, and that’s what is documented, but it’s up to the “platform level code” (like Nest, Ecobee, etc.) to decide how they want to implement it. Whoever wrote the Nest climate platform code went the easy route. The implementation of the set_temperature service, IMHO, should change the operation_mode if that optional parameter is supplied. Or maybe it’s just a “legacy” (backward compatibility) option – i.e., maybe at one time the set_operation_mode service didn’t exist as a separate thing and was later “split out”, but to not break existing automations with existing climate devices they left the option in the set_temperature service. I don’t really know; haven’t been using HA all that long.

In any case, I’m glad you got it working! :slight_smile: