This object is in archive! 

Test of virtual switch state failing

David Pritchard shared this problem 8 years ago
Known

I've noticed that simple boolean conditions (testing the state of virtual switches) in my rules sometimes fail to evaluate correctly. So I decided to put together a test to try to get to the bottom of the problem. I have a virtual switch called "working day", which, during the test, has always been set to "on" (it's set at 1 minute past midnight every working day). I created a rule which tests this switch state 6 times, in 3 pairs. In each pair, I first test using an actuator piece, and then using a control piece, in case there's a difference. I the first test pair I use a sensor piece. In the next a meter piece whose value I compare to 1. And in the last test I use a meter piece and test if it's not 0. For each I created a test switch. I added a final test switch at the end to make sure that the rule was running.


Result: none of the conditions evaluated correctly. Only the final test switch, number 7, was tripped.


How is this possible? Is there some other way of testing a virtual switch state? Does it just fail randomly?


I found an old post that suggested using a meter piece and testing whether the selected switch state is "true", using a = operator. If you do that, the value on the right is automatically filled in with "true", but when you try to save it you get an error about not being able to compare a number with a string.


Does anybody know what's going on?

Replies (37)

photo
1

I think I may have a clue about what's happening. The "working day" switch appeared to be set to "on" in the device manager. But I read in the forums that virtual switch states are NOT preserved after a reboot (in contrast to what I believed). So I tried toggling the switch off and then on again. Then I ran the rule. Bingo, now it worked in all 6 cases.

So there is still a bug: sometimes the Device Manager shows a state that is not correct.

I'll change the logic of my rules to regularly refresh the switch states (or use variables maybe).

photo
1

Could it be that if the box disconnects during the night, it loses the switch states, and then fails to reestablish them on reconnecting? So you continue to see the original correct switch states in the web application (because they're correct in the cloud) but on the box the states have actually been reset to "off"?

photo
1

I've just done a test which proves that, when a switch is not behaving as it should, its state is out of synch.

My "working day" switch appeared to be on in the Device Manager. But the conditions which tested for the "on" state evaluated to false. So I tried running a rule which toggled the "working day" switch twice. Toggling the switch twice will not change its state, but will force a resynch of its state between the box and the cloud. Since the rule is executing on the box, the starting state will be the box's state, not the one you see in Device Manager.

As expected, after toggling the switch twice, it changed from "on" to "off" in Device Manager.

So Device Manager is lying about the state. It's not synched to the box (or, rather, the box has not been resynched to the cloud state after a disconnection).


Zipato: you need to fix this. This is almost certainly the cause of a lot of the unreliability people are reporting in the execution of their rules.


Also, it would be useful to be able to trigger rules on certain events, such as a reboot or reconnection to the cloud.

photo
3

Hi Dave, all respect to you writing a long book to find our a bug in the system. I will definitely save rhis for future reference. I appreciate that great guys are part of this forum like you...

photo
2

Hi, David,


You are correct. The problem was with the box receiving last states from the cloud. After the box reboots the cloud immediately sends the switch states to it. The problem was that sometimes the connection to the cloud was not fully initialized, and the states from the cloud never came to the box. That is why they appeared off, and why they showed different values in the device manager. We have fixed this issue by waiting for a few seconds for connection to start working properly after the box reboots, and then send the state from the cloud.

The problem should be fixed if you update to beta.


We appreciate Your valued input as a customer, and we apologise for inconveniences this issue caused.


Kindest regards,

Sergej Hajdin

Zipato Team

photo
1

Excellent, I might risk it and try the beta firmware. Is it easy to revert to the earlier firmware if I have problems?


Do you have a list of problems fixed in the new firmware?

photo
2

Yes, you can easily switch between firmware versions.

photo
2

Dave,


I'm aware of a few issues still present in the latest firmware;

1. Groups of sensors don't work at all, and if you tie any virtual device to a rule which depends on a group then the virtual device won't work either.

2. Repeat puzzle don't work at all if you put a Join puzzle inside it. Also, if no Join puzzle is present, it won't work the first time you execute the rule, after that it's fine.

3. I think they still have problems with the insertion of variables in the messages (I don't know because I don't have the PRO licence, and 99 bucks for that sounds a bit expensive, maybe I will buy it when I need other PRO feature).

photo
1

OK, thanks for the info. I have some groups but I'm not using them at the moment. I don't have any rules that use Join. And as for messages, I just tried an email which gives me the states of switches and variables, and it seems to me like the ones that are not synched don't make it into the email properly (in this case, Working Day., Weekday and On holiday:


Variables:

WorkingDay: ${variables.get("WorkingDay")}


Switches:

Weekday: ${attributes.get("27bc9d7f-f126-470b-b8c5-b5e4f82a9245", "com.zipato.cluster.OnOff", "state")}

Working day: true

On holiday: ${attributes.get("e47b2f74-501c-4b01-b7b0-19826ee22d2b", "com.zipato.cluster.OnOff", "state")}

Autumn/winter: false

Spring/Summer: true


The rest work.

photo
1

Did you tried if you can add variables or states to push notifications?

photo
1

No, I've never tried push notifications. I'll maybe give it a go.

photo
3

To understand what happens in the Zipabox you must create a rule that sends a message every time the box restarts spontaneously. It happens more often than you can imagine. And every time the hole memory are cleared. What you se in the device browser has very little to do with what the box remember of the status from before the restart.

Just create a simple rule as this and you get a message every time the box restarts.

photo
1

How do you configure the scheduler?

photo
1

Minutly.

Normaly the routine should have nothing to do so it doesn't matter that it runs frequently.

photo
1

In actual operation I do a lot more.

Every routine (120) in the box are depending on the same variable and don't runs before the box have waited in new data from a lot of sensors and than I run 6 big routines who configurer the box before I dare to let it run again. Otherwise a lot can hapens in the system and you can do nothing.

Remember that a restarts can happens when the communication is broken. It has happened to me several times. The worst case was 48 hours when the fibre connection to internet was down in the middle off the winter and the heating system is controlled by the box.

photo
2

The reboot detector is a great idea and I'm going to try it. The new firmware has not solved the problem of out-of-synch switches and variables, as far as I can see.


Unfortunately, I find the scheduling very unreliable. Some rules that I've set up to run every 15 minutes only run once a day!

photo
1

I think that depends on that the box don't finish all threads and fills upp memory. That's a guess. The box is filled upp with them and become slower and slower. For the moment my box restarts spontaneously 1 to 2 times each day.

photo
2

Yeah, I suspect that at the bottom of a lot of these problems is a shortage of memory and processing power.

Anyway, I'm going to see if I can find any pattern in the scheduler failures.

photo
2

I don't think that the box will works properly before it is equipped with some flash memory so the box remembers the status by it self after a restart. For the moment we are fooled by the device browser. Very often the box and the device browser mismatch.

photo
1

But remember that it is importantly that you not copies the scheduler. Always create a new with a unique name.

photo
1

David.

No I don't think that it is capacity problems. In this type off systems nothing more happens than that you can do it by your your self and have a lot of time over. Maybe they collect to much data from control devices and occupy too much capacity by that. But the basic funktions, witch we have the controller for, is nothing for the controller. It is nearly idling. The problem is the way they build the system, the code, the communication and the lack of flash memory.

photo
1

When you said don't copy the scheduler, what did you mean? Do you mean don't modify an existing scheduler piece?


I have got the impression that if you create a scheduler to run just once, and then modify it to run at intervals, it often doesn't work properly. It doesn't seem to handle modifications correctly. Is that what you mean?


Does the name of the scheduler have any relevance?

photo
1

Of course, if you could run Elite on a 48k Spectrum in 1984, you can run a few simple home automation rules on whatever hardware the Zipabox has. But programming tends to be become less efficient as the hardware gets more powerful. Hardware is cheaper than programmers' time :-)

photo
1

I mean that it is easy to pick a scheduler from an already constructed rule and move it to a new rule and reuse it. But don't do that. It creates problems. Pick up a new one.

photo
1

OK. Sounds wise.

photo
2

It looks like the reboot detector works like quite nicely. As I understand from your post, you use the same rule to reestablish your switch and variable values. I'm also doing this (I invoke each of my variable "subroutines", which are each triggered by a switch), and it looks like it works well too.


To solve my problem with unreliable schedulers, I've made a rule that asks as a "master scheduler" for all my other rules (or at least the ones that don't work reliably). It runs every minute and runs the other rules every 5, 10, 15 or 30 minutes as needed. This also appears to be working well.


Today, for the first time ever, all the problems I've had with rules have been due to my errors! Certainly makes a change.

photo
2

Good to read!

It can of course be done in several ways.

But to bee exact. I have two variables and several virtual switches to make the restart happens correct.

One variable who starts "rebbot detector" and one who stops every routine, except the restarts routines from running until I allow it.

The switches are used to start routine after routine until everything is done. The reason for that is that the rule creator don't handle long rules. And the last thing that happens is that I allow the whole system to run.

The best thing with this is that it works even when the internet is down. But you must test that your box don't restarts every 20 minutes when internet is down. My box did that with the "keep online" unchecked in spite of the tooltip text. After a ticket I was told to check it instead and it stopped the restart routine when internet was down.

photo
1

Yes, I use this restart routines to establish a situation good enough to start the box and much better than the status that a "normal" reboot establish. But not as good as a running system. But in half a day the system runs correct again.

The problem is that the system crash once or twice times per day for the moment.

photo
1

Duplicated.

photo
1

duplicated.

photo
2

David.

I se now that I missed to answer one of your questions.

No it doesn't matter if you names two scheduler with the same name as long each are created from start. There identity is established by the system. But if you copies from rule to rule it is the same scheduler and if you changes the name in one rule it will be changed in all rules where this scheduler i used. And the same things will obtains for every changes you do in that scheduler.

But in a practical matter it is best to use unique names.

photo
1

Henry,


It seems like you have figured out quite a lot of things that have probably got many Zipabox users baffled. I suggest that you post some of these on the forum in new posts where they're more visible. It would help a lot of people!


My Zipabox doesn't seem to disconnect or reboot as often as yours, but it's still very early to say for sure. I'll see what the reboot detector reveals. However I already have a suspicion - more than a suspicion, actually - that there's a big difference between variables and switches. I have several rules that used to use a switch to activate or deactivate them. Some failed quite frequently, until I changed to using a variable. I have both the variable and switch set up in the same rule in the same way. If I use the variable, the rules work reliably. If I use the switch, they don't. (The rule that set the variable and switch ran just after midnight, and the rules that use them in the morning. So somewhere between midnight and the morning, the switch got reset but the variable didn't).


I'm going to modify my reboot detector to use both a switch and a variable, to see what each one detects.


Is it possible that, when the system gets briefly disconnected from the internet, the variable values are correctly restored on reconnection, but the switch states are not? That's my guess.

photo
1

I also discovered the limits on rule length when the Zipabox refused to save a modification to a long rule I had.


I've now converted most of my rules to "subroutines" by making their execution dependent on a switch, let's say Sub_Run_Rule_XYZ. When I want the subroutine to run, I set the switch to "on". At the end of the subroutine, I set it to "off". This *seems* to work pretty well. Is that what you do?


This way I can chain several shorter rules together. Later, I may try to chain all of my switch/variable-setting rules together into one big rule. Right now I simply run one after another from the reboot detector, and run them periodically throughout the day.


The idea of preventing certain rules from running until the system is "ready" is also good. I'll look into that.

photo
1

Hi Guys,


Can you post some samples? I have read this tread for like 10 times but still did not manage to put the puzzle pieces 100% together.


Many thanks.

photo
1

Hehe. Yeah sure. I was waiting until I was fairly sure that what I have works before posting, but I'm fairly sure my system is working well now.


Wait a sec.

photo
1

This is my "Reboot detector", copied essentially from Henry's idea. The idea is to have the variable set to a value that it will never have when the memory of the box is cleared. I also added a switch which I initialise to "on". My theory is that, if the box disconnects briefly, variable values get copied back after the box reconnects, but switches remain reset to "off". That's even after the latest firmware update, I think (remains to be confirmed!). So this rule would detect both reboots and disconnects which leave your switch states messed up. It sends a message for diagnostic purposes and then calls a series of "subroutines" to restore the states of the variables and switches so that the other rules can work correctly.


I imagine Henry and I do something similar - I have a set of values that I calculate from basic information. For example, is today a working day? Is is autumn, winter, spring or summer? Is it cloudy? Is it likely to rain? Etc. etc. For some of these I originally ran a rule just once a day to calculate them (and used only switches). That fell foul of the box disconnecting - the switch states kept getting wiped, and my rules kept failing. So now I run the rules more often. And if I detect that the box has rebooted or disconnected, I run them straight away to restore these basic values. This last idea, again, is Henry's.

photo
1

So now onto "subroutines". The reboot detector is itself an example of one. Instead of running at a particular time, it runs when a switch is activated. I create a switch for each subroutine, say, Sub_Run_Rule_XYZ, and set it to "on" when I want to invoke the subroutine. At the end of the subroutine, I set it to "off" (this is important, otherwise the subroutine will never run again!).


You can see that the reboot detector runs a series of other subroutines (all the switches set to "on" whose name starts with "Sub_".


This system may not be 100% reliable but it's working pretty well for me so far.

photo
1

This is an example of one of the variable/switch-setting subroutines. I've just included part of it but you get the idea. Noteworthy here is the 3-second wait after initialising the public holiday switch state. This is because, if you change the state of a switch and then change it again in the same rule, the second change will fail to take effect unless you insert a wait of a second or two.


At the end the rule invokes some more subroutines for holiday dates, one-off days off and so forth, and then sets its subroutine switch back to "off".

photo
1

This subroutine is invoked from the reboot detector subroutine in case of a reboot/disconnect. It's also run from my "Master Scheduler rule". I was a bit tired of the schedulers not working reliably, so I set up a rule that runs every minute and use it to do my own scheduling of the variable/switch-setting rules. It also serves as a gateway for the reboot detector - it checks the variable and switch and runs the reboot detector subroutine if needed. The reason I did this was that, in the event of detecting a reboot/disconnect I immediately run all my variable-setting routines to restore the box's values, and so I want to skip over everything else in the scheduler (otherwise you can't control the sequence of execution). If we had proper functions that return true/false then I could do it rather more cleanly.


It's a bit messy and it's all still a work in progress.

photo
1

Hi Dave,


I will need to study this post again and again. I guess subroutines are rules that run constantly rather than by a trigger of lets say a remote button press...

I need to use my fantasy to see how I can integrate this.

photo
1

Subroutines don't run constantly - they're just triggered by flipping a switch. So you simply create a virtual switch for each subroutine, then set it to "on" when you want the subroutine to run, and flip it to "off" again at the end.


The purpose to create reusable code blocks that can be invoked from different rules.

photo
1

Here's an example of a run that actually does something :-)


It turns on a towel rail at a set time in the morning if it's a working day and if the temperature is below a certain level.


So, all that infrastructure to do something rather simple...

photo
1

The other purpose of subroutines is to stop rules from getting too long. The Zipabox doesn't like rules that occupy much more than 2 screen lengths. It refuses to save changes to them.


In fact I've just had to split up my holiday/working day rule yet again, because of just this problem.


Now I have one rule that invokes a series of other rules:


- Set working day/weekday/hols subroutine calls:

- Set weekday subroutine

- Set standard holiday (vacation) subroutine

- Set standard public holiday subroutine

- Set one-off vacation subroutine

- Set one-off public holiday subroutine

- Set working day subroutine


The last one sets the working day switch/variable that many other rules use.

photo
1

David.

This was nearly a novel. :) :) Please wright on this level. It will be easier to discuss a single point then. Thanks for your trust.

I'm quite restrictive with what I writes. I will be sure it's correct. The lack of both documentations and debug systems makes it extremely difficult to be sure.

I became a developer myself many years ago (systems for sawmills) and then development director and CEO for about 100 developers. Now I'm retired.


I think that Zipatos concept is a great idea. That's the reason why I still waits fore the next release. I don't want to disturb them with hard and wrong words in public. I only hope that they recognize, by them self, that they have created a system which are too dependent on too many stage that all have to operate at the same time when the system should run. The same problems that you have in an industri. A line without buffers between machines results in a very low efficiency. If each machine have an efficiency of 95 % a line with 10 machines will be down in 49 % efficiency. Upon that we have all the risks with the cloud. In many systems it doesn't matter if the system is down fore a while. My living in a house, in a cold country, must works every minute. I still hopes for a lokal interface and understands the cloud as a superb way to admin the system from other places when it's possible.

photo
1

David.

You wrote: "However I already have a suspicion - more than a suspicion, actually - that there's a big difference between variables and switches."

There are a big difference between variables and switches.

A variable stores numbers and a switch stores true/false.

if you don't want to use variables use virtual meter. Those stores the same.

photo
1

Henry,


Oops I nearly didn't see your last message.


Yes, we need more documentation, definitely. At the moment this forum is almost the only place to get information.

From my review of the home automation options out there, I have concluded that this is still a hobby for tinkerers rather than something stable that can be sold to the public at large. All the good systems seem to have reliability problems, except the installer-only ones which cost a fortune and are just mostly useless toys for people with too much money (that's my impression!). So for the moment I've decided the best bet is to stick with Zipato and try to improve the system as far as we can. The more people post constructive criticism and tips, the better.


For my part, I don't depend quite as much on the system as you do. In part that's because I can't (yet) control my heating from the Zipabox. Mainly I depend on it for awning and blind control (to let the sun in in the winter and keep it out in the summer - I live in Spain - as well as getting some extra insulation on cold nights), corrections to the ventilation control (turning it off if CO2 is low, turning it on if it gets too high, although the ventilation has its own basic programming which usually works OK), and some nice extras like turning the Roomba and Sonos off when they're not used and turning them on at the right time, turning on my towel rail and so forth. I won't die if it doesn't work properly on any given day, but it annoys the hell out of me.


The cloud is clearly a source of some problems. I read here somewhere that there were technical difficulties with writing the variable and switch states to the box's memory - I don't know why that should be.


It's a work in progress. Let's see where we are a few months from now.

photo
1

I also like the Zipabox concept, but it needs fleshing out. Native support for subroutines and string handling would be two things on my list.


I didn't mean to say that I don't know the difference between variables and switches. I meant that there's a difference in their behaviour when the Zipabox disconnects from the cloud - I wasn't clear. The variables seem to get their values copied back when the box reconnects, but the switches don't get their states back.

photo
1

I don't think that you are right if they don't have changed their principles.

This is from a answer in a ticket: "Variables are not entities like devices so they are not saving their states. You will need to use virtual devices if you would like to save those data".

photo
1

Yes, that's also what I read, and that's why I used switches! But perhaps what they mean is that they don't save their states between reboots, which is confirmed by our experience. But between disconnects? Because of the bug affecting the restoration of switch states, perhaps variables keep their values but switches lose their states? Exactly the opposite of the situation when a reboot happens.

photo
1

Why should they?

Between reboots the box remembers by it self. And they don't show the variables. The only way to see the is thru messages.

No, the truth is that the status of variables don't leave the box other ways than by messages.

photo
1

An example: If I use a "working day" variable in my rules, the rules always seem to work correctly.

photo
1

David.

You wrote: "Is it possible that, when the system gets briefly disconnected from the internet, the variable values are correctly restored on reconnection, but the switch states are not? That's my guess.".

I have no idea. But I hope that they don't changes anything retroactive. That's creates mismatch.

photo
1

And this is one of the reasons why I stops all executing when the box restarts. They starts to reload status while the rules in the box starts changing devices upon not updated data in not restored variables, virtual and real devices. It can't create anything else but problems. Therefore it's absolutely necessary with a local interface and a box with flash memory.

photo
1

However, if I use a virtual switch, the rules fail quite often. My guess is that it's because the box is disconnecting during the night before the rules run, but after the switch state is set.


(Now I set my switch states more frequently so with luck this problem will mostly go away).

photo
1

I'm a little interested. Why do you tests the temperature against a virtual meter instead of directly against the temperature sensor?

photo
1

Sorry, duplicated.

photo
1

I don't have a temperature sensor! Unfortunately I can't connect my Tado thermostat to the Zipabox right now (as far as I know). Nor can I query the Tado via its API from the Zipabox (a major omission in the Zipabox, by the way - we need HTTP Requests!) So I do something rather roundabout: I have a Google App Script which queries the Tado every 10 minutes, dumps all its data into a Google Sheet and then passes the relevant bits to the Zipabox's virtual meter.

photo
1

Guys, just to check that I start to follow you correctly, every rule should be extended with the variable (ideally) so the rule will only start of the system is complete and not before.


So what I did is that I extended my simple automatic alarm rule with the variable that was mentioned by henry (restart rule). If i understand correctly this rule will now only start if the box completely restarted.


Is this the right approach?

photo
2

I use two variables.

"Restart" who stops initiating of the restart routines until it is a restart. This will be reset to 100 as soon the restart routine starts run. This routine starts the first of 6 restart routines by a virtual switch. Then they are started one by one by virtual switches in a chain.

"Operate" who stop all other routines except "restart routines" from running. This will be reset to 100 as the last thing in the last restart routine.

photo
1

In the routine you show here you should change the "restart" to "Operate". That's all.

photo
1

Henry's rule (which I've copied) initially sets the variable Restart_Detector to 100 (the first time it runs). If the Zipabox then restarts, the variable will have some value other than 100 (let's say 0). I would imagine it would be always 0, but perhaps Henry is playing it safe, in case the variable gets set to 1 or something. So:


- 100 = Box has not restarted

- Not 100 = Box has restarted


Maybe there's something more to Henry's rule that I didn't understand. He'll have to clarify.


So the idea is to set up a rule which runs every minute, to check the status of this variable, and to reestablish the variable/switch values if there has been a restart. Once that has been done, you can run your rules as normal.


I think what Henry has is a switch or variable called something like "Variables Set Correctly". If the box is found to have restarted, "Variables Set Correctly" is set to "off". Then he triggers some rules to set up his variables and switches again. And then he sets "Variables Set Correctly" to "on".


Then, in each rule, he will have something like:


if (Variables Set Correctly)

Do rule stuff


Which deactivates every rule depending on whether the system has been correctly initialised.

photo
1

Some of that.

I divide the day in two parts roughly, night and day and all flags sets to a standard depending on the time on day.

Devices who consume energy sets to ON all other sets to OFF.

photo
1

Whether this is useful for you depends on whether your variables are set by a bit of logic derived from the day of the week, or the temperature, or whatever, or whether they are set because of something detected by a sensor. In the latter case, there's no way to get the sensor to send its input again!


What is setting the two switches in your rule? A movement sensor?

photo
1

Here's an example of something you can't entirely fix after a reboot. In the Zipabox, sunset and sunrise are one-off events. You can use them to set a variable or a switch so that you know if it's daytime or nighttime, but if the value of your variable or switch is deleted, you're screwed. There's no way to recover the information. (That's why a "sunset time" and "sunrise time" constant puzzle piece would be very useful).


I have a rough-and-ready rule that corrects the "daytime" setting if the time is outside the time ranges that vary with season and daylight saving time (between 21:45 and 6:45 it's always night here, no matter what time of the year it is).


But if you're trying to track people's comings and goings with a movement sensor, there's no way to recover that information.


However: my experience suggests that as long as your box doesn't restart (if it just disconnects from the cloud momentarily), the variables will regain their old values on reconnect, whereas switches will get reset and *will not* regain their old values. Zipato say this is fixed in the new firmware, but I can't verify this yet.


So, for more reliability, I would use variables.

photo
1

Hi David. Mi sensors are http sensors triggered by Tasker if I connect to my home wifi. Unfortunately it is not working 100% but that is Tasker fault not zipato. I understood Henrys restart topic to be configured to every rule so it is "safe".

photo
1

Yes, his idea is to prevent rules from running if the variables/switches that they depend on are not set up correctly, so that they don't do anything stupid.


(I'm not Henry's spokesperson so he'd better correct me if anything I say isn't accurate!)

photo
1

Absolutely! (Y)

photo
1

But if I don't use any variables or virtual switches in rules than how will this restart rule help to make the system more reliable?

I wonder if it would be possible to hardware flash a bigger memory in the box how it would help. I hope zipatile will be more reliable...

photo
1

Could you perhaps get Tasker to periodically update the HTTP sensor with the connection state of each person? Rather than making it a one-off "xyz connected" event? That might solve 2 problems: Tasker's reliability and the switch state problem in the Zipabox.


In any event I would encourage you to try storing the state information in variables. I've found them more reliable. Providing that your Zipabox doesn't reboot spontaneously (like Henry's!), this should ensure you don't lose the state information so easily.


Question: can you trigger a rule with 2 switch states in that way? Does that work? I would have thought that the rule should be triggered by any change in either of the HTTP sensors:


when (ati doma any) or (maja doma any)


and then


if (ati doma off) and (maja doma off)


but I'm not sure.... I've never tried to incorporate 2 different triggers like that.

photo
2

Hi David, thank you for your responses. It actually gave me good ideas how to make some workarounds

photo
1

The rule itself works like a charm when it received the actual states. I will probably change Tasker so it periodically detects if is connected and if lost connection, wait 10 minutes and if the connection is not established, send the change.

photo
1

OK, that's interesting. So if you set a rule to be triggered by 2 meters becoming inactive (or 2 switches being off?) the rule will be triggered when:

1) either meter or switch changes state

and

2) the state of both devices is inactive/off?


I didn't realise you could do that.

photo
1

Yes, it does work like that.

photo
2

David. I now testing the following:

1. i have a profile in tasker that when

connected to home wifi it changes the state of the virtual sensor to on

and if not connected state to off (via tasker http post). As I mentioned above, this is not 100%

working all the time so based on your suggestion I have

2. a simple recurring task in tasker

that checks every 5 minutes if Im actually connected to home wifi and

if yes, changes the state of the vistual sensor to on (meaning Im home)

and when not connected, sends a signal that im away. This way even if

task 1 is failed, zipato no later than 5 minutes will receive a change

of state of the virtual sensor.

Obviously I will need to do the same for my wife. Will know more in a couple of days...

photo
2

Hi David, so far so good. If this truly works I can nearly forget to arm the system...

photo
1

I like your presence-detection system. I might copy it!

photo
1

let me know if you need the tasker printscreen how it is set up.

photo
1

Yes please, that would be very helpful.

photo
2

Ok. So I have 2 profiles.

1. profile checks a wifi state if the wifi is connected to my home or my neighbour wifi router. If yes, it will send https link to zipato virtual sensor ending with 1 (active). Exit task is wait 10 minutes and then send https link with 0 (inactive). As this profile did not work 100% correct, I have created another profile which simply runs every 10 minutes.

2. attached printscreen. First the task checks the current wifi ssid and writes it to a variable. Then if this variable equals of any of the wifi routers name (I have 3 different networks at home + 2 of my neighbours have) than sends the https link with 1 (meaning Im home). else it will sernd https link with 0. This way if my 1st task fails, no later then 10 minutes it will send info to zipato that i left home.

Apparently there is also a solution in tasker to simply wait for the response and if no response received, loop this as long as the response is received, but i dont know tasker that well.

photo
1

I think your 1 profile is constantly setting the virtual sensor to 0. It will set the sensor to 1, then 10 minutes late to 0. I would remove the exit task and run another task on disconnection from SSID


If you wish for tasker to keep checking a status after a duration, use the "if" and "else" but then use the "goto" if the criteria is matched. Such as, "Else" not connected to ssid, wait 10 minutes, go to "1". Which will restest your ssid connection.

photo
1

Hi Adrian, Im sure there are various ways to do it to make it work. I even read on the other topic that there is a way to actually wait for the response and if no response from the server, go back to sending the link.

Unfortunately Im not a programmer neither aIm good with tasker. And unfortunately not I have time to play with it.

At the end of the day this works flawless. The sensor is not set to 0 after 10 minutes as the exit task will only go live when disconnecting from the WiFi network. Since these two tasks are live (for me and also for my partner), I can rely on automatic arming/disarming 100%.

photo
1

Thanks Attila. Will try it when I have time.

Replies have been locked on this page!