Nest and nest.set_mode

Hello all,

I am having problems with the nest.set_mode service in Home Assistant. When I use the service dev tool and select nest.set_mode as the service and { “home_mode”: “away” } as the service data, it works perfectly. When I put the same thing into an automation it does nothing.

action:
- data:
    home_mode: away
  service: nest.set_mode

What am I doing wrong?

Thanks

Nothing obviously wrong with the snippet of code from the automation that I can see. Are there any errors or debug info in the log that might help? Have you tried manually triggering the automation? Maybe it’s the trigger and/or condition that is preventing it from running when you think it should?

Not sure nest.set_mode would I use a different method that has been going for solid for a couple of years now.

https://github.com/SilvrrGIT/HomeAssistant/blob/master/automation/nest.yaml#L38

The Nest component does register a nest.set_mode service, which works on structures, which is in addition to the services registered by the climate component:

Interesting, thanks. I think this change went out around the 0.72 release. I’m on 0.72.1 and my automation are still working.

Actually, I’m still on 0.69.1 and this service was present back then. It’s not really a “change” - it’s just a way to specify away/home per a structure as opposed to a thermostat, etc. Of course, within a Nest location, they’re obviously related. I.e., I think you can set home/away for either the structure or thermostat (and possibly other entities, like camera, smoke detector, …) and it applies to all. So, not surprising your automations still work. :slight_smile:

1 Like

Thank you for the responses. Sorry it took me so long to reply. Been busy. Anyway, it hasn’t worked all week and I just looked and it is in away mode. Don’t think I did anything but post to the forum. Must be magic.

By the way, the way I understand it is when you put the “structure” in away mode, then the whole nest eco system goes into away mode and you can set the individual nest pieces to react or not react to away / home mode. Sound correct?

Did you turn off the next location features and automatic home/away modes? Out of the box I believe it will use the app on your phone to track your location and update as needed. This is combined with the motion sensor on the actual thermostat.

I have all of this turned off and just use HA to do the automating.

I believe that is exactly what I did. Home Assistant should be doing all the work :slight_smile:

Ha…I just checked again and now the app reports home???,

From the app, I have

Home/Away Assist = off
Auto-Schedule = off
Early-On = off

Then the automations I linked earlier controlling it. I struggled with HA and the thermostat fighting each other for awhile, then I just disabled all the nest features for home/away and schedules and it has been rock solid.

Which settings are for the house? The gear icon top right when you first open the app. And which are for the thermostat?

Those are all for my thermostat.

Yes. But don’t say “eco” unless you mean “eco” (as in eco mode :wink:)!

FWIW, I never change home/away mode. It’s always in home mode. And I, too, disable Nest’s automatic setting of home/away. But I do use Nest’s temperature schedule. Basically, for my thermostat, the only thing I do from HA is to turn ECO mode on and off. (And, by turning it off, I mean changing back to the previous mode it was in before I turned ECO mode on.) I figured I paid a lot of money for this smart thermostat - I might as well make the most of what it’s good at.

For my Nest Cam I don’t use Nest’s scheduling. Rather, I decide when to turn the camera on and off from HA, because in my configuration, it’s more complex than just whether or not someone is home.

So yea, cameras is what I am gearing up for. Mind sharing what you are doing? My thinking was using the home / away to stop all recording when everyone is home and then get into specifics camera by camera.

I have two cameras. One is a Nest Cam, and the other is an Amcrest IP camera. I can control a lot more with the Amcrest. With the Nest Cam I can either turn it on or off, that’s it. (And I used to have to do that with a custom component I wrote. But now that’s been added to the released component.) But whether or not I’m recording (with both cameras) involves presence, time of day, etc. It’s a bit complex. But, bottom line, I’m controlling the Nest Cam’s recording/idle mode via HA, not with Nest’s Home/Away or with Nest’s camera scheduling.

Nest Cam is using structure’s away mode as well. It will send the motion detected notification when mode set to away.

There is only one ‘away’ mode in Nest API actually, HA just exposure it in two services. I extended nest.set_mode service to accept eta parameter, which will be useful if you need your thermostat wake up before you arrive home.

So, the code from the Home Assistant website:

set_nest_away:
  sequence:
    - service: nest.set_mode
      data:
        home_mode: away

Is different from mine. It has:

set_nest_away:
  sequence:

Wait, I wonder if away is being changed to true/false. Try what you did originally, but put away in quotes:

action:
- data:
    home_mode: 'away'
  service: nest.set_mode

That may be it. It works when I manually activate the trigger. Hopefully tomorrow when everyone leaves it will work on it’s own. Will the single quotes survive a save through the automations editor since I entered them directly into the automations.yaml?