Announcement

Collapse
No announcement yet.

Question re: Flume Water Integration

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

    #76
    It looked to me as if your three queries are for types 1,4, and 16. If you want type 2 (or 8) then add these to the flumewater.pub file.

    The reason for elevating the topic based upon type is so separate HS devices could be created for each type and the latest message would not overwrite prior ones of a different type. Look at the Flume site API to see what info is in each type of notification and then decide which you actually want delivered and then associated with HS Device Features.

    Since it appears the type is a bit-map it may be possible to specify something like type=31 to get multiple types and then would not need multiple queries in the pub file. I have not looked at the API or tried this, but just throwing out ideas.

    Comment


      #77
      Originally posted by Michael McSharry View Post
      It looked to me as if your three queries are for types 1,4, and 16. If you want type 2 (or 8) then add these to the flumewater.pub file.

      The reason for elevating the topic based upon type is so separate HS devices could be created for each type and the latest message would not overwrite prior ones of a different type. Look at the Flume site API to see what info is in each type of notification and then decide which you actually want delivered and then associated with HS Device Features.

      Since it appears the type is a bit-map it may be possible to specify something like type=31 to get multiple types and then would not need multiple queries in the pub file. I have not looked at the API or tried this, but just throwing out ideas.
      Oh interesting. I think I understand. Okay. For now, I just switched to using type 1 for the alert message AND title. I'll look at the docs when I have some time to see what the differences are between the types. Maybe that will help with what I should focus on. For now I'll just use 1.

      Comment


        #78
        Hey Michael. I'm having an issue with the budgets. I added another query to flumewater for type 2 as you suggested. I did get the daily budget, but it doesn't seem to update past the first query request, and I'm not seeing weekly and monthly (I have three budgets). I tried upping the "limit" parameter to 3 thinking that it would return up to 3 budgets, but no luck. I didn't see any errors in the logs, but I'll email it to you in case I'm missing something. Thanks!


        Contents of my updated FlumeWater.pub file:

        Code:
        $$1:
        $$2:
        $$3:
        $$4:
        GET/https://api.flumewater.com/me/notifications=limit=1&offset=0&type=1
        GET/https://api.flumewater.com/me/notifications=limit=3&offset=0&type=2
        GET/https://api.flumewater.com/me/notifications=limit=1&offset=0&type=4
        GET/https://api.flumewater.com/me/notifications=limit=1&offset=0&type=16
        GET/https://api.flumewater.com/me/devices=user=false&location=false​
        I tried adding $$5 after $$4 thinking they were variables but that didn't work either.


        Edit: I did see a couple of 429 rate-limiting errors. Maybe it's because I added the new query? I'm querying every 45 seconds. Maybe I should stick to the 60-second default you established? The timestamps for those indicate it might have been when I tried to trigger a manual update for the budgets...

        I just realized that shouldn't affect the FlumeWater.pub queries. I didn't change the 5-minute interval there, which is where I would be getting the budgets from.

        Also, I changed the alert name from Kids Shower to just Shower, but the messages in the plugin still say Kids Shower. I tried clearing the VSP but no luck - strike this one. I guess since I haven't had another alert come through that's probably why it hasn't updated.

        Comment


          #79
          What I see in the debug, for the last flumewater type 2 is below. I do not see any useful information being returned in the two data items. Seems like type 2 does not provide the desired result. I also notice that the one returned result contains both type 1 and type 2 data. It could be that it queues the request and then sends back all information that was requested.

          Code:
          {"success":true,"code":602,"message":"Request OK","http_code":200,"http_message":"OK","detailed":null,"data":[
          
          {"id":"xxx","type":2,"location_id":yyy,"user_id":yyy,"bridge_id":"xxx","oriented":true,"last_seen":"2022-12-06T18:22:57.000Z","connected":true,"battery_level":"high","product":"flume2"},
          
          {"id":"xxx","type":1,"location_id"yyy,"user_id":zzz,"bridge_id":null,"last_seen":"2022-12-06T18:11:44.000Z","connected":true,"supports_ap":true,"product":"flume2"}],
          
          "count":2,"pagination":null}  ​
          I suggest reaching out to Flume and ask them what query is needed to get the information that you desire. If you get their atttention then the question about using the bitmap (e.g. 31) rather than multiple queries is the desired approach.

          Comment


            #80
            Originally posted by Michael McSharry View Post
            What I see in the debug, for the last flumewater type 2 is below. I do not see any useful information being returned in the two data items. Seems like type 2 does not provide the desired result. I also notice that the one returned result contains both type 1 and type 2 data. It could be that it queues the request and then sends back all information that was requested.

            Code:
            {"success":true,"code":602,"message":"Request OK","http_code":200,"http_message":"OK","detailed":null,"data":[
            
            {"id":"xxx","type":2,"location_id":yyy,"user_id":yyy,"bridge_id":"xxx","oriented":true,"last_seen":"2022-12-06T18:22:57.000Z","connected":true,"battery_level":"high","product":"flume2"},
            
            {"id":"xxx","type":1,"location_id"yyy,"user_id":zzz,"bridge_id":null,"last_seen":"2022-12-06T18:11:44.000Z","connected":true,"supports_ap":true,"product":"flume2"}],
            
            "count":2,"pagination":null} ​
            I suggest reaching out to Flume and ask them what query is needed to get the information that you desire. If you get their atttention then the question about using the bitmap (e.g. 31) rather than multiple queries is the desired approach.
            I see. Okay. Understood. I'll try to reach out to them and report back. Thanks.

            Comment


              #81
              I'm asking Flume support regarding type 2 notifications because they don't seem to match the web portal data (I'm using their API test tool: https://flumetech.readme.io/referenc...-users-devices).

              However when I run the test tool for budgets instead of notifications, I seem to get the right data, but I can't seem to integrate the query into your pub file to get the data.

              This is the query from their tool (device and user ids redacted):
              --url 'https://api.flumewater.com/users/<userID>/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'

              Any ideas?

              Thanks!

              Comment


                #82
                It has a querystring (? starts the querystring) so that adds complexity for mcsMQTT to interpret user intent. There should be info in the debug log that could could email to me that may shed some light. Also confirm it is a GET query using their tool. The returned data will look different than the notification data so what shows up in the Association table will also look different. Assure you are looking at the entire Association table for the returned data. The /users/<userID> can be replaced by /me to look like the other queries in the .pub file.

                Comment


                  #83
                  Originally posted by Michael McSharry View Post
                  It has a querystring (? starts the querystring) so that adds complexity for mcsMQTT to interpret user intent. There should be info in the debug log that could could email to me that may shed some light. Also confirm it is a GET query using their tool. The returned data will look different than the notification data so what shows up in the Association table will also look different. Assure you are looking at the entire Association table for the returned data. The /users/<userID> can be replaced by /me to look like the other queries in the .pub file.
                  I'll email you my latest log. I can confirm they are get queries.

                  curl --request GET \
                  --url 'https://api.flumewater.com/users/user_id/devices/device_id/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC' \
                  --header 'accept: application/json' \​

                  (not including the last line as it has my token)

                  Does "me" also replace the deviceID as well?

                  Comment


                    #84
                    I emailed you the log. FYI: late yesterday I switched the query back to notifications type 2, so you'll want to scan earlier yesterday (sorry I don't have a specific time frame, I was slammed trying to take care of my daughter).

                    Comment


                      #85
                      Btw, this morning I happened to look again at the notifications I get directly from flume (which always end up in my junk folder) and it does look like the daily budget (type 2 notifications) reminders are updating properly using the type 2 query. Maybe type 2 only reports daily budgets? It seems like they run 1x at night. I still want the budget information so I can track the budget in more real-time

                      Comment


                        #86
                        I did a search in your debug for "limit=5" and "sort_dir" and these patterns are not showing up which indicates the commands are not being sent. The same "sendCommand" pattern to flumewater and flumetech exists throughout the entire file from midnight to its end at 6AM.

                        You can enter the URL content starting with the / after flumewater.com in the URL into the Devices Page text box for flumewater URL and use the submit button to send the request one time.

                        Comment


                          #87

                          You can enter the URL content starting with the / after flumewater.com in the URL into the Devices Page text box for flumewater URL and use the submit button to send the request one time.
                          Sorry, but would you mind please clarifying a bit more where you are referring to? Which devices pages text box? Thanks!

                          Comment


                            #88

                            Look back at post 17 on this thread. The screenshot was posted with the flumewater device with textbox and submit button.

                            In the user guide this textbox was referenced as a means to get the device information

                            12.7.1 Water Use Queries
                            Once the tokens have been obtained and the oAuth2 authentication has been setup then one needs to get the identification of the installed equipment. This is done with Fetch User’s Devices from the same page where the token was obtained. Alternately device identification it can can be obtained by entering “/devices?user=false&location=false” in the Submit text box on the HS Devices page for the device created for the flumewater URL.
                            Given the desired query is
                            Code:
                            --url 'https://api.flumewater.com/users/<userID>/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'
                            then the text entered into the Devices page textbox is
                            Code:
                            /users/<userID>/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'
                            
                            or
                            
                            /me/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'

                            Comment


                              #89
                              Originally posted by Michael McSharry View Post
                              Look back at post 17 on this thread. The screenshot was posted with the flumewater device with textbox and submit button.

                              In the user guide this textbox was referenced as a means to get the device information



                              Given the desired query is
                              Code:
                              --url 'https://api.flumewater.com/users/<userID>/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'
                              then the text entered into the Devices page textbox is
                              Code:
                              /users/<userID>/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'
                              
                              or
                              
                              /me/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'
                              Okay. Thanks for clarifying. I was making some erroneous assumptions.

                              Comment


                                #90
                                Originally posted by Michael McSharry View Post
                                Look back at post 17 on this thread. The screenshot was posted with the flumewater device with textbox and submit button.

                                In the user guide this textbox was referenced as a means to get the device information



                                Given the desired query is
                                Code:
                                --url 'https://api.flumewater.com/users/<userID>/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'
                                then the text entered into the Devices page textbox is
                                Code:
                                /users/<userID>/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'
                                
                                or
                                
                                /me/devices/<deviceID>/budgets?limit=50&offset=0&sort_field=id&sort_direction=ASC'
                                I tried as you suggested and replaced the above in the text box and used the submit button for api.flumewater.com but haven't see any changes in the logs or any new items appearing in the association table. I tried reaching out to Flume, but support keeps referring my question to engineering and the response seems to usually be completely disconnected from my original request.

                                Comment

                                Working...
                                X