Announcement

Collapse
No announcement yet.

Updating Status only device with Event

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

    Updating Status only device with Event

    I'm a bit confused and looking for some guidance/help.

    I have a virtual device I created that I want to update when any motion sensor in my basement activates. When all motion sensors clear, I want to clear the device.

    I created a new, status only device, with two values: 0 for No Motion, and 100 for Motion.

    When I created an event, I was a bit suprised to find that there is no way to update the status of a status only device. You can only control a control device.

    I got around this by using a script command.

    Am I missing something?

    #2
    Originally posted by WhitW View Post
    I'm a bit confused and looking for some guidance/help.
    I have a virtual device I created that I want to update when any motion sensor in my basement activates. When all motion sensors clear, I want to clear the device.
    I created a new, status only device, with two values: 0 for No Motion, and 100 for Motion.
    When I created an event, I was a bit suprised to find that there is no way to update the status of a status only device. You can only control a control device.
    I got around this by using a script command.
    Am I missing something?
    Nuanced use of English is not a strength of HST. There are numerous examples on the Board of the (sometimes amusing, sometimes frustrating) ways this can cause confusion.
    In this case, I think the simplest answer is that if you want to change the device value of a virtual device, you are essentially controlling it. (After all, that's about all a virtual device can do.) I cannot think of any application where creating a status-only virtual device would be useful - but maybe I'm missing something. All of mine are created by plug-ins. Is there a reason you cannot make the device controllable?
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      Originally posted by WhitW View Post
      I'm a bit confused and looking for some guidance/help.

      I have a virtual device I created that I want to update when any motion sensor in my basement activates. When all motion sensors clear, I want to clear the device.

      I created a new, status only device, with two values: 0 for No Motion, and 100 for Motion.

      When I created an event, I was a bit suprised to find that there is no way to update the status of a status only device. You can only control a control device.

      I got around this by using a script command.

      Am I missing something?
      I have some Virtual motion sensors based from Blueiris Cameras. When I created them they have a control and from the event I set them to motion and then reset to no motion. Not sure why you don't just add a control to them.

      Comment


        #4
        Originally posted by WhitW View Post
        When I created an event, I was a bit surprised to find that there is no way to update the status of a status only device. You can only control a control device.

        I got around this by using a script command.

        Am I missing something?
        Unfortunately, no. I find this behavior irritating - I use a number of status-only devices which represent the states of monitored devices that aren't controllable from the HomeSeer app. My thinking is, I don't want a useless control that can only change the virtual device, not the underlying physical device that it represents. For example, outdoor dusk-dawn lights provide input via JSON to the house lighting state. These are grouped with the other lighting, so lack of a control highlights that they aren't controllable from the UI.

        The only way I know to control a status-only devices is via scripting. When setting up my dusk-dawn device updates, as soon as a device was set to status-only, it's JSON updates started throwing errors. So it was necessary to create a couple of stub events for each device which control the device via a one line immediate script. Then the JSON update fires the event rather than control the device directly.

        Comment


          #5
          See solution here.

          Comment


            #6
            changing value of status type

            I am trying to do something very similar to the initiator of this thread and so am joining in with my variation of what I think is essentially the same problem. I am new to HS, but experienced as a system developer and know (or knew) several languages.

            I am planning to use a virtual device to initiate a sequence of events, i.e., turn on or off in sequence 8 heat pumps that are controlled by Z-wave relays. I would like to use a virtual device to both initiate and track

            Comment


              #7
              It is not necessary to have a button for every value. You can place them in a drop down list, or even represent them as a slider.

              I've attached screen shots of a virtual device I use to display an image of the moon for each 'mood day'. The drop list displays the value of the device.
              Attached Files
              Mike____________________________________________________________ __________________
              HS3 Pro Edition 3.0.0.548, NUC i3

              HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

              Comment


                #8
                There are lots of instances where I have devices needing to be updated, but I have no desire to have controls in the Device Manager. I do understand the logic of not having devices with no controls show up in an Event. Since there are no controls offered to an Event, there could be no control options in the Event. It would be nice if a workaround was offered to set any value to a device, regardless of the controls.

                In the meantime an immediate script is easy and straightforward. if you want to set a device to a specific value it is
                Code:
                &hs.SetDeviceValueByRef(5249, 100, True)
                5249 is the RefID of the destination device. To set one device to the value of another device it is
                Code:
                &hs.SetDeviceValueByRef(5249, hs.DeviceValueEx(69), True)
                5249 is the RefID of the destination device and 69 is the RefID of the source. Not that I used "hs.DeviceValueEx" allowing for decimal precision, "hs.DeviceValue" returns an integer. Most of the scripting calls are in the HomeSeer Help document. The device calls are here

                This Event is used to update the device when the value of the source device is greater than the destination device.

                Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	27.1 KB
ID:	1197484

                While the above event will update the device, I also wanted a control to reset it. I have a reset button on the device.

                Click image for larger version

Name:	Capture1.PNG
Views:	1
Size:	6.5 KB
ID:	1197485

                Click image for larger version

Name:	Capture2.PNG
Views:	1
Size:	49.8 KB
ID:	1197486

                I added a value of 0 with text (Reset) so that I can manually control the device to set a starting value of 0. It is also important to note that I established a value range to support any value it might be set to.
                Last edited by randy; July 14, 2018, 08:09 AM.
                HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

                Comment


                  #9
                  Most gracious of rPrade and Uncle Michael to have gotten back so quickly. I shall check these suggestions out and get back with a report ... from a novice's point of view, of course.

                  I confess that I was expecting someone to say you should be using HSTouch, which I own, but a foray into which I am putting off until I have explored at least superficially the display capabilities of Device Manager.

                  Comment


                    #10
                    Controlling the value/status display of a VD with an event

                    Dear Randy,


                    Thank you for your help again.


                    I have made considerable progress in getting the event to run as I would like, and perhaps more important my knowledge has increased multi-fold.


                    However, I am not quite there.


                    Below is a screen shot intended to turn ON the first three heat pumps. The rest will be done when the think has been figured out. As you can see, I am triggering the HP control virtual device for each of BlkBed, GrBed, and GrOffice, at 4 second intervals: 0, 4, 8 waits. That works well.

                    Click image for larger version

Name:	Forum Attach1.jpg
Views:	1
Size:	73.8 KB
ID:	1197541Click image for larger version

Name:	Forum Attach2.jpg
Views:	1
Size:	73.5 KB
ID:	1197540
                    Last edited by quinn; July 14, 2018, 06:40 PM. Reason: Insert images

                    Comment


                      #11
                      A solution to my problem

                      I did not get any further help with my problem described previously.



                      However, I was able to get the virtual device to display a sequence of actions in the order and at the time that those actions were being done.


                      I used a script that takes parameters to define what is to be done and to what zwave device (each of which controls a particular motorized window).


                      The code is surprisingly simple, so I thought I would post it. If anyone would like to know more details, would be happy to respond.


                      Thanks to the two responders who got me on track.


                      Sub Main(parms as object)
                      'Capture parms parts
                      'Parms: HP * Control,ON,BlkBed,GR Dining,GR Sitting,GrBed,
                      ' Gr Office,Guest,Kitchen,Media,WhBed,WhOffice
                      'P1. HP * Control: is the virtual device that displays and controls the on/off
                      ' functionality.
                      'P2. ON or OFF is the indicator whether all the HP devices should be turned on or off
                      'P3. <First HP>
                      ' ....
                      'Pk. <kth HP>

                      hs.writelogEx("qScript","HP All On.vb" & "Parms: " & Parms,"#0000FF")

                      dim i as integer, j as Integer
                      dim txt as string = cstr(Parms)
                      dim ls() as String = Split(txt, ",")
                      dim VdControlNm as String = ls(0)
                      dim idVd as integer = hs.GetDeviceRefByName(VDControlNm)

                      'Set up On/Off state variables.
                      dim OnOff as string = Ucase(ls(1)) '=ON or =OFF
                      dim OnOffDevVal as Integer
                      If OnOff = "ON" then
                      OnOffDevVal = 100 'The set value of each of the room specific control VDs
                      Else if OnOff = "OFF" then
                      OnOffDevVal = 0 'The OFF value for each room specific control VD
                      Else
                      beep
                      hs.WriteLogEx("qERROR","The second Parameter should be 'ON' or 'OFF'","#FF0000")
                      Exit sub
                      End if

                      'Loop through the Heat Pump (HP) names, setting each to On or Off, as determined by
                      ' Parms P2, and setting the Statuses and Values so that the controlling virtual device
                      ' name given in P1.
                      hs.WriteLogEx("qLOg",ls.length-1,"#D58000" )
                      for i = 2 to ls.length - 1 step 1
                      j = int((i-1)*100/(ls.length-2))
                      hs.WriteLogEx("qInfo",ls(i) & " (HP * All " & ls(1) & ") i-1=" & i-1 _
                      & " Rat=" & j,"#0000ff")
                      hs.SetDeviceString(idVd,ls(i),False)

                      hs.setDeviceValueByRef(idVd,j,False)
                      hs.SetDeviceValueByName("HP "& ls(i) & " Control",OnOffDevVal)
                      'This triggers the indivalual room VD to an turn on or off.
                      hs.WaitEvents()
                      hs.WaitSecs(3) 'Wait for 3 seconds before going to next

                      'HP in the list

                      'if i > 2 then i = 100
                      Next

                      'Set Status to indicate what just happened.
                      hs.SetDeviceString(idVd,"Done " & OnOff,False)
                      'Set * Control value to on/off without triggering
                      hs.setDeviceValueByRef(idVd,iif(OnOff="ON",101,102),False)

                      hs.WriteLogex("qInfo", "HP All " & onoff & " is DONE.","#0000ff")
                      End Sub

                      Comment


                        #12
                        Is there a way to set the value of a status only device with an API call?

                        --Barry

                        Comment

                        Working...
                        X