Announcement

Collapse
No announcement yet.

DeviceValuesAdd and ButtonAdd don't seem to work

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

    DeviceValuesAdd and ButtonAdd don't seem to work

    I ran into a problem trying to set up an appliance module for the Xmas tree! I have a script that sets up device buttons and graphics. When I set the device up the graphic works just fine, the interface shows the On and Off buttons, and the device responds to the button action. However, an event that performs the action does not operate the device. The action is "...Value Set set to on" and the log shows "Value set to 100", but the device stays off. When the button is depressed the Info entry reads "On button pressed for Christmas Tree" and the tree lights.

    I use the following code for about 15 devices and they seem to work:

    dev = "L15"
    hs.DeviceValuesAdd dev,"On" & chr(2) & "100" & chr(1) & _
    "Off" & chr(2) & "0", False
    hs.DeviceValuesGraphicsAdd dev,"treeon.gif" & chr(2) & "100" & chr(1) & _
    "treeoff.gif" & chr(2) & "0"

    'Remove any previous buttons
    hs.DeviceButtonRemove dev,"On"
    hs.DeviceButtonRemove dev,"Off"

    'Add new buttons
    onref = "controldevice.txt(""send_on"",""" &dev &""")"
    offref = "controldevice.txt(""send_off"",""" &dev &""")"
    hs.DeviceButtonAdd dev, onref,"On"
    hs.DeviceButtonAdd dev, offref,"Off"

    Can anyone see a mistake or is this an HS issue in the Event code?

    Michael
Working...
X