Skip to content

Commit

Permalink
Remove smart dimming (replaced by custom component)
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarb committed Dec 15, 2024
1 parent b9e6ba5 commit 1525b49
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 149 deletions.
100 changes: 0 additions & 100 deletions configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -374,106 +374,6 @@ light:
data:
volume_level: "{{ (brightness / 255 * 100)|int / 100 }}"

office_lights_smart: &smart_light
friendly_name: "Office lights smart"
unique_id: office_lights_dimming
level_template: >
{{ (expand('group.office')
| map(attribute='attributes.brightness', default=0)
| select("greaterthan", 0)
| list or [0])
| average
| round }}
value_template: >
{{ expand('group.office')
| map(attribute='attributes.brightness', default=0)
| sum > 0 }}
temperature_template: >
{{ ((expand('group.office')
| map(attribute='attributes.color_temp', default=-1)
| select("greaterthan", 0)
| list or [0])| average | round) or Undefined }}
min_mireds_template: >
{{ expand('group.office')
| selectattr('domain', '==', 'light')
| selectattr('attributes.min_mireds')
| map(attribute='attributes.min_mireds')
| list | min | int }}
max_mireds_template: >
{{ expand('group.office')
| selectattr('domain', '==', 'light')
| selectattr('attributes.max_mireds')
| map(attribute='attributes.max_mireds')
| list | max | int }}
turn_on:
service: light.turn_on
target:
entity_id: group.office
turn_off:
service: light.turn_off
target:
entity_id: group.office
set_temperature:
- service: light.turn_on
data:
color_temp: "{{ color_temp }}"
target:
entity_id: >
{{ expand('group.office')
| selectattr('attributes.brightness')
| map(attribute='entity_id')
| list }}
set_level:
# Set brightness by amount to all lights (when all are off), OR only the lights that would remain on by the brightness change
- service: light.turn_on
data:
brightness_step: "{{ brightness - state_attr('light.office_lights_smart', 'brightness')|int }}"
target:
entity_id: >
{% set brightness_from = state_attr('light.office_lights_smart', 'brightness')|int %}
{% set brightness_change = brightness - brightness_from %}
{{ expand("group.office")
| selectattr('attributes.brightness')
| selectattr('attributes.brightness', '>', -brightness_change)
| map(attribute='entity_id')
| list or
expand('group.office')
| selectattr('domain', '==', 'light')
| map(attribute='entity_id')
| list if brightness != 255 else [] }}
# Set brightness to 1 for all lights that would turn off, keeping them on
- service: light.turn_on
data:
brightness_pct: 1
target:
entity_id: >
{% set brightness_from = state_attr('light.office_lights_smart', 'brightness')|int %}
{% set brightness_change = brightness - brightness_from %}
{{ expand('group.office')
| selectattr('attributes.brightness')
| selectattr('attributes.brightness', '<=', -brightness_change)
| map(attribute='entity_id')
| list
}}
# Set brightness to 100 for all lights currently on when slider moves to 100%, or all the lights if all are currently off
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: >
{{ expand("group.office")
| selectattr('attributes.brightness')
| map(attribute='entity_id')
| list or
expand('group.office')
| selectattr('domain', '==', 'light')
| map(attribute='entity_id')
| list if brightness == 255 else [] }}
office_smart_lights_v:
<<: *smart_light
friendly_name: "Office lights smart V2"
unique_id: office_lights_dimming_v2

shell_command:
turn_off_computer: ssh {{ ssh_user }} net rpc shutdown -I {{ ip }} -U {{ user }} -t {{ timeout }}
Expand Down
50 changes: 1 addition & 49 deletions scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,52 +287,4 @@ cast_goodnight_playlist:
{{ states('sensor.goodnight_playlist_story_indexes')
| from_json()
| random() }}
smart_dimming_set_level:
alias: Smart dimming of groups with lights in them
sequence:
# Set brightness by amount to all lights (when all are off), OR only the lights that would remain on by the brightness change
- service: light.turn_on
data:
brightness_step: "{{ brightness - state_attr('light.office_lights_smart', 'brightness')|int }}"
target:
entity_id: >
{% set brightness_from = state_attr('light.office_lights_smart', 'brightness')|int %}
{% set brightness_change = brightness - brightness_from %}
{{ expand(entity_id)
| selectattr('attributes.brightness')
| selectattr('attributes.brightness', '>', -brightness_change)
| map(attribute='entity_id')
| list or
expand(entity_id)
| selectattr('domain', '==', 'light')
| map(attribute='entity_id')
| list if brightness != 255 else [] }}
# Set brightness to 1 for all lights that would turn off, keeping them on
- service: light.turn_on
data:
brightness_pct: 1
target:
entity_id: >
{% set brightness_from = state_attr('light.office_lights_smart', 'brightness')|int %}
{% set brightness_change = brightness - brightness_from %}
{{ expand(entity_id)
| selectattr('attributes.brightness')
| selectattr('attributes.brightness', '<=', -brightness_change)
| map(attribute='entity_id')
| list
}}
# Set brightness to 100 for all lights currently on when slider moves to 100%, or all the lights if all are currently off
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: >
{{ expand("group.office")
| selectattr('attributes.brightness')
| map(attribute='entity_id')
| list or
expand(entity_id)
| selectattr('domain', '==', 'light')
| map(attribute='entity_id')
| list if brightness == 255 else [] }}

0 comments on commit 1525b49

Please sign in to comment.