If you’re just looking to trigger a rule based on different days of the week, you can do this with the Time Trigger. See the screenshots two posts up – you can tap the ‘Everyday’ in my screenshot which brings up the Repeat Options. From here, you can select ‘weekly’ and choose which days of the week you want to trigger things on.
Do you have any weather devices attached to your SmartThings account? If so, do they not include the data you’re looking for?
Do you have any weather devices attached to your SmartThings account? If so, do they not include the data you’re looking for?
I have an outside temperature sensor, but it doesn’t show the weather. The easiest way would be to extract data from the integration with https://openweathermap.org/ and on their basis set constant variables, such as the current weather forecast, humidity, temperature, etc.
Thanks. I suspected there was more than just the ‘variable’ part of things. It sounds like some controls around formatting the dates would be important in that case too.
Can you share some examples of how you format these date/timestamp variables today? It seems like it could be something that would feel overwhelming to a new user… but perhaps it’s just more of an ‘advanced’ feature and naturally requires a bit more configuration if you want to customize the format.
Currently in Homey Bridge I have one date format and I accept it as it is DD.MM.YYYY you can define 2 or 3 formats permanently in the settings or for very demanding users make 3 variables
current day (e.g. 20), current month digitally or in words (08) and current year 2022 and you can write in the notification
E.g. “Hey, it’s {day}. {Month}. {Year}, current weather: it’s raining”
Similarly, with the time we are from different parts of the world, some use 24 hours, others AM / PM
You can do this with the HTTP Action in SharpTools today. I agree that it makes for a good feature request as a native integration though to simplify this process for people who don’t have weather devices attached to their SmartThings.
Let’s take the Open Weather /weather endpoint which provides the current weather. The URL is in the format:
So if we wanted to get the main weather report, we would be looking for the weather.0.main element in the response. So we can make the HTTP call and then get the response data using Context Variables (Response > HTTP > Data) and use the object property notation to grab that nested property for use in our notification:
Thanks for the feedback. In our Super Tiles, since they are running in the browser, we can infer your ‘locale’ and use that to display things in the timezone and format your computer / tablet prefers.
For Rules, we typically associate things with ‘locations’ since some people have multiple locations attached to their account – for example, their main home and a vacation home. We use that for determining the appropriate localized time for triggering rules. I suspect we could either add user-level or location-level formatting options. Originally I was thinking you might want a rule action like Format Date where you could customize the date for that particular notification just to pull out the parts you are interested in (similar to our Super Tile date/time format options).
My apologies for not being clear – I was just trying to better understand the use-cases. We don’t have it available as Rule Variables today, but if we eventually build it I want to make sure I understand how people use it so we can make the right design.
Generally, it is about notifications in which you can use the date, sometimes in simple such as hello is a day, and sometimes in emergency such as “At 12:00 on August 20, 2022, a movement in the garage has been detected”
The weather works perfectly, I take the data I need from the API, you are great!
I was able to download weather.0.description from the data, but I would like to download the temperature data in the same query and how it adds main.0. temp is unfortunately nothing changes in variables, can you tell me what am i doing wrong?
All in all, it’s good to describe it and everyone who has a problem with virtual weather stations, which will not work easily on EDGE, can do something like this by themselves, all you need is CRON, Weather API, @josh friend and done
In object property property notation, each ‘child’ property is accessed with a . and arrays are normally accessed with brackets [n] where n is the index (0 based) of the item.
We could get the list (array) of colors as animal.colors but if we only wanted to get the first color, we would normally access it as animal.colors[0] and if we wanted the second color we would use animal.colors[1] (remember that indexes are 0 based with JSON objects)
Hopefully that arbitrary example helps explain and doesn’t just make things more confusing.
Also think we need variable and not a trigger
In this piston and other piston, I’m using a variable to be sure I execute the command once a day, So I compare a variable with a number with sysdate
For that particular use case, you can use a True/False variable. Create one rule that resets the variable to False at 00:00 every day. Then in your other rule that you only want to run once per day, you can add an IF Condition to only run if the variable is False and then set the variable to True within THEN part of the condition.
I wanted to a share a workaround that might be sufficient until we get a chance to build this as a first-class feature in the Rule Engine.
Update: Math / Date Expressions are now available as a native feature. You can use the syntax noted below directly in an expression without having to use the Lab environment.
We have a Lab environment which has some endpoints that can be called using the HTTP Action in the Rule Engine and you can get the results using context variables. The /date endpoint can be used with an optional timezone (IANA format) and optional locale parameter to customize the output.
context.response.data.formatted = "The Year is 2022 and the month is August"
Note that if you are using more complex formats with spaces and such, you will either want to URL encode them or you can even use a POST request to send the parameters across.
The formats are YYYY-MM-DD or MM-DD. By default, the endpoint will ignore the year – this enables the same condition to continue to work year after year without needing to update the rule. You can include the flag &includeYear=true if you want to restrict to a specific year.
The main property you would look for in the response is result which is a true/false indicating if it’s currently between the specified date range.
You could use this with a rule that has a Time trigger to run every day and checks this endpoint to determine if it matches your range to decide if you want to run the rest of the rule or not.