Global variable "solution" for Tapo
This is NOT a feature request, but a tip for using Automations. Unfortunately there is no "Product Category" for General Automation and this is not specific to any product so have tagged this as a Feature Request - Maybe Tapo should create an "Automation" Category.
Having said that having the ability to set and reference variables in Automations would be a great feature. Here is how I have got around this constraint by creating a two value global variable. I.e. on/off, which of course can be purposed as Home/Away, active/inactive, or whatever you need.
This is done by creating an automation which does nothing. The automation is then Enabled or Disabled and its status can be referenced in other automations in the “if” condition to determine if they should run or not.
I have used this to control a number of specific features (a variety of automations) in my house alarm automation suite which only execute if the “House alarm master switch” is on, i.e. a dummy automation called “House alarm master switch”. Another use case is for a variable to record if you are home or away… the geofencing feature is not able to be referenced in the “If” condition of automations (only as a trigger). I'm hope any-one creating more complex automations will find this useful.
So here is how to do it:
- First of all, you actually can’t create an automation which does nothing, (and holds its state enabled/disabled), so you need to create a dummy automation which just always stays off.
- Create a Dummy automation which just stays off and does nothing.
- Name “Dummy Automation for variables”
- Effective time: – always
- When: 12:00pm Sunday (this value does not matter … just pick something)
- If: no If conditions to be set
- Then: Turn off Automation – “Dummy Automation for variables” – yes this one
- The above needs to be created in 2 steps as you can’t set the “Then” condition above until it’s named and saved. So first create it with a random “Then” action, i.e. a notification. Once saved, go back and edit the automation to replace the notification action with a Disable automation action.
- Name “Dummy Automation for variables”
- Now create your two value Variable:
-
- Name “Alarm is on?” – this is the name I use – and I add the ? to remind me this is a “Variable” automation but of course you can call it what makes sense for you
- Effective time: – always
- When: 12:00pm Sunday (this value does not matter … just pick something)
- If: “Dummy Automation for variables” is enabled
- Then: Turn on Automation – “Dummy Automation for variables”
- Basically this automation will never do anything – but it can be enabled or disabled and will maintain that state
-
That’s it – you can then control and reference the Variable from your automations. Note you can create as many of these as you want – they can all use the “Dummy Automation for variables” automation so only one of those is required.
Hope this makes sense and is useful.