No announcement yet.

RaspberryIO Plugin Device Delay in changing Value after CAPI Command

  • Filter
  • Time
  • Show
Clear All
new posts

  • wmcmath

    Leave a comment:

  • spud
    The plugin sends the command then the HS device is set with the new status value when the RPi confirmed to the plugin that a state change has occurred. So yes there can be a delay but it should not be long, so the solution is to add a wait instruction after the CAPI command.

    Leave a comment:

  • RaspberryIO Plugin Device Delay in changing Value after CAPI Command

    When a CAPI command such as shown below is executed to turn Off DeviceA and is immediately followed by the WriteLog command shown, the WriteLog statement shows DeviceA Value still equal to 1.
    Immediately following the WriteLog after the CAPI Off command, I then execute the For Loop as shown.
    After 50 to 100 times through the loop(the number varies some each time the code is run), the Value of DeviceA finally becomes = 0 as expected.
    I am assuming this delay in the value changing from 1 to 0 is the time for the RaspberryIO Plugin to receive the CAPI command and update the value back to Homeseer.
    Immediately after the CAPI Off command, Homeseer still shows the Value = 1 when it should b = 0.

    In my actual code, immediately after the CAPI command, there is code to act on the CAPI result and the code produces the wrong results, because it still sees DeviceA value = 1.

    Does anyone know a solution to this timing issue?
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRe fByName("RaspberryIO DeviceA"), True, "Off", False, False))
    hs.WriteLog("Debug", "After CAPI Off-DeviceA Value = " & hs.DeviceValueByName("RaspBerryIO DeviceA").ToString)
    Dim i as Integer
    For i = 1 to 100
    hs.WriteLog("Debug", "Loop-DeviceA Value = " & hs.DeviceValueByName("RaspBerryIO DeviceA").ToString)
    next i