@Hellis81 wrote:
I’m trying to make my receiver turn down the volume automatically when it gets too loud.
I have added a microphone to a ESP8266 and use the ADC to get the “volume”. The return is a voltage reading.ESPhome:
sensor: - platform: adc pin: A0 name: "Sound" update_interval: 0.2s filters: - multiply: 3.3
The value is visible in Home Assistant as it should.
I also added a stats sensor to even out the spikes some.Configuration.yaml
sensor: - platform: statistics entity_id: sensor.sound sampling_size: 5
This means the original value, sensor.sound, updates every 0.2 seconds and sensor.stats is average of 5 values (1 second).
The automation is:
- id: '1586672460751' alias: skruva ner förstärkaren description: '' trigger: - platform: template value_template: '{{ states.sensor.sound.state > 1.9 }}' condition: [] action: - data: {} service: script.1586684255359 # script that turns down the volume of the receiver
Why is that not triggered as it should? Not even with {{ states.sensor.stats.state > 1.9 }} does it work.
Anyone that spots the problem?
Posts: 4
Participants: 2