Announcement

Collapse
No announcement yet.

JSON control interface - Device strings

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

    JSON control interface - Device strings

    Does anyone know if there is any way to set the device string with JSON? There is nothing in the reference about setting strings. Internet of things is progressing rapidly and a full featured JSON interface would be nice. I want to control Homeseer with external devices/apps using JSON. I currently can set the device value, but apparently not the device string. Possibly an oversight?

    #2
    Originally posted by jimbell View Post
    Does anyone know if there is any way to set the device string with JSON? There is nothing in the reference about setting strings. Internet of things is progressing rapidly and a full featured JSON interface would be nice. I want to control Homeseer with external devices/apps using JSON. I currently can set the device value, but apparently not the device string. Possibly an oversight?
    There is a way to do it and I will try and find the thread but in reality in HS the use of the device string is much rarer than it was in HS2. The ethos is that the values will have an associated string status so you just need to set the value and then HS will display the string for you - do you absolutely need to set the string?

    Comment


      #3
      String set function now needed

      Originally posted by mrhappy View Post
      There is a way to do it and I will try and find the thread but in reality in HS the use of the device string is much rarer than it was in HS2. The ethos is that the values will have an associated string status so you just need to set the value and then HS will display the string for you - do you absolutely need to set the string?
      In the world of HS2, we did not have the "internet of things". I have used the value/string pairs in many projects in HS3. However, in the current environment, we do have the internet of things. There are many external things that could control HS3 devices now. For instance, I could have a 8266 module on my wifi network "reporting" to HS3 with JSON.
      I currently have a external program in PHP that collects weather data. I can send the temp and humidity values with JSON to HS3 with no problem. Not so much with the conditions.
      The condition can be many strings like "partly cloudy", "clear", "rain" and the list goes on. If you think about it, the ability to set the device string in our current internet of things environment would be a welcome addition. In a "real" device, the string setting with the value/string pair is all that is needed. Virtual devices, at least in my environment, are used to store values as well as strings that are used by events and scripts.

      I am using Jon00's Alexa/Echo plugin. The strings are used for several commands. For instance, I have one for the weather. It says (with the echo) "Good day, the temperature is 80 degrees, the humidity is 60 percent, and the current condition is partly cloudy". This is easy with strings, but quite difficult without. At least for the condition field.
      To sum it up, the device string function is needed to accommodate data that may be literally dozens of different string values. Again, this makes much more sense for virtual devices.

      Comment


        #4
        Something like this (without spaces):

        http://<HSip>/JSON?request=setdeviceproperty&ref=2221&property=NewDevStrin g&value=here youwillputthetext

        or in PHP:

        $url = file_get_contents('http://<HSip>/JSON?request=setdeviceproperty&ref=2221&property=NewDevStrin g&value=Duration%20traffic%20is%20' . $durationT . '%20minutes');

        Comment


          #5
          Thanks

          Works very well. It will solve my current problem very nicely.

          Comment


            #6
            Originally posted by jimbell View Post
            In the world of HS2, we did not have the "internet of things". I have used the value/string pairs in many projects in HS3. However, in the current environment, we do have the internet of things. There are many external things that could control HS3 devices now. For instance, I could have a 8266 module on my wifi network "reporting" to HS3 with JSON.
            I currently have a external program in PHP that collects weather data. I can send the temp and humidity values with JSON to HS3 with no problem. Not so much with the conditions.
            The condition can be many strings like "partly cloudy", "clear", "rain" and the list goes on. If you think about it, the ability to set the device string in our current internet of things environment would be a welcome addition. In a "real" device, the string setting with the value/string pair is all that is needed. Virtual devices, at least in my environment, are used to store values as well as strings that are used by events and scripts.

            I am using Jon00's Alexa/Echo plugin. The strings are used for several commands. For instance, I have one for the weather. It says (with the echo) "Good day, the temperature is 80 degrees, the humidity is 60 percent, and the current condition is partly cloudy". This is easy with strings, but quite difficult without. At least for the condition field.
            To sum it up, the device string function is needed to accommodate data that may be literally dozens of different string values. Again, this makes much more sense for virtual devices.
            Of course I get that, I've got a whole host of ESP modules as well reporting things in my HS setup. I was just saying that the decision not to have a native string writing function (instead accessing via the device properties) I think is likely to be intentional as HS want you wherever possible to not use device strings - I don't even think it was in the first releases of HS3 and there was somewhat of a discussion to get it added.

            I used device string in HS2 of course but I am a convert to the HS3 way, the prefix/suffix and then the other options in the HS device class makes a lot of the scenarios (even weather conditions likely have a limited amount of possibilities) that you would need to set a device string rather limited.

            Comment

            Working...
            X