Announcement

Collapse
No announcement yet.

Flume Intelligent Water Sensor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mterry63
    replied
    Originally posted by rdc View Post
    Would you mind expanding this event so I can see how it is clicked in on Hs4 thanks
    I'm using Easy Trigger to add 2 device values together and storing in a device.

    Click image for larger version

Name:	Untitled.png
Views:	274
Size:	15.5 KB
ID:	1420494

    Leave a comment:


  • rdc
    replied
    Would you mind expanding this event so I can see how it is clicked in on Hs4 thanks
    Attached Files

    Leave a comment:


  • rdc
    replied
    {"queries":[{"request_id":"1","bucket":"HR","since_datetime":"${str15 72} ","until_datetime":"${str1573}"}]}


    I just cut and pasted this from your instructions but it does not work. Error is malformed Json

    Leave a comment:


  • mterry63
    replied
    I'm not sure I understand what you're asking for. The events are posted above in full. All they are doing is creating daily and monthly totals by adding the hourly total. They are just adding two devices together.

    From the debug you posted, it doesn't appear you're getting the authentication token from flume. You can't possibly be getting valid data from them without an authentication token.


    Sent from my Pixel 2 using Tapatalk

    Leave a comment:


  • rdc
    replied
    Would you mind showing how you set the last 3 events. The line that says "set device event engine program" How is this done please

    Leave a comment:


  • mterry63
    replied
    Something is wrong with the request you sent to flume, you should get success:true. Flume returned request has malformed JSON, so check that JSON (between the curly braces) carefully. I can't see anything that jumps out. Did you set the Big5 header to send content-type: application/json?

    Leave a comment:


  • rdc
    replied
    I was able to get all the numbers and items you listed but running the Big 5 give many errors. I have a total of 6 devices so far. And I cant finish the last 3 events because I cant figure out how to set device event program etc.
    Attached Files

    Leave a comment:


  • mterry63
    replied
    Post what you got from the steps in post # 20 above, after you have filled out the data in https://flumetech.readme.io/reference and get a JSON response. Doesn't seem like you are performing that step correctly. You shouldn't get any errors in Big5.

    Leave a comment:


  • rdc
    replied
    I dont get a user id under payload data like you said Whether I use my access token or yours it doesnt matter
    Attached Files

    Leave a comment:


  • devoir
    replied
    Many thanks for the explanation. I kinda though it might be a pulse counter I didn't realize it had that kind of sensitivity since it's strapped to the housing

    Devoir

    Leave a comment:


  • Wade
    replied
    Originally posted by devoir View Post
    What are the physics of how this device works? I really like this idea but how is it recording the flow? What sensor does it use for counting?


    PS thanks for the work on the plug-in

    Devoir
    I have this device on my utility-supplied water meter. It's a simple pulse counter. If your meter doesn't have pulse capability then a secondary meter can be added with some relatively simple plumbing, but at that point you might want to go a different route and not be dependent on--and limited by--Flume's cloud implementation.

    I have a secondary meter on my in-house water (installed in the garage next to my water softener) with a sonoff basic providing pulse feedback to HS. If I could, I would go this route for the primary meter rather than use Flume, but location prevents it. Between the two devices I can monitor house, irrigation and total usage.

    Leave a comment:


  • devoir
    replied
    What are the physics of how this device works? I really like this idea but how is it recording the flow? What sensor does it use for counting?


    PS thanks for the work on the plug-in

    Devoir

    Leave a comment:


  • rdc
    replied
    Can you show a screen shot of the devices you get in Homeseer. Thanks

    Leave a comment:


  • mterry63
    replied
    Just a quick update if anyone plans to follow my example - I found a logic error in the process. The event "Update Monthly Water Usage" should be set to execute after the last query of the day, which is 00:10 in my example. I had it set to midnight, which moved the previous day's last hour usage to the next day. The fix is to execute the event after 10 minutes after the hour, so I set it to execute 15 minutes after midnight instead of midnight.

    Came across this comparing the app totals to mine.

    Leave a comment:


  • mterry63
    replied
    OK, I've got the flume API data into HomeSeer. Here are the steps I took.

    First, you'll need to get an API key at https://portal.flumetech.com/settings bottom of the page

    Click image for larger version  Name:	1.png Views:	0 Size:	20.9 KB ID:	1404039

    Copy the Client ID and Client Secret.

    The easiest way to collect the rest of the data needed is at the flume documentation site, https://flumetech.readme.io/reference

    Scroll down to "Get Token" and fill in the form requirements:

    Client_id - copied from flume portal
    Client_secret - copied from flume portal
    Username - your portal sign up email
    Password - your portal password

    Click the "Try it" button next to https://api.flumewater.com/oauth/token

    Click image for larger version  Name:	2.png Views:	0 Size:	6.2 KB ID:	1404040

    In the grey box to the right of the button you should see the returned output. Make sure it says "success": true

    Click image for larger version  Name:	4.png Views:	0 Size:	29.1 KB ID:	1404043

    Copy the access token in quotes, a long string like this:
    eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODk wIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJ SMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

    Head over to https://jwt.io/#debugger-io

    In the box that says "paste a token here" paste in the access token.
    Under payload: data in the right, look for user_id: xxxxx a number. In my case it was 5 digits
    Copy the user_id
    Close this page, we don't need anything else.

    Go back to the Flume documentation page and scroll down to "Fetch Users Devices"
    Fill in the form:

    User_id - you just got that

    Click the "Try it" button next to https://api.flumewater.com/users/user_id/devices

    This time a popup will appear that says the bearer token is required. Paste the copied bearer token from above (the long string) and continue.
    In the output to the right, look for the device id of type 2

    "id": "6248148189204194987",
    "bridge_id": "6248148189204194444",
    "type": 2,

    Copy the "id" on the first line, not the bridge id. In this case the line ending in 987

    Now you have all the static information you will need to query water usage. On to HomeSeer setup.

    Here's where you have to make some decisions. I decided I only want hourly usage data. I created the following virtual devices:

    WaterMonthlyUsage - Holds the monthly total gallons, calculated from daily
    WaterDailyUsage - Holds the daily total gallons, calculated from hourly
    FlumeStartDate - Holds the query start date/time string, calculated by event
    FlumeEndDate - Holds the query end date/time string, calculated by event

    The remaining devices will be created by Big5 when executing events.

    Big5 Setup:

    I created 2 HTTP profiles

    Flume-Auth-Init
    FlumeQueryData

    Click image for larger version  Name:	5.png Views:	0 Size:	69.7 KB ID:	1404044

    Screenshots of Big5 don't show all the details, so here is how I filled out the form:

    URL: https://api.flumewater.com/oauth/token
    Request/response body: {"grant_type":"password","client_id":"YOURCLIENTID","clie nt_ secret":"YOURCLIENTSECRET","username":"YOURFLUMEPORTALUSERNA ME","password":"YOURFLUMEPASSWORD"}
    Extra headers: content-type: application/json
    Device Name Expression: FlumeAccessToken && FlumeRefreshToken
    Device Value Expression: JSON(input,"data[0].access_token") && JSON(input,"data[0].refresh_token")

    My device name expression wasn't quite right, showing my lack of experience with Big5, but it created the 2 devices and I just renamed them manually
    The device value expression was critical, and that is right.

    I created a manual event to execute this profile in Big5.

    Click image for larger version  Name:	6.png Views:	0 Size:	26.1 KB ID:	1404045

    And then ran the event, it created 2 devices, 1 with the bearer/authorization token, and 1 with the refresh token. I just renamed them FlumeAuthToken and FlumeRefreshToken. You will need the device reference numbers later, so make note of those.

    Next I created events to generate the start and end query datetime strings. I'm a lazy (read poor) programmer, so I chose to create the 2 strings by generating 1 before the top of the hour and 1 after so the Now() function lined up with my needs. I'm sure this could be improved on. It's critical that these device strings are correct when the query event is executed. That's why I set the start date event at 55 minutes after the hour, the end date event at 5 minutes after the hour, and the query at 10 minutes after the hour. These could be tightened up to query the data closer to the hour, but I don't know how long it takes the device to update.

    Set Water Consumption End Date - Executed 5 minutes after every hour, creates the end date string used by the Big5 FlumeQueryData profile to set which hour of data is requested. The string is held in the device FlumeEndDate, device reference number 1573.

    Click image for larger version  Name:	7.png Views:	0 Size:	31.4 KB ID:	1404046

    Set Water Consumption Start Date - Executed 55 minutes after every hour, creates the start date string used by the Big5 FlumeQueryData profile to set which hour of data is requested. The string is held in the device FlumeStartDate, device reference number 1572.

    Click image for larger version  Name:	8.png Views:	0 Size:	33.5 KB ID:	1404047


    Water Consumption Data

    The flume query data returned looks like this. You can read details in the documentation portal from before under "Query a User's Device". Since I'm querying for hourly data and only 1 hour, I only get 1 data point back. This is in JSON format. If you need to make changes, I would recommend Notepad++ and the JSTool plugin, it will help you format and understand the data.

    {
    "success": true,
    "code": 602,
    "message": "Request OK",
    "http_code": 200,
    "http_message": "OK",
    "detailed": null,
    "data": [
    {
    "1": [
    {
    "datetime": "2020-07-16 15:00:00",
    "value": 4.64374118
    }
    ]
    }
    ],
    "count": 0,
    "pagination": null
    }


    Next I created the second Big5 HTTP profile to run each hour to get the water consumption data.


    Click image for larger version  Name:	9.png Views:	0 Size:	77.9 KB ID:	1404048

    Fill in the form like this. Be sure to replace the 2 variables in the URL and device reference numbers in the body:

    URL: https://api.flumetech.com/users/YOUR...DEVICEID/query
    Request/response body: {"queries":[{"request_id":"1","bucket":"HR","since_datetime":"${str15 72} ","until_datetime":"${str1573}"}]}
    Extra headers:
    content-type: application/json
    authorization: Bearer ${str1569}
    Device value expression: JSON(input,"data[0].1.[0].value")

    Note: str1572 is the reference number of FlumeStartDate device, str1573 is the reference number of FlumeEndDate device, str1569 is the reference number of FlumeAuthToken

    Cut and paste may be the best way to deal with most of this. Any mistakes will cause the query to fail.

    Query Events and Device Updates.

    Here are the events I created to get the data hourly and increment or reset the various devices as needed.

    Flume Query Hourly Water Usage - executed hourly to update hourly water usage. The event also updates the WaterDailyUsage by adding WaterHourlyUsage to WaterDailyUsage

    Click image for larger version  Name:	10.png Views:	0 Size:	37.2 KB ID:	1404049

    Reset Water Monthly Usage - Reset the monthly water usage counter to 0 at the beginning of each month.

    Click image for larger version  Name:	11.png Views:	0 Size:	30.3 KB ID:	1404050


    Update Monthly Water Usage - Executes daily to add WaterDailyUsage to the WaterMonthlyUsage device and reset the daily usage to 0.

    Click image for larger version  Name:	12.png Views:	0 Size:	32.5 KB ID:	1404051


    I added all the devices for hourly, daily, and monthly consumption to Device History, so I could graph the usage.

    Todo: The auth/bearer key is good for 7 days. I/You will need to schedule the manual Auth init event to run weekly, or build a new Big5 profile to use the refresh key. Honestly I don't know why you would use the refresh key process since generating the bearer key works over and over.

    Hope that helps anyone who wants to integrate this device in HomeSeer. It sounds more difficult on paper than it is. I'm happy to answer any questions I can.












    Leave a comment:

Working...
X