0

I'm trying to set up automation via the script editor, a new Google feature. My goal is for the script to turn off the AC when the temperature, as detected by a sensor on my balcony, exceeds a certain value and the balcony door is open.

Here's the condition I wrote for the temperature sensor:

condition:
    type: device.state.TemperatureControl
    state: temperatureAmbientCelsius
    greaterThan: 24
    device: WiFi Temperature & Humidity Sensor - Balcony

However, when I validate, I get the following error:

[device.state.TemperatureControl] is an unknown type name. Expected types: [and, or, not, time.between, device.state... (truncated for brevity)].

Interestingly, a similar condition works for humidity using HumiditySetting:

condition:
    type: device.state.HumiditySetting 
    state: humidityAmbientPercent
    greaterThan: 55
    device: WiFi Temperature & Humidity Sensor - Balcony

It seems TemperatureSetting is reserved exclusively for thermostats. However, there's a note in the documentation:

Sensors that report data covered by another trait should use that trait with the queryOnly* attribute for that trait set to true. For example, temperature sensors should use the TemperatureControl trait with the queryOnlyTemperatureControl attribute set to true.

I'm unsure how to set this attribute in the script editor. Any guidance would be appreciated.

Vasya
  • 1
  • 1
  • Have you guys tried the following by any chance , condition: type: device.state.TemperatureSetting state: thermostatTemperatureAmbient greaterThan: 24 device: WiFi Temperature & Humidity Sensor - Balcony ? – Siddhant Priyadarshi Aug 14 '23 at 21:29
  • yes, I tried it. if I select device.state.TemperatureSetting then I can only set a thermostat (AC) as a device, however, I need to make it work for a temperature sensor – Vasya Aug 15 '23 at 09:29
  • I ran into the exact same issue and I don't think there's a solution right now. I'm hoping someone just needs to update a code validator somewhere. device.state.TemperatureControl seems to be the right struct. It appears to be the same as the one described here: https://developers.home.google.com/cloud-to-cloud/traits/temperaturecontrol. "Trait for devices (other than thermostats) that support controlling temperature, either within or around the device. This differs from the TemperatureSetting trait, which is specifically for thermostat-style controls." – MadReasonable Aug 27 '23 at 15:34
  • Here's a Google Nest Community discussion. I've linked directly to the most relevant comment. https://www.googlenestcommunity.com/t5/Home-Automation/Let-s-discuss-creating-powerful-automations-with-our-new-script-editor/m-p/469421/highlight/true#M21063 – MadReasonable Aug 27 '23 at 15:38

0 Answers0