Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Temperature Check


Stealth

Question

Hi, Can someone help?

 

I have an HC2 and I have been several hours trying to figure out how to write some LUA code to check the temperature of my Solar Thermal panel and if its at least 10 degrees hotter than my water tank to then switch the pump on. I worked out how to do the comparison check between the two temp sensors but my issue is how do I do the the same but check its at least 10 degrees hotter.  I also only need to run the pump between the hours of 8am to 10pm each week day.

 

Any help would be appreciated.

 

local SolarTemp     = 735    -- ID number Solar temperature sensor

local TankTemp     = 744    -- ID number Water Tank temperature

 

local SolarTemp   = fibaro:getValue(735, "value") -- Temperature Solar

local TankTemp   = fibaro:getValue(744, "value") -- Temperature Tank

 

if

               SolarTemp more than 10 degrees higher than TankTemp

                              Then

                              Turn Solar Pump On

        else

               Turn Solar pump off

 

   end

Edited by Stealth
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0
6 hours ago, Stealth said:

Hi, Can someone help?

 

I have an HC2 and I have been several hours trying to figure out how to write some LUA code to check the temperature of my Solar Thermal panel and if its at least 10 degrees hotter than my water tank to then switch the pump on. I worked out how to do the comparison check between the two temp sensors but my issue is how do I do the the same but check its at least 10 degrees hotter.  I also only need to run the pump between the hours of 8am to 10pm each week day.

 

Any help would be appreciated.

 

local SolarTemp     = 735    -- ID number Solar temperature sensor

local TankTemp     = 744    -- ID number Water Tank temperature

 

local SolarTemp   = fibaro:getValue(735, "value") -- Temperature Solar

local TankTemp   = fibaro:getValue(744, "value") -- Temperature Tank

 

if

               SolarTemp more than 10 degrees higher than TankTemp

                              Then

                              Turn Solar Pump On

        else

               Turn Solar pump off

 

   end

Please login or register to see this code.

 

 

I have started to relpy you and later i noticed that you need the code for HC2. I dont know HC2, but i think it should be very similar, or at least you can get some hints from this..

I didnt test it, but i think it should work..

 

 

Edited by Neo Andersson
Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thank you for your reply.

     

    I tried the following code with the QuickApp commented out as there are no QuickApp's in HC2 to my knowledge-

     

     

    --function QuickApp:loop()


    local ctime = os.date('%H:%M')    
    local cday = os.date('%w')
    local SolarTemp = fibaro.getValue(735,"value")
    local TankTemp = fibaro.getValue(744,"value")  
      
        self:debug("Checking Solar temp and TankTemp...")

          if ctime > "08:00" and ctime < "22:00" and cday > 0 and cday < 6 and (SolarTemp > TankTemp + 10) then
            self:debug("Starting the pump...")
            --HERE START THE PUMP    
            fibaro.call(pumpID,"turnOn")
         else
            self:debug("Stopping the pump...")
            --HERE STOP THE PUMP
            fibaro.call(pumpID,"turnOff")
        end    
     
        --CHECK EVERY 15 MIN
        fibaro.setTimeout(1000*60*15, function() 
            self:loop()
       end)

     

    I'm getting the following debug error -

     

    [DEBUG] 08:32:00: 2023-01-23 08:32:00.075955 [ fatal] Unknown exception: /opt/fibaro/FibaroSceneAPI.lua:116: attempt to concatenate local 'propertyName' (a nil value)

     

    Link to comment
    Share on other sites

    • 0
    2 hours ago, Stealth said:

    Thank you for your reply.

     

    I tried the following code with the QuickApp commented out as there are no QuickApp's in HC2 to my knowledge-

     

     

    --function QuickApp:loop()


    local ctime = os.date('%H:%M')    
    local cday = os.date('%w')
    local SolarTemp = fibaro.getValue(735,"value")
    local TankTemp = fibaro.getValue(744,"value")  
      
        self:debug("Checking Solar temp and TankTemp...")

          if ctime > "08:00" and ctime < "22:00" and cday > 0 and cday < 6 and (SolarTemp > TankTemp + 10) then
            self:debug("Starting the pump...")
            --HERE START THE PUMP    
            fibaro.call(pumpID,"turnOn")
         else
            self:debug("Stopping the pump...")
            --HERE STOP THE PUMP
            fibaro.call(pumpID,"turnOff")
        end    
     
        --CHECK EVERY 15 MIN
        fibaro.setTimeout(1000*60*15, function() 
            self:loop()
       end)

     

    I'm getting the following debug error -

     

    [DEBUG] 08:32:00: 2023-01-23 08:32:00.075955 [ fatal] Unknown exception: /opt/fibaro/FibaroSceneAPI.lua:116: attempt to concatenate local 'propertyName' (a nil value)

     

    You cant just comment out the function...Please wait for someones advice, who is familiar with HC2 usage...

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Can anyone help advise what's wrong with this code when run on a HC2 please?

     

    I want to run an if check to start a pump when the SolarTemp sensor is 10 degrees hotter than the TankTemp.

     

    --[[
    %% properties
    %% events
    %% globals
    --]]

    local SolarTemp = fibaro.getValue(735,"value")
    local TankTemp = fibaro.getValue(744,"value")  
      
        self:debug("Checking Solar temp and TankTemp...")

          if (SolarTemp > TankTemp + 10) then
            self:debug("Starting the pump...")
            --HERE START THE PUMP    
            fibaro.call(pumpID,"turnOn")
         else
            self:debug("Stopping the pump...")
            --HERE STOP THE PUMP
            fibaro.call(pumpID,"turnOff")
        end


    Debug error -

     

    DEBUG] 19:56:02: 2023-01-24 19:56:02.426336 [ fatal] Unknown exception:

    /opt/fibaro/FibaroSceneAPI.lua:116: attempt to concatenate local 'propertyName' (a nil value)

    Link to comment
    Share on other sites

    • 0
    On 1/24/2023 at 9:00 PM, Stealth said:

    Can anyone help advise what's wrong with this code when run on a HC2 please?

     

    I want to run an if check to start a pump when the SolarTemp sensor is 10 degrees hotter than the TankTemp.

     

    --[[
    %% properties
    %% events
    %% globals
    --]]

    local SolarTemp = fibaro.getValue(735,"value")
    local TankTemp = fibaro.getValue(744,"value")  
      
        self:debug("Checking Solar temp and TankTemp...")

          if (SolarTemp > TankTemp + 10) then
            self:debug("Starting the pump...")
            --HERE START THE PUMP    
            fibaro.call(pumpID,"turnOn")
         else
            self:debug("Stopping the pump...")
            --HERE STOP THE PUMP
            fibaro.call(pumpID,"turnOff")
        end


    Debug error -

     

    DEBUG] 19:56:02: 2023-01-24 19:56:02.426336 [ fatal] Unknown exception:

    /opt/fibaro/FibaroSceneAPI.lua:116: attempt to concatenate local 'propertyName' (a nil value)

    My friend, please dont use this code likt this...I wrote it for HC3, and it is a LOOP function..In this way it will not work..

    On the other hand, you need to replace the "pumpID" variable with the real ID of your pump device..What is you pump ID?

    I really dont know what is the HC2 syntax, but for sure the code will not work if you dont define the pumpID variable, or replace it with the ID of the pump.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi thank you for your reply. The pump ID is 145

     

    regards

     

    Steve

    Link to comment
    Share on other sites

    • 0

    Hello @Stealth ,

     

    Here is a simple code for the HC2 LUA scene:

    Please login or register to see this code.

    Scene will run every time when any of the temperature change and either start or stop the pump. To save some z-wave traffic, command for pump to start or stop will be sent only if necessary.

    Scene will check temperatures and start or stop the pump only between time set by from_time and to_time. Outside this period pump will be stopped if running or no action will be executed.

     

    NOTE - you can remove temperature sensors from scene header and run this scene every minute using my Main scene FTBE:

     

     

    Edited by Sankotronic
    Modified code on user request
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi Sankotronic,

     

    Thank you for your reply and the coding, its much appreciated. 

     

    Just one thing, I would only want the pump to run (when it reaches temperature) between the hours of 8am until 10pm each day. Can you advise how best to code that?

     

    for information, sorry but I gave the wrong pump ID, it should be ID:1056

     

    Kindest regards

    Steve

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...