Announcement

Collapse
No announcement yet.

Passing a string to HomeSeer via HTTP/JSON and then act on it

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

    Passing a string to HomeSeer via HTTP/JSON and then act on it

    My webcam server can read license plates, it can also send it via GET/POST commands.
    I want to send the licence plate string to Homeseer, do some validation and then (if requirements are met) open the garage door.

    However, I can't for the life of me figure out how to do that the easy way. I found a thread that list a way to send a device string to HomeSeer. This works, but I can't get HomeSeer to trigger on the device string change, even spuds EasyTrigger plugin can't do it.

    Perhaps there is a way to trigger a script with parameters using JSON?
    Or there's another way to do it?


    I can, of course, just write a asp page to do the heavy lifting, but I was hoping it was possible to do it without that.

    HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
    Running on Windows 10 (64) virtualized
    on ESXi (Fujitsu Primergy TX150 S8).
    WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

    Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

    #2
    Could you put the info into a virtual device using the technique above, and then use

    /JSON?request=runevent&group=GROUPNAME&name=EVENTNAME

    to run an event to do the work?
    Fred

    HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

    Comment


      #3
      Off topic, can you share what Webcam server you are using. is the license plate lookup a core feature or something you built on top?

      Comment


        #4
        Originally posted by ITguyHS View Post
        Could you put the info into a virtual device using the technique above, and then use

        /JSON?request=runevent&group=GROUPNAME&name=EVENTNAME

        to run an event to do the work?
        No, it can only send just one request, and that would require two: One to send the licence plate string, and another to trigger the event.
        HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
        Running on Windows 10 (64) virtualized
        on ESXi (Fujitsu Primergy TX150 S8).
        WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

        Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

        Comment


          #5
          Originally posted by bsobel View Post
          Off topic, can you share what Webcam server you are using. is the license plate lookup a core feature or something you built on top?
          Netcam Studio. Licence plate reading is built in.
          HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
          Running on Windows 10 (64) virtualized
          on ESXi (Fujitsu Primergy TX150 S8).
          WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

          Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

          Comment


            #6
            Originally posted by Moskus View Post
            No, it can only send just one request, and that would require two: One to send the licence plate string, and another to trigger the event.
            If your webcam server is running Windows, maybe you could use something like AutoHotKey as an intermediary. Pass the license plate string to AHK as a parm, then let AHK do the two JSON requests?
            Fred

            HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

            Comment


              #7
              Originally posted by Moskus View Post
              My webcam server can read license plates, it can also send it via GET/POST commands.
              I want to send the licence plate string to Homeseer, do some validation and then (if requirements are met) open the garage door.

              However, I can't for the life of me figure out how to do that the easy way. I found a thread that list a way to send a device string to HomeSeer. This works, but I can't get HomeSeer to trigger on the device string change, even spuds EasyTrigger plugin can't do it.

              Perhaps there is a way to trigger a script with parameters using JSON?
              Or there's another way to do it?


              I can, of course, just write a asp page to do the heavy lifting, but I was hoping it was possible to do it without that.
              HS can trigger based on a device string changed - I have a virtual device that gets notifications I want read by alexa or pushed to notify on my TVs, I use Spuds easytrigger to update the string of this device.
              Then I have a native HS event which is:
              IF Virtual Virtual Notification text has a string that just changed.
              Then
              Run event <x> (options to check if condition is true)

              Comment


                #8
                Originally posted by ITguyHS View Post

                If your webcam server is running Windows, maybe you could use something like AutoHotKey as an intermediary. Pass the license plate string to AHK as a parm, then let AHK do the two JSON requests?
                NetcamStudio doesn't have the option to run a application on new licence plates. It can log it to a text file, and I can write a small application to monitor that file, but nah...


                Originally posted by Furious View Post
                HS can trigger based on a device string changed - I have a virtual device that gets notifications I want read by alexa or pushed to notify on my TVs, I use Spuds easytrigger to update the string of this device.
                Then I have a native HS event which is:
                IF Virtual Virtual Notification text has a string that just changed.
                Then
                Run event <x> (options to check if condition is true)
                As I said, EasyTrigger won't trigger, as the JSON command just changes the text, it doesn't update the time it was triggered. I suspect EasyTrigger doesn't really monitor the text itself.
                HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                Running on Windows 10 (64) virtualized
                on ESXi (Fujitsu Primergy TX150 S8).
                WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                Comment


                  #9
                  OK, I solved the problem years before the JSON interface was available. I'm on Windows, so I can process simple ASP-pages, and I had written this in the HS2 era and updated it to HS3.

                  setdevicestring.asp
                  Code:
                  <%
                  Dim dev
                  Dim devstring
                  Dim devvalue
                  
                  'hs.Writelog "Web SetDeviceString", "... is called"
                  
                  dev = Request.QueryString("deviceid")
                  devstring = Request.QueryString("devicestring")
                  devvalue = Request.QueryString("devicevalue")
                  
                  devstring = Replace(devstring, "%3a", ":")
                  
                  If Not IsNull(devvalue) Then
                      'devvalue = Round(devvalue, 4)
                      hs.SetDeviceValueByRef dev, 0, True
                      hs.SetDeviceValueByRef dev, devvalue, True
                  End if
                  hs.SetDeviceString dev, devstring, True
                  
                  Response.Write("Success!")
                  %>
                  That way,this will work:
                  Code:
                  http://yourIP:andPort/setdevicestring.asp?deviceid=DEV_REFERENCE&devicestring=YOUR_STRING_HERE
                  ... and then EasyTrigger will work.
                  HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                  Running on Windows 10 (64) virtualized
                  on ESXi (Fujitsu Primergy TX150 S8).
                  WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                  Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                  Comment


                    #10
                    So basically you're saying a JSON post or get doesn't trigger the event engine to fire?
                    Sounds like you need to submit a bug to me then

                    Comment


                      #11
                      Confirmed - JSON doesn't trigger the event engine for string updates. Man, the SDK is terrible.

                      Comment


                        #12
                        If they add a JSON command to update the device string, I'm guessing it won't be a problem. But at the moment it's updating the property, so it doesn't pass through hs won APIs as I see it. I might be wrong, though...
                        HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                        Running on Windows 10 (64) virtualized
                        on ESXi (Fujitsu Primergy TX150 S8).
                        WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                        Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                        Comment


                          #13
                          Well just update the string, and then have another virtual device with a puch button, that you trigger from the same script that sends the license plate to HS?

                          Comment


                            #14
                            Originally posted by larhedse View Post
                            Well just update the string, and then have another virtual device with a puch button, that you trigger from the same script that sends the license plate to HS?
                            Except that the function in Netcam Studio that sends the license plate string only does that:
                            It sends the license plate string to a device. And as there's nothing in HomeSeer that can trigger on a device string change like that I'm not getting any further...
                            HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
                            Running on Windows 10 (64) virtualized
                            on ESXi (Fujitsu Primergy TX150 S8).
                            WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

                            Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

                            Comment


                              #15
                              Well then my suggestion is to have a event run every 5 seconds to check if there is a "NEW" licenseplat in that virtual device, and when a new one arrives, well don't forget so clear that virtual device so that it can discover this change at a later time...

                              Comment

                              Working...
                              X