This object is in archive! 

Check internet connection in the rules creator

Artem shared this question 7 years ago
Need Answer

Hi, I have similar problem. Some time my 4G modem lose signal. As a result internet connection is down. Only restart helps to restore internet. I have smart switch 6. I want to restart my modem via this device. When this event will occur i just turn off my smart switch and after 10 seconds turn on it. But the main question. How to define internet connection problem in the creator rules.

Replies (24)

photo
1

this can be done on the zipatile but not on the zipabox. How others have bypassed this issue is by creating virtual meters and variables and testing them. David Pritchard has outlined this in a post somewhere

photo
1

Hi Adrian. Thank you very much for you answer. I saw that similar issues solved by virtual devices. But didn't find any manuals or instructions how to work with them. Could you help me with this? Thank you!

photo
1

Adrian. I found description of virtual sensor and switcher. But I see that for sensor uses cloud link, for change values for it. But if I have trouble with connection, how I can change values? I saw that some people use local ip address instead of domain name but i really don't know how to check internet connection.

photo
1

I'm afraid this is still not possible on Zipabox, you can add a new type of alarm partition for Battery which also sends notifications about internet problems but there is no way you can use it in rules. I would show you but unfortunatelly I cannot add devices on Zipabox for some reason.

photo
1

Alberto thank you for explanation. It's strange that Zipabox has special backup module with usb 3G - stick but it cant processing connection problems.

photo
1

Hi. I invent rule for checking internet connection. But is have some trouble with this script. I know that virtual devices works only if internet connection is available. In this case use virtual device and variable. I try to change status of virtual sensor if status changed I also change variable. If status of virtual sensor is not changed I also change variable. Than I check if variable means connected than drop status of variable to "not connected". Another case I restart modem via smart switcher. In this script I use additional virtual sensor because i want to see variable value. But I see strange situation. In first part of rule I set virtual sensors in "Active" status. But only one changed. Do Rule creator have limit for update virtual sensor? Why I can't change status of it?

photo
1

Ok. Firstly I dont see a reason to set the two switches to active right after the when block. These are set in the if else puzzles anyway. Try to remove them + insert a Join instead (after the when puzzle and before the 1st if).

Also after the wait puzzle you must use a refresh puzzle as the state needs to be actual not the one before the wait puzzle (otherwise zipato will use the states that was actual at the trigger of the rule (at the time you have set).

photo
1

Hmmm, looking into the rule it does not make sense to me - without any modification that I have described above, although my modification request still might make this rule a bit strange.

Your rule will always set both switched to active so they will always have the same state when the first if is executed. Are any of these sensors and switches linked to something external that can also change the state?

photo
1

I know that virtual devices works only if internet connection is available. If I haven't connection to the internet in my view virtual devices will have previous state (Inactive). But when rules run, only one virtual device changed status. Also I don't know what is the differers between set state commend of virtual device and sent http request with change state.

photo
1

Well. This is a good one. The rule is executed on the controller but what Im unsure about is the scheduler. Im unsure if the scheduler is executed locally or remotely. See if you have an astro scheduler, it definitely relies on the cloud and will not work if the weather data is not new. Can someone test a scheduler to find out if the scheduler (time based not astro) depends on the internet or not?

I have a time scheduler, and it does not fire when my zipatile is offline (disconnected from wifi) although the rule executes a HTTP command and perhaps this command is not working.

Alberto and Dave Pritchard have more in depth knowledge about the virtual sensors, switches and their state synch upon disconnection.

photo
1

I test it when I have connection with the Internet. I have scheduler which works with time.

photo
1

Artem,


Do you have only one Zipabox? or you have Zipatile / Zipabox Duo? In theory virtual switches work with or without internet connection (as long as you are connected to the same local network, and from the same controller). If you have two Zipato controllers (even two zipaboxes) you could probably make some sort of "heartbeat" rule, changing states back and forth of two virtual meters on different processors through HTTP requests, to this days HTTP requests need to be done through zipato cloud, so if any of both meters do not change in certain amount of time you know you have lost connection with zipato server.


Also if you only have one processor the you probably do the same through a script in google docs, I have never done that but I know Dave has done a lot of scripts for Phillips Hue and Sones, he would be able to help.


Other option could be doing it through a Raspberry Pi or Arduino in the same network, I'm trying to integrate some interfases with the arduino YUN but that is still on progress.

photo
1

I have only one zipabox and two devices. There are smart switcher 6 and Figaro eye (multi-sensor with temperature sensor). So I try to check internet connectivity via virtual device and variable. I just want drop value value and check value of virtual sensor. If connection is available virtual device will change value of variable and itself and I can check it. It's simple rule but i see that it's not working like in common program languages. I will try to debug rules for understanding how it works.

photo
1

According to my own testing you won't be able to detect internet failure between a virtual device and variable, as long as your zipabox does not reboot. If your zipabox reboots then the variable will go to 0 whereas the virtual device will load previous state from zipato servers, that is the main difference between both virtual devices and variables. However if your zipabox reboots you will see a difference.

photo
photo
1

Hi, Thank you all for advices. I found the solution. In attachment you can find my rule. I use virtual sensor and variable for checking internet connection. Also I add counter for excluding random restart of my modem. I use 1 minute scheduler and check variable. If i see that last 5 minutes virtual sensor is not updated that means internet connection is absent. Also I think this rule can bee used if you need to send some command to the modem / controller which helps to restart internet connection. But in my case I use smart switcher 6. This issue can be closed.

photo
1

Aha! Now I see what you ment... yes it is a clever rule I thought about that but doing it with two (zipato controllers) but you can indeed do it between one controller and zipato server if triggering the virtual switch using the remote link (you do need the server / internet connection for this). Thumbs Up, thanks for sharing.

photo
photo
1

Hi Artem. Two questions:

1. have yu tested the rule (by unplugging the internet cable) and it works fine?

2. Can you show us what message you send in the two message puzzles? Are these message puzzles related to the wirtual switch? Do they switch on or off or one on and the second message off?

photo
1

Piece of advice, not that I want to hack into your rule but you shouldn't share the link with API keys, someone might want to play with your switch...

photo
photo
1

Also I found not standard behaviour( for standard program languages) of checking virtual sensor state, If we have connection with the internet we can use control block (if else) for checking virtual sensor state. But if we don't have connection with the Internet that means all control blocks will not work. I understood that when try to check if virtual sensor has inactive state when internet cable is unplugged

unplugged.

photo
1

Hi Artem, great job. This confirms also another question that the time based scheduler works also when there is no internet connection. Im going to create the rule now.

photo
1

Rule created. I now need to add a power plug to my router so it can be switched on/off. I think I love this rule. Great work Artem.

photo
1

I bought the Aeon Labs power strip to cycle my charging/discharging cycles of the backup battery of Zipabox (to help last longer) works pretty good and it is useful, there is a small problem with the descriptor that I'm sure Zipato will prioritize if more users have this device, that way you can turn ON/OFF 4 devices (cheaper than 4 flush relays or plugs).

photo
photo
1

Thank you. If you select scheduler based on virtual devices you must be sure that you have internet connection at first. Although if you have connection to the internet it's not guarantee that virtual device will change value successfully. In my rule i see that sometimes state is not changed in this case i have to use increment block for variable. I recommended do not use virtual devices for critical for you blocks because it works not so stable.

photo
1

Yes, I agree. Nothing is 100% reliable therefore I understand the requirement of using increments.

photo
1

We should have the chance to use a PING command, this could be much more flexible and reliable, please Zipato !

photo
2

Or be able to use the cloud status in rules as on Zipatile.

photo
1

yes, i dont see any reason why this cant just be added to the zipabox firmware.

photo
1

Usually in standard program languages use try catch operator for catching errors with connection. Virtual devices it's a good instrument but in current situation they are working randomly. No 100% garantie that is will be works fine. In my script is see that not all state changes of virtual devices were completed successfully. And we don't have any instrument for checking it.

photo
photo
1

Maybe with the IFTT service, there's probably a way to check if your internet connection is working. I imagine an HTML link sent each 5 minutes to Zipabox, if there's an answer from a rule created in that way, then the connection is OK. It's just an idea.

photo
1

Maybe I don't understand your problem; LAN and WAN are not the same and there's a possibility to send the command thrue LAN even if your WAN connection is down.

photo
Leave a Comment
 
Attach a file