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


unexpected termination of the script


10der
 Share

Recommended Posts

 

Hi! 

dear Fibaro, can you create a warning message like a 

Please login or register to see this image.

/monthly_2017_07/597250cc6b8ac_1g2tlXA82s1.png.6dc87b329263c38193f472df2c1350a7.png" alt="597250cc6b8ac_1g2tlXA82s1.png.6dc87b329263c38193f472df2c1350a7.png" />

when FIBARO core stop LUA scripts unexpectedly?

 

[DEBUG] 21:34:27: LAMP: OFF (TIMEOUT)
[DEBUG] 20:15:05: LAMP: OFF (TIMEOUT)
[DEBUG] 20:31:06: LAMP: OFF (TIMEOUT)
[DEBUG] 03:52:00: line 35: unexpected character @ character: 1 0:1 [�] line:
[DEBUG] 03:52:00: �

 

Thank you.

 

PS: it's simple while true do script... 

 

 

Please login or register to see this code.

 

 

Link to comment
Share on other sites

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

Hello,

 

Do you mean that you would like a notification in the Notification Center? Or do you want an information like this next to a LUA scene box?

 

Link to comment
Share on other sites

@T.Konopka,

 

Above error is not caused by user LUA scene and line:35 that error message is referring to is from some script that is part of the HC system. After restarting LUA scene it is working again normally until next occurrence of this error which is in my case very rear.

 

This is definitely one nasty bug in the HC system. It is nasty because it is very hard to reproduce it and it is very rear so I didn't manage to find out what cause it. I also know that this is old bug because it happened to me on older firmware versions from 4.080 onwards.

 

Solution would be to remove this bug from the system, but it will be difficult task so probably will never be done. Don't take me wrong, it will not be done because every bug removal requires some resources and resources cost money, so there is always question is it worth it.

 

Fibaro system don't have any watchdogs that can inform users if any of the looping code stopped working. Adding this feature is nice, but again it requires resources that I don't think Fibaro is willing to invest in this moment to that matter.

 

@10der,

 

There is a Watchdog scene on French Fibaro forum that can monitor running scenes and VD main loops. It is not perfect, but it does what it is made for. You can find it on this link:

 

Please login or register to see this link.

 

If you don't have account there you will have to make it and make one post in Newbies - present yourself.

 

I use this scene for some time now and it works perfect with scenes, but has still some problems with virtual devices reporting that main loop has stopped but is actually working. It can restart stopped scene or VD main loop or just inform you so that is solution you are looking for.

 

Link to comment
Share on other sites

@Sankotronic

28 minut temu, Sankotronic napisał:

is nasty because it is very hard to reproduce it and it is very rear so I didn't manage to find out what cause it. I also know that this is old bug because it happened to me on older firmware versions from 4.080 onwards.

You are right. I have the same problem. It is a bug of the system HC2 (  line 35: unexpected character @ character: 1 0:1 [�] line: ).

Link to comment
Share on other sites

I have been speculating for a long time that this error comes from JSON decode, because it reads as "there is no character at the beginning of the data and the data is empty". Which makes sense if a http requested timed out or returned no data (although that could be a nil result too). I have checked this with other users and they don't have json.decode in their script. But here is the thing. Maybe they use a type of device that indirectly uses JSON and http. One possible candidate is a Philips Hue bulb. I'm not sure, but it is plausible that the HC talks to the Hue bulb via http and uses JSON decode to parse the result. I don't have such a device. I don't have this error.

 

@10der how often does that script in post #1 fail? Would you say it is often enough to do an experiment? I'm guessing the script fails either on the "get" or the "call". You could try wrapping them in "pcall" to see if this can catch the error (doesn't always work, the called function might abort the script). If you want to try and you've never used "pcall" before, I'll adapt the script for you.

Link to comment
Share on other sites

  • Topic Author
  • 1 hour ago, petergebruers said:

     

    @10der how often does that script in post #1 fail? Would you say it is often enough to do an experiment? I'm guessing the script fails either on the "get" or the "call". You could try wrapping them in "pcall" to see if this can catch the error (doesn't always work, the called function might abort the script). If you want to try and you've never used "pcall" before, I'll adapt the script for you.

    2

     

    ~ fortnightly... pcall is cool... but my question is (irony) should I wrap all my scenes to pcode... ha ha ha 

    So why FIBARO guys not make it official on the core level and rethrow exception / etc?

    Link to comment
    Share on other sites

    Hi @petergebruers,

     

    If you remember we already discussed about this error and I agree with you that it has to do something with JSON decode. This are two different fail messages that I know of:

    Please login or register to see this code.

    and this one that was really caused by bad josn format sent by Netatmo in my Netatmo weather station scene:

    Please login or register to see this code.

    Fibaro is using some LUA code for JSON decode/encode and original code can be found here: 

    Please login or register to see this link.

     

    I hope that I didn't break any rules by writing this. If I did then admins please delete this post immediately. At the moment I don't have time to study deeper this code and find resolution, but I remember that @drboss contacted Fibaro regarding this problem and he get answer that Fibaro team will deal with it and add solution to the next release since they already closed scope for firmware release on 17th February this year. I don't know how much time is left between closing scope and releasing firmware but 4.111 was released on 23th February.

     

    I remember that on 4.120 release I was writing Netatmo weather station scene and above problem was still present. On 24th April @emielstroeve informed me that scene is failing on above error and that was just before 4.121 beta release. Before upgrading to 4.130 I still did some modification of my code and I added additional checks of received data format in my code and above error did not occur any more but that doesn't mean that Fibaro team repaired it.

     

    @10der,

     

    On what firmware was your HC2 when this error happened?

     

     

    Link to comment
    Share on other sites

    @Sankotronic as always: thanks for sharing. We keep digging, digging, until it is fixed. Or we until I've lost interest in my case :-D

     

    Link to comment
    Share on other sites

    • 3 weeks later...
  • Topic Author
  • yeah... today. back to home - no lights...

     

    [DEBUG] 02:49:00: line 35: unexpected character @ character: 1 0:1 [�] line:
    [DEBUG] 02:49:00: �

     

    :(

     

     

    Link to comment
    Share on other sites

    2 hours ago, 10der said:

    yeah... today. back to home - no lights...

     

    [DEBUG] 02:49:00: line 35: unexpected character @ character: 1 0:1 [�] line:
    [DEBUG] 02:49:00: �

     

    :(

     

     

     

    Is it one of my scenes that stops on this error? Last one that was stopped on this error was Netatmo weather station scene, but thanks to Netatmo having problems with their servers I resolved that I hope for good.

     

    Did you try Watchdog scene from French forum? If not, I really recommend it for automatic restarting scenes if stop working. I had some false alarms for virtual devices with version 1.2, so now testing version 1.3

    Link to comment
    Share on other sites

    • 5 weeks later...

    Today, for the first time, I had a long running script (%% autostart) bark at me:

    Please login or register to see this code.

    So I guess I'm now part of the club? ;)

    • Thanks 1
    Link to comment
    Share on other sites

    • 2 months later...

    I also get the same error on one of my scenes. It is happening about everyday now. 

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 4 hours ago, amatt said:

    I also get the same error on one of my scenes. It is happening about everyday now. 

     

    1

     

    ¯\_(ツ)_/¯

     

    I can only suggest two things 

    1) re-write scene or double check your code

    2) use code from @Sankotronic

    or something like that

    Please login or register to see this code.

     

     

    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
    Reply to this topic...

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

     Share

    ×
    ×
    • Create New...