Announcement

Collapse
No announcement yet.

Problem reading Analog values

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

  • Problem reading Analog values

    Hi,
    I am using the Plug-in 2.2.2433.35446 version (Beta)

    I seem to have no problem reading digital values, however, when I set one of the SECU16 interfaces to analog the values always show '0'.

    I have confirmed with CMax that the parameter that corresponds to the digital value of the analog signal is accurate.

    I have restarted the plugin and I have added polling, etc.

    Any thoughts?

  • #2
    I wrote this up awhile ago and think it is still accurate.
    jim


    Reading Analog values
    There are two ways to get the analog values of Ocelot Secu16 inputs.

    1. Place the analog value into a variable using a short segment of Cmax code similar to that shown below. The Ocelot variable can then be accessed normally through the plugin.

    0555 - IF Module #1 -SECU16 Analog #0 is < 256
    0556 - THEN Load Data to: Variable #97
    0557 - IF Module #1 -SECU16 Analog #1 is < 256
    0558 - THEN Load Data to: Variable #98

    2. The analog data can be read directly using a script that is periodically run to read the values and place them into a Homeseer device. One item to note – the GetPoint call is relatively slow in analog mode since it has to get the value from the ocelot which has to get it from the secu16 module. So a script that uses a lot of these may take awhile to execute.

    sub main()
    'if using HS ocelot plugin
    level = cpuxa.GetPoint(2,0,false) 'get from module 2 point 0
    hs.SetDeviceString “A1”, level
    end sub

    sub main()
    'if using ADIocelot plugin
    set ocelot = hs.GetPlugins("ADIOcelot")
    level = ocelot.GetPoint(2,0,false) 'get from module 2 point 0
    hs.SetDeviceString “A1”, level
    end sub

    Comment


    • #3
      Hi,
      I will try this as a method to get the values in to HomeSeer. For some reason I figured if I set the input to 'Analog' in HomeSeer it would know how to poll the parameter value automatically.

      If I want to read this as a temperature, is there an easy way to create a virtual device that I can send this value? Since I will be doing it programatically I can create the value in whatever form necessary before HomeSeer picks it out of the variable.

      Thanks,
      Mark

      Comment


      • #4
        I'm really not sure what you're asking here. With either method you're going to get a number from 0-255. You'll have to scale/translate that something meaningful and store the value elsewhere. While you can do that within the Ocelot I would suggest doing it on the HS side since the Ocelot is limited to integer math and it's easy to lose digits.

        jim

        Comment


        • #5
          Jim,
          I figured I would do the math on the HS side. I have not really done much script work but it does not look terribly difficult..

          Shouldn't I expect the current plugin to at least read the analog value (tho useless) when I set the input type to Analog from digital I/O in the status list for that input? Equivalent to doing it via script and setting the GetPoint parameter to 'false'.

          Lastly, assuming I create this script and pull the value and perform the math inside the script in HS, is there an easy way to create a virtual thermostat object that I can place the reading? I saw an MCStemp plugin or something but it seemed tuned to specific temperature devices vs. generic.

          Thanks for all the help!

          Mark

          Comment


          • #6
            I can see why you would expect that. It's likely partly due to the api that the ocelot has- there's a command to poll all variables at once and one to poll all digital io/relay status; analog values have to be polled individually. Back when written it was likely an overhead issue with how long it could potentially take to get the data - the other thing is, I don't think analog option is used that much. At one time I had 7 or so analog inputs but I'm down to one now. I've only used that writeup 1-2 times since I wrote it in 2005.

            I've seen mention of virtual thermostat on the board but I've never really paid attention to them. I believe MCSTemp is one solution. Try searching and something might turn up.

            jim

            Comment

            Working...
            X