Examples:
-
SELECT
Select one value from your database in the THEN part of your flow:
Use the flow trigger in the IF part of your flow to receive the first value of the result.
You can use the Query-ID used in the SELECT above to filter your flow (react only on this kind of query).
Use the value in your flow. Take a look at the local flow tags you can use:
Use the first valus as number or text, write the complete JSON result to the timeline or what ever you need
-
INSERT / UPDATE
Insert a line into your database. This way you can periodically log capabilities.
Use a trigger to execute the query:
Insert your query and use global tokens or the date variable. This way itβs possible to log a daily sum at a new day using the date of yesterday:
If needed you can print your result in the timeline:
-
Combining SELECT & INSERT
If you have only a meter capability and want to log the hourly usage, you can first select the last meter value from your database and insert a new line with meter and calculated usage value.
1st: SELECT the last value.
Start the flow every hour. Set a Query ID to be able to react in a trigger only on that selection. Read the newest value from meter column.
2nd: Use this value in a second flow to insert a new line:
Use the Query ID as filter for the flow trigger. Insert a line with date/time, the calculated difference (current meter minus flow token containing the result of your SELECT) and the new meter value.