Announcement

Collapse
No announcement yet.

JSON

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

    JSON

    I thought starting a separate thread would make it easier to consolidate JSON experiences, comments and questions.

    As a first post, here's my issue.

    I'm sending GET requests via an application. When I tested via a Web browser, this would do it:
    http://[HS IP&port]/JSON?request=controldevicebylabel&ref=15&label=Off

    So I translated this for use within my application as :
    GET /JSON?request=controldevicebylabel&ref=15&label=Off[CrLf]

    But this wouldn't work. It took me a few hours to realize that the above statement would need the mandatory HTTP version, so the following did work:
    GET /JSON?request=controldevicebylabel&ref=15&label=Off HTTP/1.0[CrLf]

    This might be old news for Web programmers, but might be usefull for casual users.

    #2
    Alternative to JSON

    I had been using RedTechie's RESTful API and then HS's JSON showed up. I'm surprised very few people mentioned the RESTful API: it was the pioneer in externalizing HS.

    My comments on JSON API (JSON) -vs- RedTechie's RESTful API (RESTful), as of November 1st 2014.

    RESTful functions:

    JSON's API:

    In my opinion, JSON provides a few more functions (GetCounter, GetSetting, GetControl, GetSetting), while RESTful offers a simpler XML based reply format: when setting a status or value it will return True or False when the reply is not meant to have data content.

    RESTful offers a bit more flexibility by allowing reference by name or Id on more functions.

    In terms of response, I found both equally speedy.

    Two points I'd like to make:
    1- not trying to pin RESTful against JSON, but for those looking at an XML response type, well, there is RESTful
    2- I would like to see JSON adopt some of the flexibility of RESTful (reference by name or Id on more functions) and a simpler response structure as in "my control command worked or not)

    Comment


      #3
      How to specify a delta dim in JSON?

      How do I specify an Dim increment/decrement value on a dimmable device in a JSON controldevicebylabel?

      Comment


        #4
        Originally posted by claude View Post
        I had been using RedTechie's RESTful API and then HS's JSON showed up. I'm surprised very few people mentioned the RESTful API: it was the pioneer in externalizing HS.

        My comments on JSON API (JSON) -vs- RedTechie's RESTful API (RESTful), as of November 1st 2014.

        RESTful functions:

        JSON's API:

        In my opinion, JSON provides a few more functions (GetCounter, GetSetting, GetControl, GetSetting), while RESTful offers a simpler XML based reply format: when setting a status or value it will return True or False when the reply is not meant to have data content.

        RESTful offers a bit more flexibility by allowing reference by name or Id on more functions.

        In terms of response, I found both equally speedy.

        Two points I'd like to make:
        1- not trying to pin RESTful against JSON, but for those looking at an XML response type, well, there is RESTful
        2- I would like to see JSON adopt some of the flexibility of RESTful (reference by name or Id on more functions) and a simpler response structure as in "my control command worked or not)
        FYI, users of the HT-Zee & HT-Pi cannot use the RESTful interface (as ASP.NET is not supported) so JSON is their only option.
        Jon

        Comment


          #5
          Jon,

          I recall now... thanks for the reminder.

          Comment


            #6
            JSON parameters that include spaces

            I tried no quotes and double quotes around parameters that include spaces, but still get an error.

            What's the recipe?

            Edit: I realized that this had nothing to do with JSON, but rather with the GET syntax. So the answer is: replace space with %20
            Last edited by claude; November 2, 2014, 02:03 PM.

            Comment


              #7
              Originally posted by claude View Post
              How do I specify an Dim increment/decrement value on a dimmable device in a JSON controldevicebylabel?
              Anybody?

              Comment


                #8
                Originally posted by claude View Post
                How do I specify an Dim increment/decrement value on a dimmable device in a JSON controldevicebylabel?
                Hi Claude, not sure if there is a way. There's nothing in the docs that mention if it's possible. You may have to read the current value first and then send a new value based on the current plus the delta.

                Cheers
                Al
                HS 4.2.8.0: 2134 Devices 1252 Events
                Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                Comment


                  #9
                  Originally posted by sparkman View Post
                  Hi Claude, not sure if there is a way. There's nothing in the docs that mention if it's possible. You may have to read the current value first and then send a new value based on the current plus the delta.

                  Cheers
                  Al
                  Thanks for the reply. It's pretty much what I figured. Insteon will accept programmatic +/-1 step dimming, but you have to go pretty low level programming, so way out of HomeSeer's range.

                  Comment


                    #10
                    Originally posted by claude View Post
                    Thanks for the reply. It's pretty much what I figured. Insteon will accept programmatic +/-1 step dimming, but you have to go pretty low level programming, so way out of HomeSeer's range.
                    Try sending a -8 and a -9 as the value. If that doesn't work, post a screen shot of the Status Graphics tab of the device and there may be something there that works.

                    Cheers
                    Al
                    HS 4.2.8.0: 2134 Devices 1252 Events
                    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                    Comment


                      #11
                      Originally posted by sparkman View Post
                      Try sending a -8 and a -9 as the value. If that doesn't work, post a screen shot of the Status Graphics tab of the device and there may be something there that works.

                      Cheers
                      Al
                      Already tried that one: returns "error". Here's the Graphics tab of the device:
                      Attached Files

                      Comment


                        #12
                        Hi Claude,

                        Which plugin created that device? You may want to discuss with the plugin author to add CAPI values that sends a Dim + and a Dim -.

                        Cheers
                        Al
                        HS 4.2.8.0: 2134 Devices 1252 Events
                        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                        Comment


                          #13
                          Feedback after command is giving the old status

                          If I command Homeseer, the JSON string which is returned is giving me the old status instead of the new status. Is this by design?

                          Best regards,

                          DePampi

                          Comment


                            #14
                            Originally posted by depampi View Post
                            If I command Homeseer, the JSON string which is returned is giving me the old status instead of the new status. Is this by design?

                            Best regards,

                            DePampi
                            See post #67 here where this was first being discussed. There isn't a solution for this at this time.
                            http://board.homeseer.com/showthread.php?t=170144
                            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                            Comment


                              #15
                              Originally posted by claude View Post
                              Anybody?
                              Sounds like there is no solution?

                              I am finally playing with controlling my devices through my Zee with my Pebble. :-)

                              It is working. . .was just thinking it would be nice to be able to adjust the thermostat via JSON, but not sure if there is a way to go up one degree, etc instead of picking a static temperature.

                              Comment

                              Working...
                              X