Compare commits
	
		
			5 Commits
		
	
	
		
			b9e92cd46e
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| cd68cd6811 | |||
| 2c6d185bfc | |||
| 861d1e1c4d | |||
| d75325198f | |||
| a259542870 | 
@@ -164,39 +164,34 @@ globals:
 | 
			
		||||
    restore_value: yes
 | 
			
		||||
    initial_value: '"mww_computer"'
 | 
			
		||||
 | 
			
		||||
  - id: light_is_holding
 | 
			
		||||
    type: bool
 | 
			
		||||
    restore_value: no
 | 
			
		||||
    initial_value: 'false'
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
    then:
 | 
			
		||||
      if:
 | 
			
		||||
        condition:
 | 
			
		||||
          - binary_sensor.is_on: supersensor_occupancy
 | 
			
		||||
          - switch.is_on: enable_presence_led
 | 
			
		||||
        then:
 | 
			
		||||
          - light.turn_on:
 | 
			
		||||
              id: output_led
 | 
			
		||||
              brightness: 25%
 | 
			
		||||
              red: 1
 | 
			
		||||
              green: 1
 | 
			
		||||
              blue: 1
 | 
			
		||||
              transition_length: 1s
 | 
			
		||||
        else:
 | 
			
		||||
          - light.turn_off:
 | 
			
		||||
              id: output_led
 | 
			
		||||
              transition_length: 1s
 | 
			
		||||
      - if:
 | 
			
		||||
          condition:
 | 
			
		||||
            lambda: 'return !id(light_is_holding);'
 | 
			
		||||
          then:
 | 
			
		||||
            - if:
 | 
			
		||||
                condition:
 | 
			
		||||
                  - binary_sensor.is_on: supersensor_occupancy
 | 
			
		||||
                  - switch.is_on: enable_presence_led
 | 
			
		||||
                then:
 | 
			
		||||
                  - light.turn_on:
 | 
			
		||||
                      id: output_led
 | 
			
		||||
                      brightness: 25%
 | 
			
		||||
                      red: 1
 | 
			
		||||
                      green: 1
 | 
			
		||||
                      blue: 1
 | 
			
		||||
                      transition_length: 1s
 | 
			
		||||
                else:
 | 
			
		||||
                  - light.turn_off:
 | 
			
		||||
                      id: output_led
 | 
			
		||||
                      transition_length: 1s
 | 
			
		||||
 | 
			
		||||
  - id: pir_handler
 | 
			
		||||
    then:
 | 
			
		||||
@@ -446,7 +441,7 @@ micro_wake_word:
 | 
			
		||||
  id: mww
 | 
			
		||||
  microphone:
 | 
			
		||||
    microphone: mic
 | 
			
		||||
    gain_factor: 64
 | 
			
		||||
    gain_factor: 2
 | 
			
		||||
  stop_after_detection: false
 | 
			
		||||
  models:
 | 
			
		||||
    - model: github://joshuaboniface/Custom_V2_MicroWakeWords/models/computer/computer.json
 | 
			
		||||
@@ -556,7 +551,13 @@ light:
 | 
			
		||||
      - automation:
 | 
			
		||||
          name: hold
 | 
			
		||||
          sequence:
 | 
			
		||||
            - globals.set:
 | 
			
		||||
                id: light_is_holding
 | 
			
		||||
                value: "true"
 | 
			
		||||
            - delay: 5s
 | 
			
		||||
            - globals.set:
 | 
			
		||||
                id: light_is_holding
 | 
			
		||||
                value: "false"
 | 
			
		||||
            - script.execute: light_off
 | 
			
		||||
 | 
			
		||||
output:
 | 
			
		||||
@@ -693,6 +694,20 @@ sensor:
 | 
			
		||||
      id: sht45_humidity
 | 
			
		||||
      accuracy_decimals: 1
 | 
			
		||||
      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);
 | 
			
		||||
        - sliding_window_moving_average:
 | 
			
		||||
            window_size: 20
 | 
			
		||||
@@ -786,8 +801,8 @@ sensor:
 | 
			
		||||
 | 
			
		||||
  - platform: tsl2591
 | 
			
		||||
    address: 0x29
 | 
			
		||||
    update_interval: 1s
 | 
			
		||||
    integration_time: 200ms
 | 
			
		||||
    update_interval: 2s
 | 
			
		||||
    integration_time: 600ms
 | 
			
		||||
    power_save_mode: no
 | 
			
		||||
    gain: auto
 | 
			
		||||
    device_factor: 53
 | 
			
		||||
@@ -836,7 +851,7 @@ binary_sensor:
 | 
			
		||||
    device_class: occupancy
 | 
			
		||||
    on_state:
 | 
			
		||||
      then:
 | 
			
		||||
        - script.execute: presence_light_on
 | 
			
		||||
        - script.execute: light_off
 | 
			
		||||
 | 
			
		||||
  - platform: gpio
 | 
			
		||||
    name: "PIR GPIO"
 | 
			
		||||
@@ -997,7 +1012,7 @@ switch:
 | 
			
		||||
 | 
			
		||||
number:
 | 
			
		||||
  # Temperature offset:
 | 
			
		||||
  # A calibration from -30 to +5 for the temperature sensor
 | 
			
		||||
  # A calibration from -30 to +10 for the temperature sensor
 | 
			
		||||
  - platform: template
 | 
			
		||||
    name: "Temperature Offset"
 | 
			
		||||
    id: temperature_offset_setter
 | 
			
		||||
@@ -1013,12 +1028,12 @@ number:
 | 
			
		||||
            value: !lambda 'return float(x);'
 | 
			
		||||
 | 
			
		||||
  # Humidity offset:
 | 
			
		||||
  # A calibration from -20 to +20 for the humidity sensor
 | 
			
		||||
  # A calibration from -50 to +50 for the humidity sensor
 | 
			
		||||
  - platform: template
 | 
			
		||||
    name: "Humidity Offset"
 | 
			
		||||
    id: humidity_offset_setter
 | 
			
		||||
    min_value: -20
 | 
			
		||||
    max_value: 20
 | 
			
		||||
    min_value: -50
 | 
			
		||||
    max_value: 50
 | 
			
		||||
    step: 0.1
 | 
			
		||||
    lambda: |-
 | 
			
		||||
      return id(humidity_offset);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user