Announcement

Collapse
No announcement yet.

Toggle and returning a value via JSON?

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

    Toggle and returning a value via JSON?

    I have an HSM200 that I want to toggle between red and off (to use as a home office "do not enter, on the phone" kind of warning.

    But I'd like to trigger it externally from an elgato Stream Deck (streamdeck to populate the search results). That has a way to use a GET and change it's icon based on matching in the response.

    Using the Easytrigger toggle works if I set up an Event, but only returns "ok". Where there's an event group named 'test' and an event named 'toggle'

    Code:
    $ curl -s "http://homeseer:8080/JSON?request=runevent&group=test&name=toggle"|json_pp
    {
    "Response" : "ok"
    }
    Is there a way to push the device status out the JSON response?

    #2
    This response is a generic response sent by HS for any event, the plugin doesn't have a say in that, so no this isn't possible.

    Comment


      #3
      HS has a real hit-and-miss set of API functions. There's umpteen different ways to 'skin the cat' but ALL of them seem to come with too many gotchas.

      Comment


        #4
        I no nothing of elgato stream deck. Typically, many disparate API's are called to perform a logical unit of work. One normally creates scripts / programs to perform these logical unit's of work.

        In your case you want to combined several API calls; first to toggle as you currently do, then a 2nd to get and output the devices status.

        The following will return the device status.
        Code:
        curl -s 'http://homeseer:8080/JSON?request=getstatus&ref=34' | jq '.Devices[0].status'
        "On"

        If you have the option, make one big command line containing both curl commands.
        Code:
        curl -s "http://homeseer:8080/JSON?request=runevent&group=test&name=toggle" > /dev/null ; curl -s 'http://homeseer:8080/JSON?request=getstatus&ref=34' | jq '.Devices[0].status' | tr -d \"
        On
        Len


        HomeSeer Version: HS3 Pro Edition 3.0.0.435
        Linux version: Linux homeseer Ubuntu 16.04 x86_64
        Number of Devices: 633
        Number of Events: 773

        Enabled Plug-Ins
        2.0.54.0: BLBackup
        2.0.40.0: BLLAN
        3.0.0.48: EasyTrigger
        30.0.0.36: RFXCOM
        3.0.6.2: SDJ-Health
        3.0.0.87: weatherXML
        3.0.1.190: Z-Wave

        Comment


          #5
          I'm looking into it further. I may have to create my own aspx page to provide the results necessary.

          The API Ninja plugin for the StreamDeck allows calling GET or POST operations with a range of parameters and headers. And can process the results with match/no-match result based on a regex. So it's helpful to have a single command that can be used to toggle. Otherwise there'd need to be two buttons used, one for on and another for off. It can also set the graphic shown on the button based on the match/no-match.

          Thus my request for a toggle AND notification of current status.

          Is there a part of HS that supports serializing data into a JSON response? I mean, I can 'fake it' with text of course.

          Comment

          Working...
          X