You’ve probably seen Homey Logic. Once you get the hang of it, it’s a great tool for any smart home. By creating your own Variables and using these in your Flows as Tags, you can often accomplish complex smart home automation in the blink of an eye.
Variables
Logic comes into play when you want the freedom to create and keep specific data, for example, a result of a calculation or text that your Homey should say aloud.
Variables are the building blocks of your Flows, and there are 3 types of them used in Homey:
- Yes/No
- Number
- Text
Yes/No
This Variable can only contain the values Yes or No. Basically, it evaluates to either true or false.
This variable is most commonly used for a few things:
- Tracking the state of a device
- Tracking whether a flow has run
- Stopping that same flow from running again
Number
This Variable can hold any number — a float, an integer, a negative value — it doesn’t matter.
With a Number, you can:
- Track and set values such as light intensity, volume, battery level, and energy usage
- Track weather conditions — temperature, pressure, humidity, luminosity, and act upon these conditions
- Create a state and track it
Text
These variables are versatile, as they can hold just about any value. Common ways of using this type are:
- Date & time
- General description of the weather – e.g. clouds
- Artist, album, and track information from Spotify or Sonos
- A URL
Creating Variables
- Go to More (…) → Logic → +.
- Type in the name of the Variable → select the type of Variable you want.
- Enter the initial value.
- You’re now free to use your new Variable across your Flows.
Tags
Tags include Variables created by you, but also by Homey and your smart home devices. When checking whether you can add them to a Flow card, keep an eye out for the Tag symbol that pops up.
There are 4 types of Tags used in Homey, and they are always color-coded:
- Numbers – blue
- Yes/No – orange
- Text – green
- Image – pink
These can either be global, ie, usable across all Flows, or local, usable only in one specific Flow. The latter is created in the When section of your Flow.
The Image Tags are normally created by your camera.
Using Tags in Flow actions
Tags can be used in many useful and unique ways. For example, you can run calculations with device Tags, and you can save the result as one of your existing Variables, thus updating its value. The process is simple:
- Create a Flow.
- In the Then section, add a Flow card → if available, tap the Tag symbol in one of the Flow card’s fields.
- Select a Tag from the list of your Variables or from the devices that have any Tags associated with them.
- Finish the Flow and save it.
Using Tags to start Flows
Changes to Tag values can also trigger Flows. In such a case:
- Create a Flow.
- In the When section, add a Flow card → select Logic → A variable changed.
- Select a Tag from the list of your Variables or from the devices that have any Tags associated with them.
- Finish the Flow and save it.
Using Webhooks to start Flows
A similar option is available for Webhooks. If you’re an advanced user, you can make a GET request from another device.
- Create a Flow.
- In the When section, add a Flow card → select Logic → Webhook event [Event] has been received.
- In the Event field, type a unique phrase, such as
my_unique_event. - Hover over the
iicon, and copy the URL displayed there. - The URL should look like this:
https://webhook.homey.app/5edb9248470f0276f4b63151/my_event?tag=my_tag - Replace
my_eventwith your unique phrasemy_unique_event.