mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 18:40:14 -04:00
109 lines
3.9 KiB
YAML
109 lines
3.9 KiB
YAML
# Calculation References:
|
|
# https://nathanfiscus.github.io/inovelli-notification-calc/
|
|
# https://community.inovelli.com/t/home-assistant-2nd-gen-switch-rgb-working/168/62
|
|
# https://docs.google.com/spreadsheets/u/1/d/1SGJrJHCUtz8AzznWL_mLCTJjjr2U0IpltcUkRr7N_6M/edit?usp=sharing
|
|
description: "Set color on Inovelli LED dimmer"
|
|
mode: queued
|
|
|
|
fields:
|
|
entity_id:
|
|
description: The entity to change
|
|
example: input_number.master_bedroom_light_led
|
|
color:
|
|
description: The color to set the LED (Red, Orange, Green, Blue, Pink, Yellow(Default), Cyan, Purple)
|
|
example: Purple
|
|
duration:
|
|
description: "How long the effect should last (1 Second, 15 Minutes, 2 Hours, Indefinitely(Default))"
|
|
example: '"30 Seconds"'
|
|
effect:
|
|
description: "The effect to use (Off, Solid, Chase(Default), Fast Blink, Slow Blink, Pulse)"
|
|
example: Chase
|
|
level:
|
|
description: Brightness level (1-10, Default is 4)
|
|
example: 4
|
|
value:
|
|
description: A pre-calculated Inovelli LED value
|
|
example: 33490140
|
|
sequence:
|
|
- action: input_number.set_value
|
|
data_template:
|
|
entity_id: "{{ entity_id }}"
|
|
value: >
|
|
{%- set value = value|default(0) | int %}
|
|
{# Skip the calculations for effect = "off". #}
|
|
{% if effect|title == "Off" %}
|
|
0
|
|
{# Skip the calculations if a value is already given #}
|
|
{% elif value | int > 0 %}
|
|
{{ value | int }}
|
|
{% else %}
|
|
{# Set default values if any needed values are missing. #}
|
|
{% set color = color|default("Yellow") %}
|
|
{% set level = level|default(4) | int %}{# 1-10 #}
|
|
{% set duration = duration|default("60 Seconds") %}
|
|
{% set effect = effect|default("Pulse") %}
|
|
{# Let's make things easy by using descriptive text instead of hard to understand numbers. #}
|
|
{% set colors = {
|
|
"Red": 1,
|
|
"Orange": 21,
|
|
"Green": 85,
|
|
"Blue": 170,
|
|
"Pink": 234,
|
|
"Yellow": 42,
|
|
"Cyan": 127,
|
|
"Purple": 195
|
|
} %}
|
|
{% set durations = {
|
|
"1 Second": 1,
|
|
"2 Seconds": 2,
|
|
"3 Seconds": 3,
|
|
"4 Seconds": 4,
|
|
"5 Seconds": 5,
|
|
"6 Seconds": 6,
|
|
"7 Seconds": 7,
|
|
"8 Seconds": 8,
|
|
"9 Seconds": 9,
|
|
"10 Seconds": 10,
|
|
"15 Seconds": 15,
|
|
"20 Seconds": 20,
|
|
"25 Seconds": 25,
|
|
"30 Seconds": 30,
|
|
"35 Seconds": 35,
|
|
"40 Seconds": 40,
|
|
"45 Seconds": 45,
|
|
"50 Seconds": 50,
|
|
"55 Seconds": 55,
|
|
"60 Seconds": 60,
|
|
"2 Minutes": 62,
|
|
"3 Minutes": 63,
|
|
"4 Minutes": 64,
|
|
"15 Minutes": 75,
|
|
"30 Minutes": 90,
|
|
"45 Minutes": 105,
|
|
"1 Hour": 120,
|
|
"2 Hours": 122,
|
|
"Indefinitely": 255
|
|
} %}
|
|
{% set effects = {
|
|
"Off": 0,
|
|
"Solid": 1,
|
|
"Chase": 2,
|
|
"Fast Blink": 3,
|
|
"Slow Blink": 4,
|
|
"Blink": 4,
|
|
"Pulse": 5,
|
|
"Breath": 5
|
|
} %}
|
|
{# Preform the Inovelli mind bending mathmatics automatically for us! :) #}
|
|
{#{ colors[color|title] + (level * 256) + (durations[duration|title] * 65536) + (effects[effect|title] * 16777216) }#}
|
|
{% set value = (colors[color|title] + (level * 256) + (durations[duration|title] * 65536) + (effects[effect|title] * 16777216)) %}
|
|
{{ value }}
|
|
{% endif %}
|
|
|
|
- action: logbook.log
|
|
data_template:
|
|
name: Inovelli LED Number
|
|
entity_id: script.inovelli_led_number
|
|
message: >
|
|
{{ states("sensor.date_time_iso") }} Inovelli LED ran with the following options: {{ entity_id }} {{ led }} {{ color }} {{ duration }} {{ effect }} {{ level }} and generated {{ states("input_number.master_bedroom_light_led") | int }}
|