home-assistant.io/source/_cookbook/automation_using_timeinterval_inputboolean.markdown
R1chardTM 0379b23e43 Fix automation script in cookbook
Fix automation example 'Using time interval and input boolean' in cookbook.
2016-02-08 22:49:01 +01:00

1.0 KiB

layout title description date sidebar comments sharing footer ha_category
page Using time interval and input boolean Automation to get a random color every 2 minutes that can be turned on/off. 2016-02-07 22:35 +0800 true false true true Automation Examples

{% linkable_title Change Hue light on interval to random color based on state of a input boolean %}

Note, Philips Hue is currently the only light platform that support the random effect.

input_boolean:
  loop_livingcolors:
    name: Loop LivingColors
    initial: off
    icon: mdi:spotlight

automation:
# Changes Hue light to random color based on state of a input boolean
- alias: 'Set LivingColors to random color'
  trigger:
    platform: time
    minutes: '/2'
    seconds: 0
  condition:
    platform: 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