cancel
Showing results for 
Search instead for 
Did you mean: 

Script Editor - starter based on comparison between two devices' values

fabiomolinar
Community Member

Hi everyone,

I am trying to start an automation based on the values of two temperature sensors. Let's call them Device A and Device B. I want to get a notification when temperature at Device A is greater than or equal to the temperature at Device B.

Currently, I can only assign fixed values to the greaterThanOrEqualTo field. It would be great if instead I could set this field to the value from another sensor. 

See pseudo-code below of what I would like to see working:

metadata:
  name: Temperature Alert - Send Notification
  description: If Temp A > Temp B, send a notification and turn the lock on.
automations:
  - starters:
      - type: device.state.TemperatureControl
        device: Device A
        state: temperatureAmbient
        suppressFor: 20hour
        greaterThanOrEqualTo:
device: Device B
state: temperatureAmbient actions: - type: home.command.Notification title: Temperature Alert! body: Temp A > Temp B

 

In the code above you can see that instead of assigning a fixed value to greaterThanOrEqualTo field, it's defined as a Struct.

2 Recommended AnswerS

GoogleDevForum
Solutions Expert
Solutions Expert

Unfortunately, Google Home Automations Script Editor does not currently support comparing dynamic values between two devices directly, like you're trying to do with greaterThanOrEqualTo referencing another device’s state.

I recommend submitting a feature request via Google Issue Tracker. The more visibility and feedback this feature gets, the more likely it is to be considered in future updates. Please share the issue ID here.
Screenshot 2025-07-18 at 12.33.05 PM.png

View Recommended Answer in original post

Thank you for confirming and for suggesting a bug is created. Just did that. Bug id 433073111 created. Thank you.

View Recommended Answer in original post

2 REPLIES 2

GoogleDevForum
Solutions Expert
Solutions Expert

Unfortunately, Google Home Automations Script Editor does not currently support comparing dynamic values between two devices directly, like you're trying to do with greaterThanOrEqualTo referencing another device’s state.

I recommend submitting a feature request via Google Issue Tracker. The more visibility and feedback this feature gets, the more likely it is to be considered in future updates. Please share the issue ID here.
Screenshot 2025-07-18 at 12.33.05 PM.png

Thank you for confirming and for suggesting a bug is created. Just did that. Bug id 433073111 created. Thank you.