No announcement yet.

Discretes not logging correctly

  • Filter
  • Time
  • Show
Clear All
new posts

  • Discretes not logging correctly

    I am currently working with version The logging and graphing of all my temperature values is working just fine. However, the discrete values that I have configured are only logging when the device transitions from 1 to 0. Any ideas on how to fix this?

    Thanks for your help.

  • #2
    The design is to log only on changes from 0/1 and 1/0. Each discrete has its own table while the continuous data share a common table that is periodically updated. In some applications the logging is only done when there is a change from the last value stored in the database and in other it records every time a HS event indicates a change. I dont recall which is being implemented with mcsTemperature, but they shoudl be the same except the cases when HS powers-up and the database state and the HS state are different.


    • #3
      Thanks for your reply.

      I understand how it is suppose to log only on changes from 0/1 and 1/0. My problem is that it is only logging on changes from 1/0, and therefore I am only recording zeros in the database. Any ideas why it isn't logging the transitions from 0/1?


      • #4
        Are your discretes from something mcsTemperature manages such as DS9097U/Temp08 or from HS virtual devices?
        Have you looked at the database table and only 1's are in it or is the issue the graphs dont show transitions? If graphs are you using the 6 hour chart when showing discrete?


        • #5
          The discretes I am logging are from HS virtual devices. The database tables only have 0's in them with a few entries having durations as well. I have been using the 24 hour chart.


          • #6
            As a test I enabled the general debug which produces a .txt file in \Data\mcsTemperature, added a HS device to Sensor page and then via event toggled the DeviceStatus of that virtual device and received the following in the debug log file. The debug shows the logging of a 1 and a 0. Are you certain your virtual device changes status? mcsTempeature does not record changes in DeviceValue, but in DeviceStatus.

            12/23/2010 11:47:32 AM 42452.5 | mcsTemperature Debug | Check Device Event $8=2,DictionaryExists=True
            12/23/2010 11:47:32 AM 42452.5 | mcsTemperature Debug | LogDiscrete 1, Table=tblD8, UseDatabase=True, databaseSchemaIsBeingChanged=False
            12/23/2010 11:47:32 AM 42452.5 | mcsTemperature Debug | Log Discrete INSERT INTO tblD8 (SampleDate,Discrete) SELECT #2010-12-23 11:47:32 AM# AS QT,1 AS Q1

            12/23/2010 11:47:34 AM 42454.25 | mcsTemperature Debug | Check Device Event $8=3,DictionaryExists=True
            12/23/2010 11:47:34 AM 42454.25 | mcsTemperature Debug | LogDiscrete 0, Table=tblD8, UseDatabase=True, databaseSchemaIsBeingChanged=False
            12/23/2010 11:47:34 AM 42454.25 | mcsTemperature Debug | Log Discrete INSERT INTO tblD8 (SampleDate,Discrete) SELECT #2010-12-23 11:47:34 AM# AS QT,0 AS Q1


            • #7
              Thanks for the info, I think I know the cause of the problem. I tried logging some different HomeSeer devices and I got them to work. The ones that are not working are being controlled by a vbscript that is using SetDeviceString. The status in HomeSeer is definitely changing from Off to On and back again. I modified the vbscript to use SetDeviceStatus, but it still did not work. Any ideas on how I can fix this?


              • #8
                In the event for the test I ran I used something like the following to toggle the ON/OFF status by setting the devide status to 2 and 3.

                hs.SetDeviceStatus "XX",((hs.DeviceStatus("XX")+1) mod 2) + 2

                When HS recognizes that a DeviceStatus changes it will invoke the HSEVENT procedure of each plugin that subscribes to event notification. mcsTemperature has some debug such as I posted when the General Debug option is enabled with the output going to a .txt file in \Data\mcsTemperature with the name containing "General" plus some date info. You can try it to see if anything of interest shows up in the debug output.

                There are bits in the .misc property that I think affects some callbacks for DeviceValue changes, but I do not think there is anything for DeviceStatus. All DeviceStatus changes should resut in the event callback. There is also a HS scripting method that is something like hs.RegisterEventCB (look in help for correct name and parameters). With this you will be able to have a script receive the callback and then do further investigation if the callbacks are being produced by HS for the devices that you are using.


                • #9
                  Thanks a lot for all your help, you were able to point me in the right direction. For the solution, I ended up using SetDeviceStatus rather than SetDeviceString. In my previous post I said that SetDeviceStatus didn't work, but that was only because I had changed all the logic in the parenthesis of the function, but I forgot to change String to Status; it must of have been getting to late that night.

                  One last note, can you point in the direction of how I can have a MCS Graph display on HSTouch?