Добрый день друзья!
Хочу рассказать вам как управлять громкостью телевизора при помощи диммера.
Good afternoon friends!
I want to tell you how to control the volume of the TV using a dimmer.
Я сделал управление несколькими способами
- если не нажимать на диммер, то можно прибавлять громкость по одной единице.
- если на жать на кнопку то можно прибавлять громкость по 5 единиц
- если нажать на кнопку еще один раз то можно прибавлять громкость по 10 единиц.
- если бездействовать 30 секунд то все начнется с первого пункта.
I have done management in several ways
- if you do not press the dimmer, you can turn up the volume one unit at a time.
- if you press the button, you can turn up the volume by 5 units
- if you press the button one more time, you can turn up the volume by 10 units.
- if you do nothing for 30 seconds, then everything will start from the first point.
Это счетчик, при каждом нажатии на кнопку от прибавляет по 1 начиная с 0.
This is a counter, each time you click on the from button, it adds 1 starting from 0.
counter:
hall_projector:
initial: 0
step: 1
Таймер нужен для того чтобы по истечению этого времени все действия начались с начала.
The timer is needed so that after this time all actions start from the beginning.
timer:
hall_projector:
duration: "00:00:30"
В скрипте прописал на сколько будет прибавляться звук на телевизоре.
In the script, I prescribed how much sound will be added on the TV.
script:
# Увеличить громкость на проекторе на 1 деление
hall_projector_volume_up:
sequence:
- service: remote.send_command
entity_id: remote.xiaomi_miio_192_168_1_111
data:
command:
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
# Увеличить громкость на проекторе на 5 делений
hall_projector_volume_up_5:
sequence:
- service: remote.send_command
entity_id: remote.xiaomi_miio_192_168_1_111
data:
command:
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
#Увеличить громкость на проекторе на 10 делений
hall_projector_volume_up_10:
sequence:
- service: remote.send_command
entity_id: remote.xiaomi_miio_192_168_1_111
data:
command:
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
- 'Z6VHAPgBAABsAgAAuAYAAOMIAABuEQAAkCIAABSbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQEBAQEBAQICAgICBgNQA='
#Уменьшить громкость на проекторе на 1 деление
hall_projector_volume_down:
sequence:
- service: remote.send_command
entity_id: remote.xiaomi_miio_192_168_1_111
data:
command:
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
#Уменьшить громкость на проекторе на 5 делений
hall_projector_volume_down_5:
sequence:
- service: remote.send_command
entity_id: remote.xiaomi_miio_192_168_1_111
data:
command:
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
#Уменьшить громкость на проекторе на 10 делений
hall_projector_volume_down_10:
sequence:
- service: remote.send_command
entity_id: remote.xiaomi_miio_192_168_1_111
data:
command:
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAA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AgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
- 'Z6VLAPsBAABqAgAAtgYAAOQIAACHEQAAiCIAAGydAACQeAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFEBAQEBAQEBAgICAgIBAgICAgIBAQECAQEBAQICAgECBgNXA1AA=='
Данная автоматизация запускает таймер при каждом нажатии. Если будете нажимать постоянно то таймер будет начинаться с начала.
This automation starts a timer with each click. If you press constantly, the timer will start from the beginning.
automation:
#Включить таймер
- alias: hall_projector_volume_increment
initial_state: true
trigger:
- platform: state
entity_id: sensor.0x84ba20fffe8d6235_action
to: 'single'
action:
service: timer.start
target:
entity_id: timer.hall_projector
Данна автоматизация прибавляет в счетчике значения при каждом нажатии.
This automation adds values to the counter with each click.
automation:
#Прибавлять данные в счетчике
- alias: hall_projector_volume_increment
initial_state: true
trigger:
- platform: state
entity_id: sensor.0x84ba20fffe8d6235_action
to: 'single'
action:
service: counter.increment
target:
entity_id: counter.hall_projector
Данная автоматизация обнуляет счетчик если таймер бездействует или вышло время которое я указал выше.
This automation resets the counter if the timer is idle or the time I specified above has expired.
automation:
#Сбросить счетчик
- alias: hall_projector_volume_reset
initial_state: true
trigger:
- platform: state
entity_id: timer.hall_projector
to: 'idle'
action:
- service: counter.reset
target:
entity_id: counter.hall_projector
Данные автоматизации прибавляют или убавляют звук при нашите и повороте диммера.
Automation data adds or decreases the sound when the dimmer is turned on and off.
automation:
#Прибавить звук на 1 деление
- alias: hall_projector_volume_up
initial_state: true
trigger:
- platform: state
entity_id: sensor.0x84ba20fffe8d6235_action
to: 'rotate_right'
condition:
- condition: template
value_template: '{{ is_state("counter.hall_projector", "0") }}'
action:
- service: script.turn_on
target:
entity_id: script.hall_projector_volume_up
#Прибавить звук на 5 делений
- alias: hall_projector_volume_up
initial_state: true
trigger:
- platform: state
entity_id: sensor.0x84ba20fffe8d6235_action
to: 'rotate_right'
condition:
- condition: template
value_template: '{{ is_state("counter.hall_projector", "1") }}'
action:
- service: script.turn_on
target:
entity_id: script.hall_projector_volume_up_5
#Прибавить звук на 10 делений
- alias: hall_projector_volume_up
initial_state: true
trigger:
- platform: state
entity_id: sensor.0x84ba20fffe8d6235_action
to: 'rotate_right'
condition:
- condition: template
value_template: '{{ is_state("counter.hall_projector", "2") }}'
action:
- service: script.turn_on
target:
entity_id: script.hall_projector_volume_up_10
# Убавить звук на 1 деление
- alias: hall_projector_volume_down
initial_state: true
trigger:
- platform: state
entity_id: sensor.0x84ba20fffe8d6235_action
to: 'rotate_left'
condition:
- condition: template
value_template: '{{ is_state("counter.hall_projector", "0") }}'
action:
- service: script.turn_on
target:
entity_id: script.hall_projector_volume_down
# Убавить звук на 5 делений
- alias: hall_projector_volume_down
initial_state: true
trigger:
- platform: state
entity_id: sensor.0x84ba20fffe8d6235_action
to: 'rotate_left'
condition:
- condition: template
value_template: '{{ is_state("counter.hall_projector", "1") }}'
action:
- service: script.turn_on
target:
entity_id: script.hall_projector_volume_down_5
# Убавить звук на 10 делений
- alias: hall_projector_volume_down
initial_state: true
trigger:
- platform: state
entity_id: sensor.0x84ba20fffe8d6235_action
to: 'rotate_left'
condition:
- condition: template
value_template: '{{ is_state("counter.hall_projector", "2") }}'
action:
- service: script.turn_on
target:
entity_id: script.hall_projector_volume_down_10
Спасибо за внимание!
Thanks for your attention!