home-assistant.io/source/_cookbook/automation_using_timeinterval_inputboolean.markdown
Ville Skyttä b39bd81c6e Spelling fixes (#4532)
* Spelling fixes

* "It's" -> "its" fixes

* Fix capitalization of "Pi" in "Raspberry Pi"

"Pi", not "PI" or "pi".
2018-01-28 22:28:56 +01:00

43 lines
1.0 KiB
Markdown

---
layout: page
title: "Using time interval and input boolean"
description: "Automation to get a random color every 2 minutes that can be turned on/off."
date: 2016-02-07 22:35 +0800
sidebar: true
comments: false
sharing: true
footer: true
ha_category: Automation Examples
---
#### {% linkable_title Change Hue light on interval to random color based on state of an input boolean %}
_Note, Philips Hue is currently the only light platform that support the random effect._
```yaml
input_boolean:
loop_livingcolors:
name: Loop LivingColors
initial: off
icon: mdi:spotlight
automation:
# Changes Hue light every two minutes to random color if input boolean is set to on
- alias: 'Set LivingColors to random color'
trigger:
platform: time
minutes: '/2'
seconds: 0
condition:
condition: state
entity_id: input_boolean.loop_livingcolors
state: 'on'
action:
service: light.turn_on
entity_id: light.woonkamer_livingcolors
data:
effect: random
transition: 5
brightness: 255
```