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

Checking in LUA that WAN is alive


Question

Posted

My Fibaro HC2 is connected to a 4G router for external (WAN) communication. The mobile network coverage is variable, and the external signal some times fails. In a LUA scene I want to check that my external WAN connection is not down. I assume that the LAN and its router are working normally, so I need to check against an external name server (DNS) or something. What would be the easiest way to implement this in LUA? I have looked at the request(url, options, succes, error) function, thinking that this maybe can return an error function which I can use as an indicator. But I am not sure how to set it up. Am I on the right track? Any ready-made solutions for this situation out there? Or any good ideas? 

8 answers to this question

Recommended Posts

  • 0
Posted

Please login or register to see this attachment.

online field

 

IMHO

  • 0
  • Inquirer
  • Posted

    And how, exactly, do you use this to detect whether the router has lost its external communication? The most relevant parameter here seems to be "Server status" (described as "Server status in seconds"). But is this the Fibaro server (i.e. a WAN connection) or the local "server"/router (i.e. the LAN connectivity)? 

     

    Besides, your reference is to an API command. In my case, I am physically remote from the HC2 most of the time, making direct API commands inaccessible. I need to implement detection of lost WAN through an automated LUA scene (with appropriate actions, like restarting the router, taken). How can this detection be done in LUA? 

    • 0
    Posted

    IMHO online field

    Please login or register to see this attachment.

     

    it's online status with connection to FIBARO GW. so if your 4g router is offline - HC2 lose connection to FIBARO cloud... 

    @knuth can understand me - implementation ICMP in LUA by fibaro it's pain. 

    and btw you can open via VD socket connection to 8.8.8.8 for example - abd test this connection as sign - OK or !OK

    • 0
  • Inquirer
  • Posted

    Thanks, @10der , but I am out of my depth here, making it difficult for me to understand what you are suggesting. ICMP means nothing to me, and I am struggling with the last pages of the Fibaro LUA documentation, which I think are relevant for this ("TCPListener" etc.).

    I do understand from you that the "online" status indicates whether connection to the Fibaro cloud has been lost. Great! That is what I need! I do not see, however, how I can retrieve this variable in a LUA scene. Can I? If so, how?

    • 0
    Posted
    1 minute ago, knuth said:

    I can retrieve this variable in a LUA scene. Can I? If so, how?

     

    :(

     

    image.png.f9658a0d0828476ae28352c2f96961cd.png

     

    image.png.34f577b24a2517ae0a33ca41e864a79b.png

     

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    • 0
    Posted

    You can use also this VD:

     

     

    • Thanks 1
    • 0
    Posted

    By the way @szmyk +1

    • Thanks 1

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