Add BMB rotary knob files

This commit is contained in:
Nate Harris 2023-07-25 22:49:53 -06:00
parent 9c81d33af6
commit 499005c498
6 changed files with 2388 additions and 0 deletions

View File

@ -0,0 +1,101 @@
alias: "!Background - Kitchen Brightness + Max/100 Setting"
description: ""
trigger:
- platform: state
entity_id:
- input_number.kitchen_rgb_brightness
from: null
to: null
alias: When Helper, Kitchen RGB Brightness value has changed
- platform: state
entity_id:
- input_boolean.kitchen_rgb_toggle
from: null
to: null
alias: When Kitchen RGB Toggle has changed
- platform: state
entity_id:
- input_boolean.toggle_kitchen_rgb_100
from: null
to: null
- platform: state
entity_id:
- input_boolean.toggle_kitchen_rgb_top
from: null
to: null
- platform: state
entity_id:
- input_boolean.toggle_kitchen_rgb_bottom
from: null
to: null
condition: []
action:
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 600
- if:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_100
state: "off"
then:
- if:
- condition: state
entity_id: input_boolean.kitchen_rgb_toggle
state: "on"
then:
- if:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_top
state: "on"
then:
- service: light.turn_on
data:
brightness: "{{ states('input_number.kitchen_rgb_brightness') }}"
target:
entity_id: light.kitchen_rgb_top_light
alias: Call Service - Read Helper value, change top RGB light value
alias: IF Top Toggle ON, read Helper value, change light value
- if:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_bottom
state: "on"
then:
- service: light.turn_on
data:
brightness: "{{ states('input_number.kitchen_rgb_brightness') }}"
target:
entity_id: light.kitchen_rgb_bottom_light
alias: >-
Call Service - Read Helper value, change bottom RGB light
value
alias: IF Bottom Toggle ON, read Helper value, change light value
alias: >-
IF RGB Toggle is ON, read brightness value, check TOP/BOT toggle,
change light values
else:
- service: light.turn_off
data:
transition: 3
target:
entity_id:
- light.kitchen_rgb_top_light
- light.kitchen_rgb_bottom_light
alias: Make sure Max/100 Toggle is OFF
else:
- if:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_100
state: "on"
then:
- service: light.turn_on
data:
transition: 2
kelvin: 6500
brightness: 255
target:
entity_id:
- light.kitchen_rgb_top_light
- light.kitchen_rgb_bottom_light
mode: single

View File

@ -0,0 +1,226 @@
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:mushroom-template-card
layout: vertical
icon: phu:magentatv
icon_color: |
{% if states('input_number.kitchen_rgb_mode') | int == 0 %}
0, 0 ,0 , 1
{% elif states('input_number.kitchen_rgb_mode') | int == 1 %}
{{ states('input_text.kitchen_kelvin_to_rgb') }}
{% elif states('input_number.kitchen_rgb_mode') | int == 2 %}
{{ states('input_text.kitchen_kelvin_to_rgb') }}
{% elif states('input_number.kitchen_rgb_mode') | int == 3 %}
{{ states('input_text.kitchen_rgb_color_value') }}
{% elif states('input_number.kitchen_rgb_mode') | int == 4 %}
{{ states('input_number.kitchen_rgb_brightness') | int }}, {{ states('input_number.kitchen_rgb_brightness') | int }}, {{ states('input_number.kitchen_rgb_brightness') | int }}, 1
{% else %}
255,0,0,1
{% endif %}
fill_container: true
primary: Mode
tap_action:
action: none
badge_icon: ''
multiline_secondary: true
secondary: |
{% if states('input_number.kitchen_rgb_mode') | int == 0 %}
0 (OFF)
{% elif states('input_number.kitchen_rgb_mode') | int == 1 %}
1 (Kelvin)
{% elif states('input_number.kitchen_rgb_mode') | int == 2 %}
3 (Kelvin Brightness)
{% elif states('input_number.kitchen_rgb_mode') | int == 3 %}
3 (RGB)
{% elif states('input_number.kitchen_rgb_mode') | int == 4 %}
4 (RGB Brightness)
{% else %}
error
{% endif %}
hold_action:
action: none
double_tap_action:
action: none
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--shape-animation: spin 20s linear infinite;
--shape-color: rgba(0,0,0,.07);
--icon-symbol-size: 90px;
--icon-size: 89px;
background: none
-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 50px), #000 0);
}
- type: custom:mushroom-template-card
layout: vertical
icon: phu:magentatv
icon_color: '{{ states(''input_text.kitchen_kelvin_to_rgb'')}}'
fill_container: true
primary: '{{ states("input_number.kitchen_rgb_temperature")}}'
tap_action:
action: none
badge_icon: ''
multiline_secondary: true
secondary: Kelvin
hold_action:
action: none
double_tap_action:
action: none
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--shape-animation: spin 20s linear infinite;
--shape-color: rgba(0,0,0,.07);
--icon-symbol-size: 90px;
--icon-size: 89px;
background: none
-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 50px), #000 0);
}
- type: custom:mushroom-template-card
layout: vertical
icon: phu:magentatv
icon_color: '{{ states(''input_text.kitchen_rgb_color_value'')}}'
fill_container: true
primary: '{{ states(''input_text.kitchen_rgb_color_value'')}}'
tap_action:
action: none
badge_icon: ''
multiline_secondary: true
secondary: RGB ({{ states('input_number.kitchen_rgb_track') | float | int }})
hold_action:
action: none
double_tap_action:
action: none
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--shape-animation: spin 20s linear infinite;
--shape-color: rgba(0,0,0,.07);
--icon-symbol-size: 90px;
--icon-size: 89px;
background: none;
-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 50px), #000 0);
}
- type: custom:mushroom-template-card
layout: vertical
icon: phu:magentatv
icon_color: >
{{ states('input_number.kitchen_rgb_brightness') | int }}, {{
states('input_number.kitchen_rgb_brightness') | int }}, {{
states('input_number.kitchen_rgb_brightness') | int }}
fill_container: true
primary: >-
{{ (states("input_number.kitchen_rgb_brightness") | int / 255 * 100) |
round(0) }}%
tap_action:
action: none
badge_icon: ''
multiline_secondary: true
secondary: >-
Brightness ({{ states('input_number.kitchen_rgb_brightness') | float |
int }})
hold_action:
action: none
double_tap_action:
action: none
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--shape-animation: spin 20s linear infinite;
--shape-color: rgba(0,0,0,.07);
--icon-symbol-size: 90px;
--icon-size: 89px;
background: none
-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 50px), #000 0);
}
- type: custom:my-slider-v2
entity: input_number.kitchen_rgb_temperature
styles:
card:
- height: 50px
container:
- width: 100%
- height: 100%
- position: relative
- overflow: hidden
- border-radius: 0px
track:
- width: 100%
- height: 100%
- position: relative
- background: rgba(235,167,5,.7)
progress:
- height: 100%
- background: rgba(255,234,182,.9)
- position: absolute
- width: 0.00%
thumb:
- height: 100%
- background: white
- position: absolute
- right: '-5px'
- width: 10px
- type: custom:my-slider-v2
entity: input_number.kitchen_rgb_track
styles:
card:
- height: 50px
container:
- width: 100%
- height: 100%
- position: relative
- overflow: hidden
- border-radius: 0px
track:
- width: 100%
- height: 100%
- position: relative
- background: rgba(255,0,0,.3)
progress:
- height: 100%
- background: rgba(0,0,255,.4)
- position: absolute
- width: 0.00%
thumb:
- height: 100%
- background: rgba(0,255,0,.7)
- position: absolute
- right: '-5px'
- width: 10px
- type: custom:my-slider-v2
entity: input_number.kitchen_rgb_brightness
styles:
card:
- height: 50px
container:
- width: 100%
- height: 100%
- position: relative
- overflow: hidden
- border-radius: 0px
track:
- width: 100%
- height: 100%
- position: relative
- background: rgba(100,100,100,.3)
progress:
- height: 100%
- background: rgba(255,255,255,.8)
- position: absolute
- width: 0.00%
thumb:
- height: 100%
- background: white
- position: absolute
- right: '-5px'
- width: 10px

View File

@ -0,0 +1,26 @@
These need to be put in to Home Assistant as helpers so the script can both
read the values for calculations and write the new value to them. Then,
these helpers will be used with other automations to control RGBCW lights
separately from the main knob control automation.
I chose to use helpers this way because it allows me to sync other automations
I have and make sure everything is reading the same values, if I want them to.
-----input.number helpers-----
input_number.kitchen_rgb_mode (set range=0-4)
input_number.kitchen_rgb_temperature (set range=2000-6500)
input_number.kitchen_rgb_brightness (set range=0-255)
input_number.kitchen_rgb_track (set range=0-1530)
------------------------------
------input.text helpers------
input_text.kitchen_rgb_color_value (will store RGB value like, "255,231,69")
------------------------------

View File

@ -0,0 +1,47 @@
alias: "!Background - Kitchen - Kelvin Changer"
description: ""
trigger:
- platform: state
entity_id:
- input_number.kitchen_rgb_temperature
from: null
to: null
enabled: true
- platform: state
entity_id:
- input_number.kitchen_rgb_mode
from: null
to: null
condition: []
action:
- if:
- condition: template
value_template: "{{ states('input_number.kitchen_rgb_mode') | int == 1 }}"
alias: IF Mode 1 = Kelvin
enabled: true
then:
- if:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_top
state: "on"
then:
- service: light.turn_on
data:
kelvin: "{{ states('input_number.kitchen_rgb_temperature') }}"
target:
entity_id: light.kitchen_rgb_top_light
alias: IF Top Toggle ON
- if:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_bottom
state: "on"
alias: IF Bottom Toggle ON
then:
- service: light.turn_on
data:
kelvin: "{{ states('input_number.kitchen_rgb_temperature') }}"
target:
entity_id: light.kitchen_rgb_bottom_light
alias: IF Bottom Toggle ON
alias: Do shit
mode: single

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,104 @@
alias: "!Background - Kitchen - RGB Changer"
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.kitchen_rgb_toggle
from: null
to: null
- platform: state
entity_id:
- input_boolean.toggle_kitchen_rgb_top
from: null
to: null
- platform: state
entity_id:
- input_boolean.toggle_kitchen_rgb_bottom
from: null
to: null
- platform: state
entity_id:
- input_number.kitchen_rgb_mode
from: null
to: null
- platform: state
entity_id:
- input_text.kitchen_rgb_color_value
from: null
to: null
condition: []
action:
- if:
- condition: template
value_template: "{{ states('input_number.kitchen_rgb_mode') | int == 3 }}"
alias: IF Mode 3 = RGB
enabled: true
then:
- if:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_top
state: "on"
then:
- service: light.turn_on
data:
rgb_color:
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[0]
| int }}
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[1]
| int }}
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[2]
| int }}
transition: 0
target:
entity_id: light.kitchen_rgb_top_light
- if:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_bottom
state: "on"
then:
- service: light.turn_on
data:
rgb_color:
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[0]
| int }}
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[1]
| int }}
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[2]
| int }}
transition: 0
target:
entity_id: light.kitchen_rgb_bottom_light
- if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_top
state: "off"
- condition: state
entity_id: input_boolean.toggle_kitchen_rgb_bottom
state: "off"
then:
- service: light.turn_on
data:
transition: 3
rgb_color:
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[0]
| int }}
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[1]
| int }}
- >-
{{ states('input_text.kitchen_rgb_color_value').split(',')[2]
| int }}
target:
entity_id:
- light.kitchen_rgb_bottom_light
- light.kitchen_rgb_top_light
mode: single