Skip to content

Commit

Permalink
Fix volume display
Browse files Browse the repository at this point in the history
  • Loading branch information
tetele committed Jan 15, 2025
1 parent c67c00a commit a3a54fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions esphome/onju-modules/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ script:

- id: control_led_volume_touched
then:
- lambda: |
id(volume_touched) = false;
- lambda: id(volume_touched) = false;
- script.execute: control_led

- id: control_led_voice_assistant_waiting_for_command_phase
then: []
Expand Down
19 changes: 8 additions & 11 deletions esphome/onju-modules/media_player.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ media_player:
float new_volume = id(onju_out).volume;
if(abs(new_volume-old_volume) > 0.0001) {
if(old_volume != -1) {
id(show_volume) = true;
id(volume_touched) = true;
id(control_led)->execute();
}
}
old_volume = new_volume;
globals:
- id: show_volume
type: bool
restore_value: no
initial_value: "false"

light:
- id: !extend top_led
Expand Down Expand Up @@ -56,24 +52,25 @@ script:
id: onju_out
volume: !lambda return clamp(id(onju_out).volume+volume, 0.0f, 1.0f);
- lambda: |
id(show_volume) = true;
// Required for when volume is changed externally
id(volume_touched) = true;
- script.execute: control_led

- id: !extend control_led_volume_touched
- id: !remove control_led_volume_touched
- id: control_led_volume_touched
mode: restart
then:
- if:
condition:
lambda: "return id(show_volume);"
lambda: "return id(volume_touched);"
then:
- light.turn_on:
id: top_led
effect: show_volume
- delay: 1s
- lambda: |
id(show_volume) = false;
id(volume_touched) = false;
- script.execute: control_led
else:
- light.turn_off: top_led

binary_sensor:
- id: !extend volume_down
Expand Down

0 comments on commit a3a54fd

Please sign in to comment.