Announcement

Collapse
No announcement yet.

Scripting questions

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

    Scripting questions

    I'm wanting to write some scripts but don't quite know how to do what I want. I've got a few virtual devices setup that I can write to and change via scripting and I've got that part down. The part I'm having problems with is what to do with that data other than look at it.
    I want to write some scripts that will look at the data in a virtual device and then take appropriate action based on that. How do I pull that data into a script and then act on it?
    Thanks in advance!

    #2
    Fireball,
    you would use something like:

    temp = cint(hs.DeviceString "A4")
    msgbox(temp)

    This assumes that a value like 77 is stored in the A4 device. If there are other characters then you have to code them out. The best way of acting on device data is to always store 2 values. The one you see (DeviceString) that can also include html and pictures and such and the one you don't see (DeviceValue) that would be only the number. IF you have specific device strings you need help with post them and we can give you code sniplets.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Hey Rupp,
      Thanks for the response! I don't have any code actually written yet but the project I was wanting to work on is switching music between zone 1 (living room) and zone 2 (bedroom). I've got it to the point that I can set two virtual devices with what is playing in each zone (r1 for zone 1 and r8 for zone 2). Doesn't do much good other than being able to look at my status page and say "hey, the PC is playing on zone" and I'd like to change that.
      The other thing I'd like to do is in some of my scripts in I have HS turn on the receiver, set it to the right input, and possibly send the TV, Power IR command depending if its on already or not (HS tracks the status by watching the IR commands sent by my remote and switching the status accordingly). I've also got HS (via a script you wrote for me!) tracking the status on the TV input. In my "watch dvd" script I'd like it to send out the correct number of "TV, Input" commands based on the status of r10.
      So, it sounds like when set the device string in my script for each input I should also set DeviceValue as well. Then in the event that switches what zone something is playing in I should have it check that device value and take the appropriate actions. Do I have this straight?

      Comment


        #4
        Yes. Also have a look at DeviceValuesAdd in the HS help file.
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #5
          Just an update on this project as of tonight. Thanks to the tip from Rupp HS will now keep track of what's playing in each zone. Not only do the virtual devices show what's playing in each zone but the Last Change shows that its chaning.
          Next step is write two scripts that are IR triggered. One will look at the value of what's playing in zone 1 and then send the right IR commands to make the same thing play in zone 2. The other one will do the opposite. I'm thinking of adding some motion detectors in each room and when a flag is set for virtual device named something like "follow me" those same scripts will be triggered by the motion detectors. Pretty slick, eh?

          Comment

          Working...
          X