Announcement

Collapse
No announcement yet.

How to get HS4 device status JSON by floor

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

    How to get HS4 device status JSON by floor

    This command produces JSON of ALL HS4 devices

    http://192.168.1.5:83/JSON?request=getstatus

    This command produces JSON for a single HS4 device identified by by it's ref number (123 for the example below)

    http://192.168.1.5:83/JSON?request=getstatus&ref=123

    The question is how to produce a JSON file for all devices per floor or per room

    #2
    On the web page? I'd pipe that stuff to jq on a command line and use that to try to parse out what you want...

    curl http://192.168.0.5/JSON?request=getstatus | jq
    HS3 Pro Edition 3.0.0.435 (Windows Server 8.1 on ESXi box)

    Plug-Ins Enabled:
    Z-Wave:,RaspberryIO:,AirplaySpeak:,Ecobee:,
    weatherXML:,JowiHue:,APCUPSD:,PHLocation:,Chromecast:,EasyTr igger:

    Comment


      #3
      wpiman Thanks for the suggestion. I did install jq on my Windows 10 desktop and the above does work producing super long JSON file in the command prompt window.

      Code:
      curl [URL]http://192.168.0.5/JSON?request=getstatus[/URL] | jq


      Can you advise please how to use jq to parse the long JSON by selecting the devices by floor or by room or both. Floor is "location" and room is "location2" in JSON.

      Comment


        #4
        I asked Chat GPT the same question and after 2 hours of adjustments I got this working. Floor is DSC and room is Family for the example below. Result is saved locally as output.json

        Code:
        curl -s http://192.168.0.5/JSON?request=getstatus | jq "[.Devices[] | select(.location2 == \"DSC\" and .location == \"Family\") | {device: .name, floor: .location2, room: .location, value: .value, status: .status}]" > "C:\Downloads\output.json"
        One must download and install latest version of jq and run the above line from command prompt in Windows. Didn't test it in Linux environment but it should work in a similar way.

        Comment


          #5
          Freaking awsome. Way to go ChatGPT...

          I checked it on mine using Linux. Put in a valid room for me and it works...

          curl -s http://192.168.0.5/JSON?request=getstatus | jq "[.Devices[] | select(.location2 == "First" and .location == "Family Room") | {device: .name, floor: .location2, room: .location, value: .value, status: .status}]"
          HS3 Pro Edition 3.0.0.435 (Windows Server 8.1 on ESXi box)

          Plug-Ins Enabled:
          Z-Wave:,RaspberryIO:,AirplaySpeak:,Ecobee:,
          weatherXML:,JowiHue:,APCUPSD:,PHLocation:,Chromecast:,EasyTr igger:

          Comment


            #6
            Wait ... where is my credit for spending 2 hours going back and forth through all BS ChatGPT produced. Believe me it is not "plug-and-play" process 😫

            More seriously now I need a script to execute the same code and put the result in a HS4 device status. Device status f.k.a. device string can hold any strings hence it should be able to hold the JSON that is produced by the command. Below is the same command for convenience. I want to execute it on demand from inside HS4 (from HS4 event).

            Code:
            curl -s http://192.168.0.5/JSON?request=getstatus | jq "[.Devices[] | select(.location2 == \"DSC\" and .location == \"Family\") | {device: .name, floor: .location2, room: .location, value: .value, status: .status}]" > "C:\Downloads\output.json"

            Comment

            Working...
            X