Announcement

Collapse
No announcement yet.

Is there an equiv execx10byname for any general device in HS3 or HS4 scripting?

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

    Is there an equiv execx10byname for any general device in HS3 or HS4 scripting?

    In my migration from HS1.7 to HS3, I've started to migrate events. A lot of them require scripts to run, some were easy just a couple of changes. But some, because of the move from X10 to a ubiquitous generic device paradyme (i.e. by Ref) have be a little stumped. I've tried scanning what I could of the scripting documentation. But before I go any further is there a equivalent or a snippet that will do the same as byName?

    As some devices can get false triggers (I.E. a phantom X10 signal, or someone manually turning on a fan or light and HS1.7 doesn't know about it, I wrote my 'Critical Devices' script. Basically, the script will read a data file which has the name of the device and the default state that it should be in unless HS really wanted it in another state.

    For example, if HS turned on the fan then the it wants the fan on. But if HS thinks the fan should be off and the default Critical state of the fan should be off, then the script will issue an ON or OFF to ensure that the device is in it's 'resting state'.

    The file is simply fully qualified the name of the device and it default resting state. If the internal HS status and the resting state agree then the script will send out a command to ensure that they really are in sync. If they do not agree, then HS must have wanted it in another state.

    Basic question, is there an EXEC___ByName or ISON_ByName/ref function that I can use, or a quick way that I can get the reference ID by just using the fully formed name so I can issue a simple ON or OFF command generically?

    Thanks.


    do while f.AtEndOfStream = False
    line = f.Readline
    devname = hs.stringitem(line,1,",") ' pickup device name
    val = lcase(hs.stringitem(line,2,",")) ' requested default status
    if left(devname,1) <> "*" then ' if a comment, skip line
    hs.waitsecs 2
    hs.nolog = True
    select case val
    case "off"
    if hs.isoffbyname(devname) then hs.execx10byname devname,"OFF",0
    case "on"
    if hs.isonbyname(devname) then hs.execx10byname devname,"ON",0
    end select
    end if
    hs.waitevents ' allow HS to do more important stuff
    loop
    f.close
    hs.nolog = False

    #2
    https://forums.homeseer.com/forum/li...-from-a-script

    Since X10 operates on a device code, I would expect that it would be more efficient for the script to refer to X10 devices by their code rather than there name.
    I am not aware of any X10 functions that use device name. (I doubt any use the Ref ID.)

    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
      Thanks, I ran into that script, what I'm trying to do it extend it to more than just X10. There are some Z-Wave devices that don't report back status changes and others.

      I am just curious if there is a generic .isOn for any type of device that has an On/Off status and if there is a generic Send or Turn ON/OFF for any device that supports ON/OFF.

      X-10 I can code around as in the script you pointed out. But as I'm migrating away from X-10 to Z-Wave, Insteon, etc, the same principle holds.

      Comment


        #4
        I may not understand fully what you are asking, but have you looked at the CAPI section of HS help file?

        Click image for larger version

Name:	CAPI.png
Views:	57
Size:	166.9 KB
ID:	1494320
        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

        Working...
        X