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

(Solved) Error: number expected, got boolean. -- Anyone that can tell me what I did wrong?


Teza

Question

The code in this post does not make sense.

I recalled having a similar problem earlier, so the correct code can be seen in post 3.

 

 

I get the following information from the debug:

 

 

[DEBUG] 19:14:55: Tid = 19:14, VariableType = string
[DEBUG] 19:14:55: Dag = 4, VariableType = number
[DEBUG] 19:14:55: Mnd = 5, VariableType = number
[DEBUG] 19:14:55: Soloppgang = 04:30, VariableType = string
[DEBUG] 19:14:55: Solnedgang = 22:03, VariableType = string
[DEBUG] 19:14:55: [1;31m2018-05-24 19:14:55.245120 [ fatal] Unknown exception: /opt/fibaro/scenes/96.lua:110: bad argument #2 to 'format' (number expected, got boolean)

 

And I believe the error is within this part of the code:

 

Please login or register to see this code.

The complete code looks like:

 

Please login or register to see this code.

 

Edited by Teza
Solved, and the code was so wrong that it was replaced with the code in post #3
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Of course it's wrong.

Look at this part:

Please login or register to see this code.

You're pushing 2 args to method "string.format". First one is: "%02d", second: TidsTabell.day == "01".

The second one is the result of comparision TidsTabell.day and "01", and result of comparision is always bool.

 

However I don't understand what you're trying to achieve, so I can't tell what should be there...

Is it possible that the code should look like this:

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thanks for the reply, and as you have already noticed I don't have programming skills.

     

    I started over again and ended up with the following code:

     

    Day and month is now working, but still need to get sunrise and sunset.

     

    Sunset/sunrise edited to:

    Please login or register to see this code.

     

    Also, "local Dag" and "local Mnd" should use the timetable instead of the "os.clock"

     

    Please login or register to see this code.

     

     

    Edited by Teza
    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...