Compare commits
	
		
			7 Commits
		
	
	
		
			565dac1946
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| cd68cd6811 | |||
| 2c6d185bfc | |||
| 861d1e1c4d | |||
| d75325198f | |||
| a259542870 | |||
| b9e92cd46e | |||
| 23e5caf13a | 
							
								
								
									
										134
									
								
								supersensor.yaml
									
									
									
									
									
								
							
							
						
						
									
										134
									
								
								supersensor.yaml
									
									
									
									
									
								
							@@ -164,39 +164,34 @@ globals:
 | 
				
			|||||||
    restore_value: yes
 | 
					    restore_value: yes
 | 
				
			||||||
    initial_value: '"mww_computer"'
 | 
					    initial_value: '"mww_computer"'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - id: light_is_holding
 | 
				
			||||||
 | 
					    type: bool
 | 
				
			||||||
 | 
					    restore_value: no
 | 
				
			||||||
 | 
					    initial_value: 'false'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
script:
 | 
					script:
 | 
				
			||||||
  - id: presence_light_on
 | 
					 | 
				
			||||||
    then:
 | 
					 | 
				
			||||||
      if:
 | 
					 | 
				
			||||||
        condition:
 | 
					 | 
				
			||||||
          - switch.is_on: enable_presence_led
 | 
					 | 
				
			||||||
          - light.is_off: output_led
 | 
					 | 
				
			||||||
        then:
 | 
					 | 
				
			||||||
          - light.turn_on:
 | 
					 | 
				
			||||||
              id: output_led
 | 
					 | 
				
			||||||
              brightness: 25%
 | 
					 | 
				
			||||||
              red: 1
 | 
					 | 
				
			||||||
              green: 1
 | 
					 | 
				
			||||||
              blue: 1
 | 
					 | 
				
			||||||
              transition_length: 1s
 | 
					 | 
				
			||||||
  - id: light_off
 | 
					  - id: light_off
 | 
				
			||||||
    then:
 | 
					    then:
 | 
				
			||||||
      if:
 | 
					      - if:
 | 
				
			||||||
        condition:
 | 
					          condition:
 | 
				
			||||||
          - binary_sensor.is_on: supersensor_occupancy
 | 
					            lambda: 'return !id(light_is_holding);'
 | 
				
			||||||
          - switch.is_on: enable_presence_led
 | 
					          then:
 | 
				
			||||||
        then:
 | 
					            - if:
 | 
				
			||||||
          - light.turn_on:
 | 
					                condition:
 | 
				
			||||||
              id: output_led
 | 
					                  - binary_sensor.is_on: supersensor_occupancy
 | 
				
			||||||
              brightness: 25%
 | 
					                  - switch.is_on: enable_presence_led
 | 
				
			||||||
              red: 1
 | 
					                then:
 | 
				
			||||||
              green: 1
 | 
					                  - light.turn_on:
 | 
				
			||||||
              blue: 1
 | 
					                      id: output_led
 | 
				
			||||||
              transition_length: 1s
 | 
					                      brightness: 25%
 | 
				
			||||||
        else:
 | 
					                      red: 1
 | 
				
			||||||
          - light.turn_off:
 | 
					                      green: 1
 | 
				
			||||||
              id: output_led
 | 
					                      blue: 1
 | 
				
			||||||
              transition_length: 1s
 | 
					                      transition_length: 1s
 | 
				
			||||||
 | 
					                else:
 | 
				
			||||||
 | 
					                  - light.turn_off:
 | 
				
			||||||
 | 
					                      id: output_led
 | 
				
			||||||
 | 
					                      transition_length: 1s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - id: pir_handler
 | 
					  - id: pir_handler
 | 
				
			||||||
    then:
 | 
					    then:
 | 
				
			||||||
@@ -413,13 +408,13 @@ i2s_audio:
 | 
				
			|||||||
      number: GPIO17 # WS
 | 
					      number: GPIO17 # WS
 | 
				
			||||||
    i2s_bclk_pin:
 | 
					    i2s_bclk_pin:
 | 
				
			||||||
      number: GPIO16  # SCK
 | 
					      number: GPIO16  # SCK
 | 
				
			||||||
  # Dummy I2S audio pipeline for "speaker"
 | 
					#  # Dummy I2S audio pipeline for "speaker"
 | 
				
			||||||
  - id: i2s_dummy
 | 
					#  - id: i2s_dummy
 | 
				
			||||||
    i2s_lrclk_pin:
 | 
					#    i2s_lrclk_pin:
 | 
				
			||||||
      number: GPIO15 # WS
 | 
					#      number: GPIO15 # WS
 | 
				
			||||||
      ignore_strapping_warning: true  # This isn't connected to anything anyways
 | 
					#      ignore_strapping_warning: true  # This isn't connected to anything anyways
 | 
				
			||||||
    i2s_bclk_pin:
 | 
					#    i2s_bclk_pin:
 | 
				
			||||||
      number: GPIO14  # SCK
 | 
					#      number: GPIO14  # SCK
 | 
				
			||||||
 | 
					
 | 
				
			||||||
microphone:
 | 
					microphone:
 | 
				
			||||||
  - platform: i2s_audio
 | 
					  - platform: i2s_audio
 | 
				
			||||||
@@ -430,23 +425,23 @@ microphone:
 | 
				
			|||||||
    pdm: false
 | 
					    pdm: false
 | 
				
			||||||
    channel: left
 | 
					    channel: left
 | 
				
			||||||
 | 
					
 | 
				
			||||||
speaker:
 | 
					#speaker:
 | 
				
			||||||
  # Dummy speaker to fix home-assistant/core#142363
 | 
					#  # Dummy speaker to fix home-assistant/core#142363
 | 
				
			||||||
  - platform: i2s_audio
 | 
					#  - platform: i2s_audio
 | 
				
			||||||
    id: dummy_speaker
 | 
					#    id: dummy_speaker
 | 
				
			||||||
    i2s_audio_id: i2s_dummy
 | 
					#    i2s_audio_id: i2s_dummy
 | 
				
			||||||
    i2s_dout_pin: GPIO25
 | 
					#    i2s_dout_pin: GPIO25
 | 
				
			||||||
    dac_type: external
 | 
					#    dac_type: external
 | 
				
			||||||
    bits_per_sample: 16bit
 | 
					#    bits_per_sample: 16bit
 | 
				
			||||||
    sample_rate: 16000
 | 
					#    sample_rate: 16000
 | 
				
			||||||
    channel: mono #mono will have bad performance, however, we are not using the on device speaker
 | 
					#    channel: mono #mono will have bad performance, however, we are not using the on device speaker
 | 
				
			||||||
    buffer_duration: 60ms
 | 
					#    buffer_duration: 60ms
 | 
				
			||||||
 | 
					
 | 
				
			||||||
micro_wake_word:
 | 
					micro_wake_word:
 | 
				
			||||||
  id: mww
 | 
					  id: mww
 | 
				
			||||||
  microphone:
 | 
					  microphone:
 | 
				
			||||||
    microphone: mic
 | 
					    microphone: mic
 | 
				
			||||||
    gain_factor: 64
 | 
					    gain_factor: 2
 | 
				
			||||||
  stop_after_detection: false
 | 
					  stop_after_detection: false
 | 
				
			||||||
  models:
 | 
					  models:
 | 
				
			||||||
    - model: github://joshuaboniface/Custom_V2_MicroWakeWords/models/computer/computer.json
 | 
					    - model: github://joshuaboniface/Custom_V2_MicroWakeWords/models/computer/computer.json
 | 
				
			||||||
@@ -473,7 +468,7 @@ micro_wake_word:
 | 
				
			|||||||
voice_assistant:
 | 
					voice_assistant:
 | 
				
			||||||
  id: va
 | 
					  id: va
 | 
				
			||||||
  microphone: mic
 | 
					  microphone: mic
 | 
				
			||||||
  speaker: dummy_speaker
 | 
					#  speaker: dummy_speaker
 | 
				
			||||||
  micro_wake_word: mww
 | 
					  micro_wake_word: mww
 | 
				
			||||||
  use_wake_word: false
 | 
					  use_wake_word: false
 | 
				
			||||||
  noise_suppression_level: 3
 | 
					  noise_suppression_level: 3
 | 
				
			||||||
@@ -518,6 +513,7 @@ voice_assistant:
 | 
				
			|||||||
              red: 1
 | 
					              red: 1
 | 
				
			||||||
              green: 0
 | 
					              green: 0
 | 
				
			||||||
              blue: 0
 | 
					              blue: 0
 | 
				
			||||||
 | 
					          - voice_assistant.stop:
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
          - logger.log: "Command successful!"
 | 
					          - logger.log: "Command successful!"
 | 
				
			||||||
          - light.turn_on:
 | 
					          - light.turn_on:
 | 
				
			||||||
@@ -527,6 +523,10 @@ voice_assistant:
 | 
				
			|||||||
              red: 0
 | 
					              red: 0
 | 
				
			||||||
              green: 1
 | 
					              green: 1
 | 
				
			||||||
              blue: 0
 | 
					              blue: 0
 | 
				
			||||||
 | 
					          - voice_assistant.stop:
 | 
				
			||||||
 | 
					  on_tts_end:
 | 
				
			||||||
 | 
					    - logger.log: "Finished STT result"
 | 
				
			||||||
 | 
					    - voice_assistant.stop:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
light:
 | 
					light:
 | 
				
			||||||
  - platform: rgb
 | 
					  - platform: rgb
 | 
				
			||||||
@@ -551,7 +551,13 @@ light:
 | 
				
			|||||||
      - automation:
 | 
					      - automation:
 | 
				
			||||||
          name: hold
 | 
					          name: hold
 | 
				
			||||||
          sequence:
 | 
					          sequence:
 | 
				
			||||||
 | 
					            - globals.set:
 | 
				
			||||||
 | 
					                id: light_is_holding
 | 
				
			||||||
 | 
					                value: "true"
 | 
				
			||||||
            - delay: 5s
 | 
					            - delay: 5s
 | 
				
			||||||
 | 
					            - globals.set:
 | 
				
			||||||
 | 
					                id: light_is_holding
 | 
				
			||||||
 | 
					                value: "false"
 | 
				
			||||||
            - script.execute: light_off
 | 
					            - script.execute: light_off
 | 
				
			||||||
 | 
					
 | 
				
			||||||
output:
 | 
					output:
 | 
				
			||||||
@@ -688,6 +694,20 @@ sensor:
 | 
				
			|||||||
      id: sht45_humidity
 | 
					      id: sht45_humidity
 | 
				
			||||||
      accuracy_decimals: 1
 | 
					      accuracy_decimals: 1
 | 
				
			||||||
      filters:
 | 
					      filters:
 | 
				
			||||||
 | 
					        - lambda: |-
 | 
				
			||||||
 | 
					            // Grab measured and corrected temperatures
 | 
				
			||||||
 | 
					            float t_meas = id(sht45_temperature).state - id(temperature_offset);
 | 
				
			||||||
 | 
					            float t_corr = id(sht45_temperature).state;
 | 
				
			||||||
 | 
					            float rh_meas = x;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Compute saturation vapor pressures (Magnus formula)
 | 
				
			||||||
 | 
					            auto es = [](float T) { return 6.112 * exp((17.62 * T) / (243.12 + T)); };
 | 
				
			||||||
 | 
					            float rh_corr = rh_meas * es(t_meas) / es(t_corr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Clamp to 0–100 %
 | 
				
			||||||
 | 
					            if (rh_corr < 0) rh_corr = 0;
 | 
				
			||||||
 | 
					            if (rh_corr > 100) rh_corr = 100;
 | 
				
			||||||
 | 
					            return rh_corr + id(humidity_offset);
 | 
				
			||||||
        - offset: !lambda return id(humidity_offset);
 | 
					        - offset: !lambda return id(humidity_offset);
 | 
				
			||||||
        - sliding_window_moving_average:
 | 
					        - sliding_window_moving_average:
 | 
				
			||||||
            window_size: 20
 | 
					            window_size: 20
 | 
				
			||||||
@@ -781,8 +801,8 @@ sensor:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  - platform: tsl2591
 | 
					  - platform: tsl2591
 | 
				
			||||||
    address: 0x29
 | 
					    address: 0x29
 | 
				
			||||||
    update_interval: 1s
 | 
					    update_interval: 2s
 | 
				
			||||||
    integration_time: 200ms
 | 
					    integration_time: 600ms
 | 
				
			||||||
    power_save_mode: no
 | 
					    power_save_mode: no
 | 
				
			||||||
    gain: auto
 | 
					    gain: auto
 | 
				
			||||||
    device_factor: 53
 | 
					    device_factor: 53
 | 
				
			||||||
@@ -831,7 +851,7 @@ binary_sensor:
 | 
				
			|||||||
    device_class: occupancy
 | 
					    device_class: occupancy
 | 
				
			||||||
    on_state:
 | 
					    on_state:
 | 
				
			||||||
      then:
 | 
					      then:
 | 
				
			||||||
        - script.execute: presence_light_on
 | 
					        - script.execute: light_off
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - platform: gpio
 | 
					  - platform: gpio
 | 
				
			||||||
    name: "PIR GPIO"
 | 
					    name: "PIR GPIO"
 | 
				
			||||||
@@ -992,7 +1012,7 @@ switch:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
number:
 | 
					number:
 | 
				
			||||||
  # Temperature offset:
 | 
					  # Temperature offset:
 | 
				
			||||||
  # A calibration from -30 to +5 for the temperature sensor
 | 
					  # A calibration from -30 to +10 for the temperature sensor
 | 
				
			||||||
  - platform: template
 | 
					  - platform: template
 | 
				
			||||||
    name: "Temperature Offset"
 | 
					    name: "Temperature Offset"
 | 
				
			||||||
    id: temperature_offset_setter
 | 
					    id: temperature_offset_setter
 | 
				
			||||||
@@ -1008,12 +1028,12 @@ number:
 | 
				
			|||||||
            value: !lambda 'return float(x);'
 | 
					            value: !lambda 'return float(x);'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Humidity offset:
 | 
					  # Humidity offset:
 | 
				
			||||||
  # A calibration from -20 to +20 for the humidity sensor
 | 
					  # A calibration from -50 to +50 for the humidity sensor
 | 
				
			||||||
  - platform: template
 | 
					  - platform: template
 | 
				
			||||||
    name: "Humidity Offset"
 | 
					    name: "Humidity Offset"
 | 
				
			||||||
    id: humidity_offset_setter
 | 
					    id: humidity_offset_setter
 | 
				
			||||||
    min_value: -20
 | 
					    min_value: -50
 | 
				
			||||||
    max_value: 20
 | 
					    max_value: 50
 | 
				
			||||||
    step: 0.1
 | 
					    step: 0.1
 | 
				
			||||||
    lambda: |-
 | 
					    lambda: |-
 | 
				
			||||||
      return id(humidity_offset);
 | 
					      return id(humidity_offset);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user