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

LUA ~ temperature RGBW


stefx

Question

change color each degree C° from red > yellow > green > blue > purple and 34°C to -6°C

Please login or register to see this code.

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Hi!

Thank you for the code!

I have installed a RGBW LED and would like to use this code, but I do not have a physical temperature sensor outside.

How canI get the Yahoo weather temperature and store it in the variable 'OutsideTemperature'?

Thanks for the help!

// Erik

[ Added: 2013-11-14, 01:43 ]

Forget it, I solved it myself.

//Erik

Link to comment
Share on other sites

  • 0
Guest Charly

Hello SteffX,

I played a bit around with your code made a bit shorter.

Please login or register to see this code.

Link to comment
Share on other sites

  • 0
Hello SteffX,

I played a bit around with your code made a bit shorter.

Girls are watching Strictly Come Dancing on the TV

Please login or register to see this image.

/emoticons/default_icon_eek.gif" alt=":shock:" />

As always not tested... and I have just had a large meal and a glass of wine or two.

As you have a table why not use the index rather than the loop. As I say not tested but LUA is so weakly typed think it will work.

Please login or register to see this code.

Link to comment
Share on other sites

  • 0
Guest Charly

Robert,

Your change gave an error in line 8 the '=' is to close ????

grtz merry Christmas,

Charley

Link to comment
Share on other sites

  • 0

hmm try that.

I was a bit lazy and thought that I would get away without need for [] with numeric index

Call the Midwife now. ahhhh UK TV at christmas. Large Brandy needed.

Link to comment
Share on other sites

  • 0
Guest Charly

I have fixed it According to your indexed table included the []

Also took out the Temp variable because there is no need if the index is the temperature

Thanks.

Please login or register to see this code.

Link to comment
Share on other sites

  • 0

Nice, should save a bit of processor.

It should also work with an integer. Will have a go when my HC2 comes back from repair.

[ Added: 2013-12-25, 22:56 ]

for our friends that live closer to the equator an elseif >34 would be the finishing touch

I wish

Please login or register to see this image.

/emoticons/default_laugh.png" alt=":lol:" />

THe temp could be useful if your sensor is slightly out... use temp to hold correct temp?

You may need to floor the value so it is round integer.

Please login or register to see this code.

Link to comment
Share on other sites

  • 0

HI guys, I try to make the same scene but with temperature of my room.

But HC2 cause problem:

"[ERROR] 12:54:29: line 51: attempt to index local 'v' (a nil value)"

Link to comment
Share on other sites

  • 0
Guest Charly

Easy to solve.

Your temperature is not an integer, with floor it round to an integer.

local OutsideTemp=math.floor(tonumber(fibaro:getValue(XXX, "value")));

XXX = DeviceId of your temperature sensor

Link to comment
Share on other sites

  • 0
Guest Charly

Hello Dima

math.floor(x) will not work the function does not exsist.

here is a workaround

function round(num)

return math.floor(num+.5)

end

Good luck

Charly

Link to comment
Share on other sites

  • 0

Please login or register to see this code.

a very little more simple...

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