Create rule that compares temperatures?

Sorry maybe this is not the right topic but is it possible to make a rule if temperature outside is lower than inside than send a push notification. It cant be done with the app…

Not sure if you need an outside sensor, although it would be more accurate for sure, but the rule can compare values of temperatures, which can trigger a virtual switch to have an Alexa notification.
Smartthings push notifications cannot run in rules, one of the few disadvantages of rules compared to routines.

I’ve an outside temperature sensor so thats not a problem. But can you give me an example of the rule that compares two sensors with each other?

Austin described in a post above that you can look how automations look in JSON. So I looked up a rule with a notification in it. What if I copy that, will it work?

No, notifications cannot run in rules. As for copying, basically you need to paste the code in the rule brackets

{
“name”: "your rule name ",
“actions”: [
{ your code here }
]
}

and then you need to filter out metadata, principally “type” “” although sometimes there are others. That’s part of the learning curve, which is pretty easy - I’m no programmer and in a month I have a collection of rules. Find a decent online JSON formatter, there are many, I prefer

but maybe another community member with more experience would recommend another.
As for the rule you need, explain what you want to do exactly, and maybe a community member could help you as they’ve helped me.

2 Likes

You can use the location/temperature as a comparison…

                    {
                        "lessThan": {
                            "left": {
                                "location": {
                                    "attribute": "TemperatureF"
                                }
                            },
                            "right": {
                                "device": {
                                    "devices": [
                                        "your temp sensor device id"
                                    ],
                                    "component": "main",
                                    "capability": "temperatureMeasurement",
                                    "attribute": "temperature"
                                }
                            },

1 Like

If you look at the structure of Rules you can see that comparisons have a left and a right. @mrfitz98 has shown one where the left is the location temperature and the right a temperature sensor device. To compare two devices you simply make the left a device as well.

4 Likes

Thank you all for the explanation. I’ll try this tomorrow!