Skip to content

Instantly share code, notes, and snippets.

@peyanski
Created February 14, 2024 07:25
Show Gist options
  • Save peyanski/bd553dc7fe9070a55ed1884489fe368b to your computer and use it in GitHub Desktop.
Save peyanski/bd553dc7fe9070a55ed1884489fe368b to your computer and use it in GitHub Desktop.
Demo Automation that uses BMI160 to control a Smart Bulb. Please change device_id & entity_id with yours!
alias: rotate Gyro to control a Smart Bulb
description: ""
trigger:
- type: value
platform: device
device_id: 1aebc4c337ba29a2c0056367ed4f14d9
entity_id: afb31e3560db5372fb7df63e258994d5
domain: sensor
below: -6
id: rotate-right-x
- type: value
platform: device
device_id: 1aebc4c337ba29a2c0056367ed4f14d9
entity_id: afb31e3560db5372fb7df63e258994d5
domain: sensor
id: rotate-left-x
above: 6
- type: value
platform: device
device_id: 1aebc4c337ba29a2c0056367ed4f14d9
entity_id: 580d0462c9e99bf6a5b29a27a70417fb
domain: sensor
id: rotate-up-y
above: 6
- type: value
platform: device
device_id: 1aebc4c337ba29a2c0056367ed4f14d9
entity_id: 580d0462c9e99bf6a5b29a27a70417fb
domain: sensor
id: rotate-down-y
below: -6
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- rotate-right-x
sequence:
- service: light.turn_on
target:
entity_id:
- light.smart_bulb
data:
brightness_pct: 100
kelvin: 6500
- conditions:
- condition: trigger
id:
- rotate-left-x
sequence:
- service: light.turn_off
target:
entity_id:
- light.smart_bulb
data: {}
- conditions:
- condition: trigger
id:
- rotate-up-y
sequence:
- service: light.turn_on
target:
entity_id:
- light.smart_bulb
data:
color_name: blue
brightness_pct: 100
- conditions:
- condition: trigger
id:
- rotate-down-y
sequence:
- service: light.turn_on
target:
entity_id:
- light.smart_bulb
data:
color_name: red
brightness_pct: 100
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment