Announcement

Collapse
No announcement yet.

JSON with Tasker knowledge

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

    JSON with Tasker knowledge

    I'm using Tasker and HTTP Get with the JSOn command to get a status of the device as of Server Port: http://192.168.0.17:8017
    Path: JSON?user=aaaaaaaa&pass=xxxxxxxx&request=getstatus&ref=2249

    What would the next command to get the status of the device in the "Flash" command. I'm not 100% sure but before I upgraded to HS3, I think I was able to get the status of it using the javaScriptlet.

    #2
    Should be something like the following javaScriptlet:

    Code:
    var status = JSON.parse(local('http_data')).Devices[0].status;
    setGlobal("%Status", status);
    var value = JSON.parse(local('http_data')).Devices[0].value;
    setGlobal("%Value", value);

    Then you can use Tasker variables %Status and %Value as needed.

    Comment


      #3
      I'm sure I'm missing something stupid, unfortunately the flash %status return %status, I know the http get before the javascriptlet is working fine because when I put the flash text %HTTPD it returns the entire device structure. Thank you for your help.
      Attached Files

      Comment


        #4
        Case is important with Tasker variables.

        First letter should be uppercase as bolded below.
        setGlobal("%Status", status);

        Comment


          #5
          Click image for larger version

Name:	Screenshot_20201211-145901_Tasker.jpg
Views:	68
Size:	66.5 KB
ID:	1440074

          Click image for larger version

Name:	Screenshot_20201211-145921_Tasker.jpg
Views:	66
Size:	26.1 KB
ID:	1440075

          Comment


            #6
            Sorry to bug you more with this, I changed it as well with different settings, still getting the same results. Here all all my screenshots, I know the first query works 100%. Sue to the user and password, I included the query here

            HTTP Get
            Server Port https://connected.homeseer.com
            Path
            JSON?user=xxxxxx&pass=xxxxx&request=getstatus&ref=2187

            Thank you
            Attached Files

            Comment


              #7
              That looks correct. Try adding a new step after your first action to flash the contents of %http_data to confirm

              Click image for larger version

Name:	20201213_010233.jpg
Views:	57
Size:	80.5 KB
ID:	1440332

              Comment


                #8
                Thank you again, I think I have it figured out, I was using http get instead of request, could you please post the first statement of your http request?

                Thanks

                Sent from my SM-G973U1 using Tapatalk

                Comment


                  #9
                  Originally posted by alphatech View Post
                  could you please post the first statement of your http request?

                  Thanks

                  Sent from my SM-G973U1 using Tapatalk
                  Sure. Here it is.
                  Click image for larger version

Name:	Screenshot_20201213-140721_Tasker.jpg
Views:	49
Size:	44.8 KB
ID:	1440456

                  Comment


                    #10
                    From within the network, that worked great, thank you. How would I do the query that uses connect2 from outside my network using user name and password?

                    Sent from my SM-G973U1 using Tapatalk

                    Comment


                      #11
                      Actually I got it, I was looking at your exemple and I figured it out. Thank you again for all your help.


                      Sent from my SM-G973U1 using Tapatalk

                      Comment


                        #12
                        You are welcome! Glad you got it working.

                        Comment

                        Working...
                        X