Announcement

Collapse
No announcement yet.

Can I add more readings for charting?

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

    Can I add more readings for charting?

    I would like to be able to add readings from my thermostats to the database and to the charts. I love the charts, but I could see they would be much more usefulto me, if I could see my thermostat readings. Both temp and on/off readings would be excellent.

    Can I just write to the MCStemperature database directly from my thermostat script?

    Or is there a way to add these into the MCS plug-in setup screens?


    Thanks,

    Scott

    #2
    For continuous data then it is simply a matter of defining a virtual devices and adding it to one of the sensor tabs of the setup page. Putting it on a Temp tab will work fine. You can store discrete data in the same manner, but the preferred method is record only the changes in discrete state. To do this you can use the scripting methods provided to define the table for each new discrete to be added, then use a second method to write the changes in state to the database. There are a couple places where this is discussed in the mcsTemperature forum. Bill Walton was the one who did it first and he did describe the detailed process in this forum.

    I'm doing special charting for temperature control as part of mcsControlSystems. I'm still not clear on exactly what this aspect of the plugin should do. My initial direction was for monitoring and control of energy transfer. I've had some inputs on "requirements" which I'm still contemplating how it all will fit together. The user interface is a big part of the problem with finishing it. The algorithms are not too difficult, but making access to them in a natural and convenient manner is what I dont yet understand.

    Comment


      #3
      Thanks.. actually it was much easier than I expected.

      I just modified my thermostat script to write only the temp data to another virtual device, I then entered that into MCSTemperature as another temp sensor, entered the database field name and poof, it worked.

      Cool....

      damn I really love ths stuff more and more each day, good thing I already program at work, or I could see myself sucked into this deeper.

      Michael,
      I can't begin to tell you how impressed I am with your work...

      Scott

      Comment


        #4
        I was able to get my Thermostat temp readings into the temp section of the database. Now I want to add other discrete components for charting, things like when the thermostat is on/off and others. When I try to add the devices it takes them but does not create the dB tables.
        Here is the log entry where I tried to add ~6 new items. It only added the tables for 2 but never put any data into them. If I try and do any charting for these I get more errors.

        Any ideas? I don't want to loose all my current temperature history.

        Scott

        <pre class="ip-ubbcode-code-pre">
        Log_Date Log_Type Log_Data
        11/23/2003 9:46:21 PM mcsTemperature Removing virtual device #1, datababase field tbl0F0000001FB92205S left in database
        11/23/2003 9:46:21 PM mcsTemperature Removing virtual device #3, datababase field tbl3F0000001FBFC505S left in database
        11/23/2003 9:50:30 PM mcsTemperature Creating database table for Sensor GdoorBottom_2 in C:\Program Files\HomeSeer\mcsTemperature.mdb
        11/23/2003 9:50:30 PM mcsTemperature Creating database table for Sensor GdoorTop_3 in C:\Program Files\HomeSeer\mcsTemperature.mdb </pre>

        Comment


          #5
          Here is my .ini

          (For some strange reason it would not attach to the first message, or this message so I am including it here)

          Scott
          <pre class="ip-ubbcode-code-pre">
          [Temperature]
          WeedLastDays=180
          WeedMaxInterval=60
          WeedFirstDays=30
          RelayCommandDelay="250"
          WDTString=""
          iconPixels="16"
          UseRelay05=false
          StoreRelay1=false
          StoreRelay2=false
          StoreRelay3=false
          StoreRelay4=false
          StoreRelay5=false
          StoreRelay6=false
          StoreRelay7=false
          StoreRelay8=false
          RetainSettingByClient=false
          InMenu=true
          forceHumidityScale=false
          UseHTML=false
          OnlyTemperatureIcon=false
          alwaysShowGraph=true
          UseForecast=true
          UseDatabase=true
          CSVDelete=false
          CSVDelete2=false
          CSVDelete3=false
          NormalPriority=false
          UseCSV=false
          UseCSV2=false
          UseCSV3=false
          UseWeatherPLUG=false
          AverageSites=false
          UseTemp05=true
          ShowRawData=false
          UseDS9097=false
          MetricInTemp=false
          MetricTemp=false
          MetricBaro=false
          MetricWind=false
          MetricRain=false
          EnableTriggers=true
          DisableWindow=false
          AlarmingSwitches=false
          UseSQL=false
          SQLSource=""
          SlowWeight=""
          FastWeight=""
          showTemperatureDataPoints=false
          LimitHumidity=false
          excludeHeaderAndFooter=false
          ShowOnlyDeviceName=true
          CompatibilityMode=false
          AllowLocalHostForTouchscreen=false
          Temp05Version5=true
          DebugLog=false
          DebugLog2=false
          VersionAfter416OrUsingV1=true
          usePreviousOnBadReadings=true
          NorthDirection="0"
          DSPort=""
          Temp05CommPort="4"
          StyleSheet="StyleNoBody.css"
          Database="mcsTemperature.mdb"
          TemperatureTable="Temperature"
          DateFieldName="SampleDate"
          TemperatureFieldPrefix="R"
          DataCollectionInterval=5
          LegendHeight="35"
          TemperatureHouse="`"
          decimalCharacter="."
          Version_Id=""
          GUIColor="black"
          TextColor="black"
          TableFontColor="black"
          MaxVerticalPixels=16
          GraphColorBase="motion/TEMP"
          bca="#000000"
          DisplayOrder="RCur"
          WindOnThreshold="5"
          RefreshImageRate="1"
          TemperatureDeviceLocation="Temperature"
          DiscreteSpacing="2"
          DSSampleInterval=1
          CSVSampleInterval=5
          CSVSampleInterval2=5
          CSVSampleInterval3=5
          T05SampleInterval=1
          high_wind="`50"
          MinimumHumidity="20"
          SignificantDigits="2"
          UserDefinedLabel0=""
          UserDefinedLabel1=""
          UserDefinedLabel2=""
          UserDefinedLabel3=""
          LineWidthTemperature="1"
          LineWidthOther="1"
          ClientChartOverallHeight=""
          ClientChartOverallWidth="600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500"
          ClientChartWidth="520, 620, 720, 820, 920, 1020, 1120, 1220, 1320, 1420"
          ClientChartHeight="210, 280, 350, 420, 490, 560, 630, 700, 770, 840"
          ClientChartScreenSize="600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500"
          LineChartBorderColor=D0D0D0
          LineChartCenterColor=FCFDCF
          DefaultLineColors=""
          Client0="Default,0"
          Client1=",0"
          Client2=",0"
          Client3=",0"
          DefaultPeriod=72Hour
          DefaultAggregate=None
          SelectedGroup=Default
          ReverseColorScale=false
          HouseCode=96
          HouseCode2=35
          DefaultGraph=LinTab
          UseQuasar=false
          QuasarPort=""
          QuasarSampleInterval=1
          [Forecast]
          ForecastVDCode0="R6"
          ForecastVD0=true
          ForecastChart0=true
          ForecastVDCode1="R8"
          ForecastVD1=true
          ForecastChart1=true
          ForecastVDCode2="R9"
          ForecastVD2=true
          ForecastChart2=true
          ForecastVDCode3="R10"
          ForecastVD3=true
          ForecastChart3=true
          ForecastVDCode4="R11"
          ForecastVD4=true
          ForecastChart4=true
          ForecastVDCode5="R12"
          ForecastVD5=true
          ForecastChart5=true
          ForecastVDCode6="R13"
          ForecastVD6=true
          ForecastChart6=true
          ForecastVDCode7="R14"
          ForecastVD7=true
          ForecastChart7=true
          ForecastVDCode8="R15"
          ForecastVD8=true
          ForecastChart8=true
          ForecastVDCode9="R16"
          ForecastVD9=true
          ForecastChart9=true
          ForecastVDCode10="R17"
          ForecastVD10=true
          ForecastChart10=true
          ForecastVDCode11="R18"
          ForecastVD11=true
          ForecastChart11=true
          ForecastVDCode12="R19"
          ForecastVD12=true
          ForecastChart12=true
          ForecastVDCode13="R20"
          ForecastVD13=true
          ForecastChart13=true
          ForecastVDCode14="R21"
          ForecastVD14=true
          ForecastChart14=true
          ForecastVDCode15="R22"
          ForecastVD15=true
          ForecastChart15=true
          ForecastVDCode16="R23"
          ForecastVD16=true
          ForecastChart16=true
          [Devices]
          F90000002B409F26V="R5,01,,1"
          F90000002B409F26A="R7,01,,0"
          F90000002B409F26="R1,02,,0"
          BA0008004187E510="R2,01,,0"
          D80008004179AB10="R3,05,,0"
          2C00080046A66F10="R4,04,,0"
          5F00080046CAAB10="R30,03,,0"
          [Database]
          R5="sF90000002B409F26V,20,1"
          R1="sF90000002B409F26,0,1"
          R2="sBA0008004187E510,0,1"
          R3="sD80008004179AB10,0,1"
          R4="s2C00080046A66F10,0,1"
          T10="thermostat_t1,0,1"
          T20="thermostat_t2,0,1"
          R30="s5F00080046CAAB10,0,1"
          ]2="GdoorBottom_2,11,1"
          ]3="GdoorTop_3,11,1"
          R7=",0,1"
          ^1="Server_1,11,1"
          ^2="Sparky_2,11,1"
          ^3="Router_3,11,1"
          ^4="External_4,11,1"
          ^5="Modem_5,11,1"
          N17="Router_17,11,1"
          N18="External_18,11,1"
          O20="Michele20,11,1"
          O21="Scott21,11,1"
          T11="Family_Tstat_11,11,1"
          T21="Master_Tstat_21,11,1"
          [Group]
          Default="None","LinTab","R1"-1,"R2"-1,"R3"-1,"R4"-1,"T10"-1,"T20"-1,"R30"-1
          Garage="None","LinTab","]2"-1,"]3"-1
          Network Usage="None","LinTab","^1"-1,"^2"-1,"^4"-1,"^5"-1,"N17"-1,"N18"-1
          Occupancy="None","LinTab","O20"-1,"O21"-1
          Temps -all="None","LinTab","R1"-1,"R2"-1,"R3"-1,"R4"-1,"T10"-1,"T20"-1,"R30"-1
          Temps -out="None","LinTab","R4"-1,"R13"-1
          Temps -inside="None","LinTab","R1"-1,"R2"-1,"R3"-1,"T10"-1,"T20"-1,"R30"-1,"R13"-1
          Temps-out="None","LinTab","R4"-1,"R12"-1,"R13"-1
          Thermostats="None","LinTab","T10"-1,"T20"-1,"T11"-1,"T21"-1
          [ASP]
          TempMonitorsAtticEquipmentTemp=checked
          TempMonitorsComputerRoomTemp=checked
          TempMonitorsAtticTempRoof=checked
          TempMonitorsOutsideNorthWall=checked
          FLocalMin=
          FCurrentMin=
          F1DayMin=
          F2DayMin=
          F3DayMin=
          F4DayMin=
          F5DayMin=
          FLocalMax=
          FCurrentMax=
          F1DayMax=
          F2DayMax=
          F3DayMax=
          F4DayMax=
          F5DayMax=
          TemperatureForecastCurrentTemperature=
          TempMonitorsFamilyRoomTemp=checked
          TempMonitorsMasterBedRoomTemp=checked
          TempMonitorsGarageTemp=checked
          AtticEquipmentTemp=checked
          ComputerRoomTemp=checked
          AtticTempRoof=checked
          OutsideNorthWall=checked
          FamilyRoomTemp=checked
          MasterBedRoomTemp=checked
          GarageTemp=checked
          MonitorsGarageTemp=checked
          Relay11=checked
          GarageClose=checked
          GarageOpen=checked
          MonitorsMonitorsGarageTemp=checked
          GarageClosed=checked
          Michele=
          Scott=
          ForecastCurrentTemperature=checked
          ForecastRealFeel=checked
          FamilyRoomThermostatStatus=
          MasterBedroomThermostatStatus=
          [LastState]
          S#5=2
          S#2=2

          </pre>

          Comment


            #6
            This has been a common question recently. There are a couple places in this forum where it was previously discussed. Bill Walton has a good description of what is needed in this discussion.

            Continuous data is periodically stored. Discrete data is store when a change is detected. When the interface manages the discretes it knows when the change occurs and stores the data to the database. When the discrete data comes from other places such as other plugins or virtual devices then you must tell the mcsTemperature plugin when a change has occurred. This is done with

            hs.GetPlugins("mcsTemperature").StoreDiscrete(TableName, Value).

            The value will be 0 or 1 and expecting to see alternativing values delivered since they should only be stored when they change. It will not hurt to have the same value repeated, but it just grows the table faster and makes query response slower as it gets bigger.

            If the table for a discrete is not created then it can be done via script with

            hs.GetPlugins("mcsTeperature").CreateDiscrete(TableName)


            When devices are removed from the plugin it does not remove the historical data from the database associated with that removed device. The intention is that you will use manual means with Access/SQL to do whatever you want this this historical data since it is no longer visible to the plugin.

            I do not recall what happens if you try to rename a database field from the plugin to an existing fields (such as one for which the device was deleted). I believe it will not let you. You can do it manually, however, by editing the mcsTemperature.ini file [Database] group should you want to reassociate the historical data from a previously deleted device to a new device.

            Comment


              #7
              This is a little clearer, so this means with the
              <pre class="ip-ubbcode-code-pre">hs.GetPlugins("mcsTemperature").StoreDiscrete(TableName , Value) </pre> command I actually have to send the data I want to MCSTemperature then it logs it to the table, right? Or am I just notifying it of a data change and telling it to get the data for itself?

              I am not understanding the 'value' field....

              sorry for seeming 'thick headed'

              Scott

              Comment


                #8
                So is the 'value' only a '1' or '0'

                I would like to be able to track my HVAC and it is dual stage. I was tracking the value as
                <UL TYPE=SQUARE>
                <LI> 0 = System off
                <LI> 1 = Stage 1 heat
                <LI> 2 = Stage 2 heat
                <LI>-1 = Stage 1 Cool
                <LI>-2 = Stage 2 cool[/list]

                This would be great to graph against outside and actual thermostat temps.

                Thanks..

                Scott

                Comment


                  #9
                  You have 3 discretes there. System, Stage 1, Stage 2. You could map your 5 values into 3 discretes using an external script. This would be the same script that sends the 0/1 to the plugin. You could also treat this as continuous data and put it on the Temp or UserDefined tabs. In this later implementation the change in state will only be recorded at the periodic interval which may be sufficient resolution for this application.

                  Comment


                    #10
                    I am trying... but all I can get is a 'type mismatch' error. what is it (value) expecting? I have tried both discrete and moving it to the temp side (prefered)

                    Scott

                    Comment


                      #11
                      I have tried for the last couple of hours to get this working, and all I can say is it is not consistant. What works perfectly for one script fails for another. Then what was failing now works after restarting HomeSeer...

                      so far this call:
                      <pre class="ip-ubbcode-code-pre">
                      mcs.StoreDiscrete cstr(TableName),clng(TValue)
                      </pre>

                      Works the most reliably, but that is for now...

                      I have another that works perfectly without the clng().

                      I just can't explain it.

                      Scott

                      Comment


                        #12
                        The value is an integer: Cint(xyz). Do take the opportunity to look for Bill Walton's input on this subject in this forum. I believe he has been using it for quite some time.

                        Comment


                          #13
                          and I'm using DooMotion Custom Action Code, e.g.:
                          <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>
                          set mcs = hs.Plugin("mcsTemperature")
                          mcs.StoreDiscrete "UpstairsBathroomMotion", 1
                          <HR></BLOCKQUOTE>
                          The same thing works in an external script triggered by an event. It seems to work 100% consistently.

                          --
                          Bill

                          Comment


                            #14
                            I will try forcing a cint(). I actually took Bill's code, cut and pasted it, created a device with the same name and was still getting the 'type mismatch errors'

                            This was in an actual script file. If I placed it in the script text box of an event it worked perfectly everytime.

                            Hence my confusion.

                            Scott

                            (Will cint() allow negative numbers?)

                            Comment

                            Working...
                            X