Alf Tupper
Alf Tupper

Reputation: 1

Trying to write a string to return a value from a device in Google Home Script Editor

I have been trying to figure this out for most of today and not getting anywhere fast... Would appreciate it if anyone could help and get me on the right track. I want to switch on my intake fan for my garage based on whether the RH% of the first sensor is greater than the second.

Below is what I have so far:

metadata:
  name: Intake Fan On/Off
  description: Intake fan to be on only when sensor 1 RH% is greater than sensor 2 RH%

  starters:
    - type: device.state.HumiditySetting # For devices that support humidity settings such as humidifiers and dehumidifiers.
      device: Workshop Sensor 1 - Workshop
      state: humiditySetpointPercent
      greaterThan:
        [
          ('device.Workshop Sensor 2 - Workshop') 'state.humiditySetpointPercent',
        ]

  actions:
    - type: device.command.OnOff # Turn the device on or off.
      # Whether to turn the device on or off.
      on: true
      devices: Intake Fan - Workshop

I keep getting the error below and I can't work out how to correctly write the string to return a value.

The value should be one of [String, Bool, Number, Temperature, ColorTemperature, DateTime, Time, Weekday, Duration, ColorHex] but is [Array] instead. The expected formats for time string are [HH:MM:SS; HH:MM; HH:MM AM/PM; HH AM/PM; sunrise/sunset]. The expected formats for duration string are [HHhMMm; HHhMMmSSs; HHhoursMMminSSsec; HHhrsMMminutesSSseconds; MMminutes; HHh MMm]. The expected formats for weekday string are [monday; TUESDAY; WED; fri].

Upvotes: 0

Views: 157

Answers (1)

Siddhant Priyadarshi
Siddhant Priyadarshi

Reputation: 486

The "greaterThan" key for "HumiditySetting" state only supports dynamic data type. By dynamic data type, we mean to say that the type of the data of a key is not fixed. It can be one of the primitive data types, based on the values from other fields.

What you are trying to implement in the above script with "greaterThan" key, i.e, referencing other devices relative humidity is not possible. Also, the manner in which you are implementing this, the system assumes you are passing an array data type instead of one of the primitive data types.

I would suggest opening up a feature request in this regard on the Public Issue Tracker so that we can forward it to the internal engineering teams and they can put it on the road map for future developments.

Upvotes: 0

Related Questions