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

Humidity spike as Trigger


Julegeita

Question

Hello!

 

I am new to to Lua coding and coding generally, and i am struggeling to be satisfied with my bathroom fan control during shower.

 

Devices: Netatmo Indoor and outside module and Fibaro Relay

 

Per now, I control my bathroom fan, by monitoring the humidity in the room and set the fan to start at a given level like below.

This is made by normal scene blocks.

 

(If OUTSIDE humidity > 90 AND INDOOR humidity >= 60 = "Turn on")

(If OUTSIDE humidity > 90 AND INDOOR humidity < 60 = "Turn off")

(If OUTSIDE humidity < 90 AND INDOOR humidity >= 55 = "Turn on")

(If OUTSIDE humidity < 90 AND INDOOR humidity <55 = "Turn off")

 

The outside criteria "helps" on wet and rainy days, by not letting the fan start on its own due to rise in humidity.

Due to the fact that outside humidity plays a HUGE role on the inside humidity, my setup must be modified all the time because of seasonal changes.

 

What i would really want is a script that does the following using only the inside humidity and the relay:

 

The plugin for Netatmo pulls information every minute, but the Netatmo itself only uploads to the API site every 10 min. Så when i get a rise in humidity, i allways get atleast 5% at a time.

That means the Fibaro thinks it gets 5% rise in one minute (if i think at this correctly)

 

I want a sudden rise in humidity, regardless of the outside OR the inside humidity, to trigger the fan. (Example: from 25-->30, 45-->50, 52--57)  

The thing i think is tricky, is that you actualy must "save" the previus value and compare it to the new?!?

 

If i get the fan to trigg this way, i could easily set up another scene to stop the fan after an hour.

BUT, it would be much more awsome if the fan stayed on until the humidity value BEFORE the spike was reached.

 

Does anybody have a solution for this? :)

 

I know the guy at the top of this topic, providing the link, has made this in Domoticz - 

Please login or register to see this link.

 

Sorry for my horrible english writing!

 

Best regards

Link to comment
Share on other sites

Recommended Posts

  • 0

The topic has been moved from "

Please login or register to see this link.

" to "

Please login or register to see this link.

".

 

Temat został przeniesiony z "

Please login or register to see this link.

" do "

Please login or register to see this link.

".

Link to comment
Share on other sites

  • 0
Quote

Devices: Netatmo Indoor and outside module and Fibaro Relay

 

It's important to know that Netatmo is not optimal for this type of regulation.
Netatmos indoor and outdoor modules only updates its values every ten minutes.
So if you can accept a delay of up to ten minutes, so it's OK to use it.

Otherwise, it is better and easier to use a Z-wave multisensor.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • barend121:

    Not sure i get the whole meaning of your question.

    I can imagine using a Global variable to feed the results to, and to store it there yes.  

    But I am struggelig how to wrap my head around how to update this variable at the right time, and making sure it is not  overwrited when the difference is big enough to                           start the scene.

    Because at that point, the same number will be the target number to reach before the fan turn off again?!

     

    RH:

    Yes, i am fully aware of this irritating problem. I bought a Aeotec Multisensor 6 a year ago, but I had some big problems with it dying on me on battery. The temperature settings in Fibaro GUI was also displaying wrong.

    Common problem i heard.

    I have later installed more sockets in the bathroom, so i tried adding it yesterday again, but USB powered.

    So i am testing it out now. If it dies again, i think i will invest in a Everspring unit to do this job.

    Regardless the coding will be the same i think, just different times and deviceID's?!

     

            

    Edited by Julegeita
    Link to comment
    Share on other sites

    • 0

    OK!

    I have three Aeon multisensors (USB) that work flawlessly.
    Just keep in mind that it's important to include the multi-sensor with USB power supply.
    Including it with battery and then change to USB cable, it will behave strangely.

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I Included it with USB power. The documentation says it reports in 3DEC, and that seems to be the problem.

    Mine is version 1.7.  I can see now from work, that is had not died yet, but it does not report anything back.

     

    When i get home i will try deleting it, and adding it in secure mode, but i have read that that almost always makes even more problems.

    I am also trying to get hold of an Aeotec z-wave stick on the internet, to try upgrading to 1.8.

    The change-log said it changes the 3dec to 2dec reporting, which Fibaro uses.

    The downside, is that it also makes the minimum report-time 240 sec. Now it can report at any rate i want.

     

    Any idea with the script though? :)

    Link to comment
    Share on other sites

    • 0
    Quote

    Mine is version 1.7.  I can see now from work, that is had not died yet, but it does not report anything back.

     

    If I remember right I had to set some parameters to get it work correct.

    Here are the parameters for mine Aeon Gen 5.

     

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    The code below is a very easy way to control the fan, but you do not take into account that the humidity also varies depending on the weather.
    A better solution is to compare the value of two sensors.
    One sensor is centrally located in the house and the one that controls the fan is in the room where the fan is located.

    Please login or register to see this code.

    Sample 2

    Please login or register to see this code.

     

    Edited by RH_Dreambox
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  •  

     

     

    With your settings the temp also went to 0. Other than that is is still not giving anything back.

     

    Please login or register to see this attachment.

     

    Regarding the script, I am on my way trying to make something :P

     

    I have made a Variable named "Hum_Compare"

    The goal for this is to push the value pulled from the Netatmo to this every 20 minutes if the fan is "off".

    When the fan is "on", i hope to use the value as target value for the netatmo to trigger the fan off again. And then again it starts updating every 20 minutes.

    I also hope to make some kind of maximum run time for the fan, like 1,5hours, then it turns off anyway.

     

    Please login or register to see this code.

    When i run this, the debug said the fan was turned "off" and the Hum_Diff = 43 (the same as the current Humidity, due to the variation being 0 atm)

    So this kinda works, as you see, its based off someone else's code which compared the humidity between other rooms to trigger the fan.

    Was this yours originally? :P

     

     

     

     


     

     

    Link to comment
    Share on other sites

    • 0
    Quote

    With your settings the temp also went to 0. Other than that is is still not giving anything back.

     

    As I wrote, I have Gen 5 and you model 6.
    It is perhaps best to check if the parameters are different.
    And is polling active (Devices uses global polling ...)?

     

    I also see that you don't need any programming help :-) 

    Link to comment
    Share on other sites

    • 0

    Reporting of MS6 depends on many parameters and also if it was included on batteries or USB.

     

    The latest info, correct for firmware 1.7 or 1.8 can be downloaded from:

     

    Please login or register to see this link.

     

    I cannot give more details, I have excluded my only MS6 last week because it eats batteries and I cannot seem to solve that problem...

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 2 hours ago, RH_Dreambox said:

     

    As I wrote, I have Gen 5 and you model 6.
    It is perhaps best to check if the parameters are different.
    And is polling active (Devices uses global polling ...)?

     

    I also see that you don't need any programming help :-) 

     

    I am stuck several places with the programming :P

     

    I need to get the value from the Hum Sensor printed to the global variation, and i cant seem to find a way to do that... Everything i try, it stays at zero like it is when its named in "Panels".

     

    Please login or register to see this code.

    Something like this in the way of thinking... :)

     

     

    Edited by Julegeita
    Link to comment
    Share on other sites

    • 0

    First of all
    Does your multisensor work now?
    If not:
    Make a manual reset of the sensor.
    (Press and hold for 20 seconds.)

     

    Include it again in your Zwave network (with USB cable).

    "Etter det kan vi snakke programmering" ;)

     

    EDIT

    Are you going to use two Aeon multisensors as main and reference, or one main Aeon and reference Netatmo?

    If you use Netatmo as a reference, does it send the humidity value to the global variable "Hum_Compare"?

    Edited by RH_Dreambox
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 2 minutes ago, RH_Dreambox said:

    First of all
    Does your multisensor work now?
    If not:
    Make a manual reset of the sensor.
    (Press and hold for 20 seconds.)

     

    Include it again in your Zwave network (with USB cable).

    "Etter det kan vi snakke programmering" ;)

     

    It has been working since yesterday for some reason. It might have been the parameter you gave me, and me being to quick to dismiss the correction :)

    I am currently running the fan with the code that compares Hum in room with Hum in other room (in my case, the livingroom Netatmo)

    I have changed the Hum device in the bathroom to the Multisensor, and if it continues to work this way its great! It reports every 5 sec, which makes it start very soon after a shower is started :)

    So i am still in a "test" period for this device.

     

    Regarding the programming

    "Her er jeg ganske blank, og det er MYYYE googling, prøving og feiling på gang her!"

     

    The scene I am currently running is actually almost everything you need.

    The only downside is that, the Humidity outside the house varies a lot, and is often higher than inside. 

    On warm days or in other suitable situations you would like to have the balcony door open, the humidity in the living-room will quickly rise, and the hum_diff will start going in -%, which again means i might have to reach a level of 10-15# higher in the bathroom for the fan to start.

    This has kind if sparked an interest with me, trying to learn a bit of the Lua language and contructing the code i want.

     

    I want to make a code that updates a variabel at a set time (etc 20min) and compares the Humidity in the bathroom to this value.

    If greater that 5% up, the fan starts and the variabel is not updated again, before the Hum_Real reaches the Hum_Variable again and the fan stops.

     

    Im trying to play around with some of the Lua timer/interval syntaxes, but i am struggeling on even a simple debug statement to work at an interval.

    Syntaxes i dont understand how to make:

     

    1. To push the value from getValue(300,"value") which is the humidity sensor ,to a Global variable named Hum_Compare made under "Panel" in Fibaro. This value must be available to be used by another scene syntax.

    2. To get the function from above,to work on a timer, that only runs while the Variable for the fan is "ON".

     

    If we could make this, the code you came up with, which i am using now, can be used against this variable instead of the livingroom value. Which would make the bathroom an independent enviroment considering the humidity.

     

    "Hvis det er lettere, kan vi ta dette over private meldinger og evt poste løsningen her hvis vi finner en :)"

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Please login or register to see this code.

    Debug: line 32: Syntax error near "function"

     

    Here you have an example of the idea i have :)

    Edited by Julegeita
    Link to comment
    Share on other sites

    • 0

    To check if fan is off you can use:     (Or do you use the variable "VifteBad" for other scenes to?)

    Please login or register to see this code.

    And I don't think you can use both sensors as triggers, so remove "294 value".

     

    Regarding your Timer function, I would like to pass that question to a specialist, @petergebruers. I hope he reads this :-) 

    Edited by RH_Dreambox
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 47 minutes ago, RH_Dreambox said:

    To check if fan is off you can use:     (Or do you use the variable "VifteBad" for other scenes to?)

    Please login or register to see this code.

    And I don't think you can use both sensors as triggers, so remove "294 value".

     

    Regarding your Timer function, I would like to pass that question to a specialist, @petergebruers. I hope he reads this :-) 

    VifteBad is only used for this, thats why i bade it :)

    So your way is easier.

     

    Regarding the info provided at the very top.

    Does the things written there have anything to say to the real script?

    I though it was just info and referenses if the script was confusing to read.

     

    If you can. Please explain what Properties,events,global things in top, has to say in the script. :)

    Link to comment
    Share on other sites

    • 0

    Everything you write in the header serves as a trigger. For example:

    %% autostart (starts the scene automaticly when you save the script or the box is restarted)

    %% properties

    312 value (starts the scene when the humidity value changes)

    %% globals

    Hum_Compare (starts the scene when your Global variable is changed)

     

    So in your case you can use %% 312 value to start the scene when humidity changes.

    If you run the scene all the time you only need %% autostart, and check the humidity "by the fly".

     

    But you have to explain for me what do these 20 min?

    Are you going to check the humidity every 20 min, or should the script wait 20 min after the fan is off and then run the script again?

     

    How should your script work?

    1. Check the humidity in bathroom

    2. If value is bigger than ref. room + diff then switch on the fan

    3. If value is lover or equal the ref. room + diff, switch off the fan

    4. What more?

    5. Go to step 1

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Of corse... The triggers :) Thanks

     

    The function of the script:

     

    The the whole thing is based on getting Hum_Stored updated at a regular interval of 20 min.. or 10, would make no difference, the point is to store a reference value which also follows the natural humidity due to the outside to a reasonable degree.

     

    This Hum_Stored only gets updated while the fan is off.

     

    If the fan is on, i would like to use the same Hum_Stored, as the target value for the fan to stop again.

     

    So

     

    1. Check the humidity in the room

    2. If Hum_diff (Hum_bath - Hum_Stored is higher than Hum_Trigger --> Turn fan ON (and stop updating Hum_Stored.

    3. Leave fan ON until Hum_bath reaches the value of Hum_Stored. Then turn fan OFF.

    4. Fan OFF starts the updating every 10/20 minutes to the Hum_Stored again.

    Then loop all this :)

     

    Does that make any sense to you?:)

     

    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...