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

display sunset time


ErnstH

Question

Hi all,

I would like to display a debug message with the time of sunset + an x amount of minutes. So there needs to be a calculation.

I have a few scenes whose start is dependent of the month, turning lights on earlier or later.

My debug message should be something like "today lights will be on at 21:15". That 21:15 is the calculated time.

I have these declarations at the start of scenes:

local sunsettime    = fibaro:getGlobalValue("SunsetTime");
local sunsetHour   = fibaro:getValue(1,'sunsetHour')

But I can't figure out how to do this. Shouldn't be very complicated, but i'm not good in LUA programming with time.

Hope someone can help me out.

Link to comment
Share on other sites

Recommended Posts

  • 0
1 hour ago, theuksbest said:

Is it not possible then to just have the current variable showing here, rather than a current report on all of them?

you can't wrote a single line on LUA?

right yeah?

Please login or register to see this code.

Please login or register to see this image.

/monthly_2020_11/image.png.2de4e24ed7d9943ea7c20d0a373cbedd.png" />

Link to comment
Share on other sites

  • 0

Please login or register to see this code.

 

 

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0

 

 

2 hours ago, 10der said:

you can't wrote a single line on LUA?

 

No sorry i'm a beginner, i can't really read or write LAU code except maybe some of the more simple logic.

 

ok thanks for your help, I think what i have understood is it should be logging all of those as events now. However, i couldnt select from a block scene, any of the events. I just get a question mark when i hover the mouse over the Change box?

 

Please login or register to see this attachment.

 

not sure where i'm going wrong with this

 

Link to comment
Share on other sites

  • 0
49 minutes ago, theuksbest said:

 

 

 

No sorry i'm a beginner, i can't really read or write LAU code except maybe some of the more simple logic.

 

ok thanks for your help, I think what i have understood is it should be logging all of those as events now. However, i couldnt select from a block scene, any of the events. I just get a question mark when i hover the mouse over the Change box?

 

Please login or register to see this attachment.

 

not sure where i'm going wrong with this

 

Events is only for pre-defined custom events  (General/Events)

...and I don't think that @10der's QA define and emit those.... maybe a good idea?

Link to comment
Share on other sites

  • 0
2 hours ago, theuksbest said:

not sure where i'm going wrong with this

 

just a moment 

i have idea

Link to comment
Share on other sites

  • 0
13 minutes ago, 10der said:

just a moment 

i have idea

Please login or register to see this image.

/monthly_2020_11/2f3118e536764d9baa92df373a90559a--husker-du-var.jpg.b32426175e586fe6dd98fd98c261b75c.jpg" />

  • Like 1
Link to comment
Share on other sites

  • 0

oops! :( 

blocks can`t implement what I want... sorry.

Please login or register to see this attachment.

 

vice versa

to globals - simple value 

Please login or register to see this attachment.

 

for advanced users 

local value = json.decode(fibaro.getValue(1639"userDescription")) 

here is json with details

Link to comment
Share on other sites

  • 0

@10der ok... so installed the new QA and seems all working, and I can see in the global Variable the DayPart single event perfectly like you have above. However, I still can't seem to use it as a trigger in a scene, it's just not triggering - I'm sure this is just me not fully understanding how this works, but hoping you could point me in the right direction again;

 

I cant see why this isn't working..? (id 274 is just a door/window sensor to make sure the window is closed)

Please login or register to see this code.

 

If I run the scene manually it works fine, so it's just getting the trigger working

 

any ideas?

 

Link to comment
Share on other sites

  • 0

IMHO sunset is uppercase should be 

Idk what fibaro devs developed but in global QA set value with uppercase 

why is not triggered? Idk 

i have a bad skills right now in HC3 scenes 

sometimes hc3 look like crazy cuz 

sometimes is not triggered 

sometimes has wrong behavior as for me 

and  ? on the ? sometime calling params wrong with calling params and order params with QA

so, what I can recommend- RTFM 

Please login or register to see this link.

but i can 1000500% says what this demo works

 

 

left

{
  conditions = { 
        {
            id = 1639,
            isTrigger = true,
            operator = "!=",
            property = "userDescription",
            type = "device",
            value = ""
        }, 
  },
  operator = "any"
}
 
right
 
if sourceTrigger.property == "userDescription" then
    local event = json.decode(sourceTrigger.value)
    print("EVENT ", event.dayPart, " is OCCURED")
end
 

Please login or register to see this image.

/monthly_2020_12/image.png.1438f55bf884665947962a0a309cb510.png" />
Link to comment
Share on other sites

  • 0

Please login or register to see this image.

/monthly_2020_12/image.png.daf250fcd44b1e14a5f9ddda52c08f67.png" />

 

 

image.png.abc3d26163889b1677448293aa9e2656.png

 

ok! lets seeyou at the morning!

 

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
2 hours ago, 10der said:

so, what I can recommend- RTFM

?

 

I’ve changed to uppercase too and also set it up for the morning. Although i thought as its the weekend I’d test SUNRISEEND instead! ;) give me some extra sleep time!

 

Thanks for the help

Link to comment
Share on other sites

  • 0
On 11/21/2020 at 11:49 PM, theuksbest said:

@10der still haven't been able to get a scene to trigger properly, can you see anything obvious?

 

left (id 274 is just a window sensor to make sure the window is closed before the blinds close)

Please login or register to see this code.

 

 

right

Please login or register to see this code.

 

 

Edited by Jay Ess
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...