Announcement

Collapse
No announcement yet.

Increment / Decrement a Virtual Device Each Second

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

    Increment / Decrement a Virtual Device Each Second

    Hi all,

    Apologies, however whilst I have used Homeseer for almost 15 years, I have very limited experience in writing HS scripts (I've had experience of scripting with Arduinos and some other languages).

    I have a really weird aim I'm trying to achieve and could really use some help.....

    I have two disabled 5 year old twins who have moved in with us for their forever home and have been trying to adapt things for them around the house. Homeseer has meant I have been able to make so many of the boring things like stairlifts fun .... I now have the worlds first ever voice activated stairlift thanks to some awesome HS3 plugins and some custom electronics I've made to interface the stairlift. It also plays Thunderbirds, Fireman Sam etc through the Sonos system too - so they love it !

    I'm trying to add the stairlift to the HSTouch screen on the ground floor and want to show feedback of where the stairlift is on the screen.

    The stairlift can't give feedback so it needs to be a virtual device that shows where it is based on where it has been sent to.

    What I want is to be able to have a virtual device that goes from e.g. 1 to 45. I alsready have the events done to move the stairlift about. When I run an event which I have that sends the stairlift up, I want the virtual device to count up (in seconds) from whatever value it is until it reaches 45. When I send the stairlift down I want it to count down from whatever value it is to 7. When I send it to charge I want it to count down from whatever value it is to 1.

    The virtual device would therefore have a value going from 1 to 45.

    I can have either 1 script which does each of the functions or more than happy to have a script that I adapt and use in 3 different variants - changing the - 1 to a + 1 etc and amending the start and stop points.

    I can then map the virtual device to a button on a custom slider that I have created in HSTouch which is actually a picture of a stairlift that slides up and down the slider background (which is a stairlift rail).

    I know it's a big ask, but if anyone can point me in the direction of a script which I might be able to adapt I would be so very grateful.

    Many thanks,

    Jay



    #2
    I’ve been playing around and can increase the value of the virtual device string by entering the following in the instant command:

    &hs.setdevicestring(2748,hs.devicestring(2748)+1,True)

    When I put the same code into a script, the script doesn’t work:

    sub Main()
    hs.setdevicestring(2748,hs.devicestring(2748)+1,True)
    end sub

    Obviously the script would need to be expanded on with reference to timers etc but I can’t see why this basic building block won’t work?

    many thanks,

    Jay

    Comment


      #3
      If the script is a .vb then you would need to change the first line to:
      Sub Main(ByVal parms as Object)
      HS4Pro on a Raspberry Pi4
      54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
      Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

      HSTouch Clients: 1 Android

      Comment


        #4
        Originally posted by rmasonjr View Post
        If the script is a .vb then you would need to change the first line to:
        Sub Main(ByVal parms as Object)
        Thankyou so much ... perfect !

        cheers,

        Jay

        Comment

        Working...
        X