Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: plugin question

  1. #1
    Join Date
    Mar 2005
    Posts
    724

    Default plugin question

    ok this may sound odd but can the internal id of a control be referenced in the device.lua of the plugin I am trying to figure out how to create a control but have the plugin auto update it on a timer

    Thanks,
    yonu

  2. #2
    Join Date
    Mar 2005
    Posts
    724

    Default

    please disgeguard I think I figured it out will post an example when I am done

  3. #3
    Join Date
    Mar 2005
    Posts
    724

    Default

    ok guess I will wait on a response what I had worked out didn't work

    Thanks,
    yonu

  4. #4
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    If you look at plugin\device.lua you'll see there is a function called "findControl(self, internalId) this returns the first child control with that internalId. Is that something you could use? If there are multiple controls with the same id, you could use forEachControl
    Ron
    No support through PM

  5. #5
    Join Date
    Mar 2005
    Posts
    724

    Default

    that will work thanks I didn't notice that.

    Thanks,
    yonu

  6. #6
    Join Date
    Mar 2005
    Posts
    724

    Default

    ok that will work for part of what I need. Here is the problem I am having at this moment is with the devices themselves say I create 5 devices i need a timer running to test for a change and update each device but I can't seem to figure out how to have the plugin parse the devices to get the internalid as I am using the device serial as the internalid.

    Hope that made sense
    Thanks,
    yonu

  7. #7
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    Hmm, I'm having a hard time understanding what you want to do? On what level does the timer run? (Plugin / Component / Device / Control ). From any of those levels you can use the forEachControl/forEachDevice/forEachComponent iterators to loop over the objects. Each object has a .internalId property you can read.
    Ron
    No support through PM

  8. #8
    Join Date
    Mar 2005
    Posts
    724

    Default

    ok where can I find an example of forEachDevice?

    Now here is an example of what I am trying to do and I don't actually care where it goes in the plugin as long as it is running every 30 sec without user interaction
    18 various temp, humidity and pressure sensors that are connected to the i2c port on my RPi that I want to create devices for and label controls to track and log the readings. so what I want to do is have the plugin read each device for the internalid which will be the serial number of the sensor so that it can use it as a variable for the folder name in the IO script you helped me with. I hope this makes since.

    Thanks,
    Yonu

  9. #9
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    both irtrans and simpleTransport use forEachDevice, with the irtrans plugin doing this inside the component.

    lua\irtrans\component.lua
    Ron
    No support through PM

  10. #10
    Join Date
    Mar 2005
    Posts
    724

    Default

    thanks I found it but I don't understand how to call it in the script. Can I get a dummies guide?
    Sorry,
    Yonu

Page 1 of 4 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •