Outlet control based off temperature sensors?

I have 2 attic fans that I am hoping to have automatically turn on outside of the built in thermostat controls.

My goal is to have the outlets they are connected to setup to turn on specifically when the attic temperature exceeds the outdoor temperature, and continues running until the attic temperature drops below the outdoor temperature.

I also want to be able to select a 3 hour block of time when our utility rates are at peak that they automatically turn off on M-F but no restrictions on Sat and Sunday.
I’m not a programmer, and I was wondering if anyone has an idea how this could work?

I was looking at a Zigbee hub, 2 zigbee thermometers and 2 zigbee smart plugs but once I get them in my hands I don’t know where to go to achieve this.

Any help would be greatly appreciated.

This topic might have some models for comparing temperatures.

Hi, @hntmor
Here’s an example using another capability but I think this provides a good starting point.
The way this one works is:

  1. There are three virtual dimmer-switch devices (S1,S2,S3)
  2. If the switch level on S1 is set and it’s greater or equals to than the current level on S2
  3. Then, turn S3 on
  4. Otherwise, it will turn off
{
    "name": "condition based on another device",
    "actions": [
        {
            "if": {
                "greaterThanOrEquals": {
                    "left": {
                        "device": {
                            "devices": [
                                "S1"
                            ],
                            "component": "main",
                            "capability": "switchLevel",
                            "attribute": "level"
                        }
                    },
                    "right": {
                        "device": {
                            "devices": [
                                "S2"
                            ],
                            "component": "main",
                            "capability": "switchLevel",
                            "attribute": "level"
                        }
                    }
                },
                "then": [
                    {
                        "command": {
                            "devices": [
                                "S3"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "on"
                                }
                            ]
                        }
                    }
                ]
            },
            "else": [
                {
                    "command": {
                        "devices": [
                            "S3"
                        ],
                        "commands": [
                            {
                                "component": "main",
                                "capability": "switch",
                                "command": "off"
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

You can use the Advanced Users App to create this Rule, but based on your case, it would look more like this:

Make sure you replace the text like “attic sensor ID” with the real device ID which you can also see in the Advanced Users App (devices section)

[
    {
        "if": {
            "greaterThanOrEquals": {
                "left": {
                    "device": {
                        "devices": [
                            "attic sensor ID"
                        ],
                        "component": "main",
                        "capability": "temperatureMeasurement",
                        "attribute": "temperature"
                    }
                },
                "right": {
                    "device": {
                        "devices": [
                            "outdoor sensor device id"
                        ],
                        "component": "main",
                        "capability": "temperatureMeasurement",
                        "attribute": "temperature"
                    }
                }
            },
            "then": [
                {
                    "command": {
                        "devices": [
                            "Fan 1 device Id", "Fan 2 device Id"
                        ],
                        "commands": [
                            {
                                "component": "main",
                                "capability": "switch",
                                "command": "on"
                            }
                        ]
                    }
                }
            ]
        },
        "else": [
            {
                "command": {
                    "devices": [
                        "S3"
                    ],
                    "commands": [
                        {
                            "component": "main",
                            "capability": "switch",
                            "command": "off"
                        }
                    ]
                }
            }
        ]
    }
]

About this, do you mean to use how much you’re spending based on your energy consumption?

1 Like

I do basically the same thing, but different use case. I do not want my garage do drop below freezing in the winter, so I use SmartThings automations to turn a WiFi plug (with heater connected to it) on or off based on temperature. My WiFi plug is Globe and I am using the Temp Sensor (Smart Meter Plus) & Hub from Switchbot. I also have my automations setup to observe peak/non peak rates.