diff --git a/tests/components/absolute_humidity/common.yaml b/tests/components/absolute_humidity/common.yaml index 87a99f5206..026f88654f 100644 --- a/tests/components/absolute_humidity/common.yaml +++ b/tests/components/absolute_humidity/common.yaml @@ -8,14 +8,12 @@ sensor: lambda: |- if (millis() > 10000) { return 0.6; - } else { - return 0.0; } + return 0.0; - platform: template id: template_temperature lambda: |- if (millis() > 10000) { return 42.0; - } else { - return 0.0; } + return 0.0; diff --git a/tests/components/analog_threshold/common.yaml b/tests/components/analog_threshold/common.yaml index 44d79756b5..26c401b92a 100644 --- a/tests/components/analog_threshold/common.yaml +++ b/tests/components/analog_threshold/common.yaml @@ -5,9 +5,8 @@ sensor: lambda: |- if (millis() > 10000) { return 42.0; - } else { - return 0.0; } + return 0.0; update_interval: 15s binary_sensor: diff --git a/tests/components/binary_sensor/common.yaml b/tests/components/binary_sensor/common.yaml index 2b4a006352..ed6322768f 100644 --- a/tests/components/binary_sensor/common.yaml +++ b/tests/components/binary_sensor/common.yaml @@ -23,9 +23,8 @@ binary_sensor: - lambda: |- if (id(some_binary_sensor).state) { return x; - } else { - return {}; } + return {}; - settle: 100ms - timeout: 10s diff --git a/tests/components/binary_sensor_map/common.yaml b/tests/components/binary_sensor_map/common.yaml index 2fed5ae515..c054022583 100644 --- a/tests/components/binary_sensor_map/common.yaml +++ b/tests/components/binary_sensor_map/common.yaml @@ -4,25 +4,22 @@ binary_sensor: lambda: |- if (millis() > 10000) { return true; - } else { - return false; } + return false; - platform: template id: bin2 lambda: |- if (millis() > 20000) { return true; - } else { - return false; } + return false; - platform: template id: bin3 lambda: |- if (millis() > 30000) { return true; - } else { - return false; } + return false; sensor: - platform: binary_sensor_map diff --git a/tests/components/combination/common.yaml b/tests/components/combination/common.yaml index 62246190af..0e5d512d08 100644 --- a/tests/components/combination/common.yaml +++ b/tests/components/combination/common.yaml @@ -4,17 +4,15 @@ sensor: lambda: |- if (millis() > 10000) { return 0.6; - } else { - return 0.0; } + return 0.0; - platform: template id: template_temperature2 lambda: |- if (millis() > 20000) { return 0.8; - } else { - return 0.0; } + return 0.0; - platform: combination type: kalman name: Kalman-filtered temperature diff --git a/tests/components/duty_time/common.yaml b/tests/components/duty_time/common.yaml index 28fa4afd1c..761d10f16a 100644 --- a/tests/components/duty_time/common.yaml +++ b/tests/components/duty_time/common.yaml @@ -4,9 +4,8 @@ binary_sensor: lambda: |- if (millis() > 10000) { return true; - } else { - return false; } + return false; sensor: - platform: duty_time diff --git a/tests/components/endstop/common.yaml b/tests/components/endstop/common.yaml index 341fbf7260..b92b1e13b9 100644 --- a/tests/components/endstop/common.yaml +++ b/tests/components/endstop/common.yaml @@ -4,9 +4,8 @@ binary_sensor: lambda: |- if (millis() > 10000) { return true; - } else { - return false; } + return false; switch: - platform: template diff --git a/tests/components/lock/common.yaml b/tests/components/lock/common.yaml index 1ee88a239a..9ba7f34857 100644 --- a/tests/components/lock/common.yaml +++ b/tests/components/lock/common.yaml @@ -17,9 +17,8 @@ lock: lambda: |- if (millis() > 10000) { return LOCK_STATE_LOCKED; - } else { - return LOCK_STATE_UNLOCKED; } + return LOCK_STATE_UNLOCKED; optimistic: true assumed_state: false on_unlock: diff --git a/tests/components/mqtt/common.yaml b/tests/components/mqtt/common.yaml index 1ab8872fdb..3f1b83bb01 100644 --- a/tests/components/mqtt/common.yaml +++ b/tests/components/mqtt/common.yaml @@ -72,10 +72,9 @@ binary_sensor: if (id(template_sens).state > 30) { // Garage Door is open. return true; - } else { - // Garage Door is closed. - return false; } + // Garage Door is closed. + return false; on_state: - mqtt.publish: topic: some/topic/binary_sensor @@ -217,9 +216,8 @@ cover: lambda: |- if (id(some_binary_sensor).state) { return COVER_OPEN; - } else { - return COVER_CLOSED; } + return COVER_CLOSED; open_action: - logger.log: open_action close_action: @@ -321,9 +319,8 @@ lock: lambda: |- if (id(some_binary_sensor).state) { return LOCK_STATE_LOCKED; - } else { - return LOCK_STATE_UNLOCKED; } + return LOCK_STATE_UNLOCKED; lock_action: - logger.log: lock_action unlock_action: @@ -360,9 +357,8 @@ sensor: lambda: |- if (id(some_binary_sensor).state) { return 42.0; - } else { - return 0.0; } + return 0.0; update_interval: 60s on_value: - mqtt.publish: @@ -390,9 +386,8 @@ switch: lambda: |- if (id(some_binary_sensor).state) { return true; - } else { - return false; } + return false; turn_on_action: - logger.log: turn_on_action turn_off_action: @@ -436,9 +431,8 @@ valve: lambda: |- if (id(some_binary_sensor).state) { return VALVE_OPEN; - } else { - return VALVE_CLOSED; } + return VALVE_CLOSED; alarm_control_panel: - platform: template diff --git a/tests/components/pid/common.yaml b/tests/components/pid/common.yaml index 5f7762872f..262e75591e 100644 --- a/tests/components/pid/common.yaml +++ b/tests/components/pid/common.yaml @@ -27,9 +27,8 @@ sensor: lambda: |- if (millis() > 10000) { return 42.0; - } else { - return 0.0; } + return 0.0; update_interval: 60s climate: diff --git a/tests/components/prometheus/common.yaml b/tests/components/prometheus/common.yaml index a9354ebe3c..cf46e882a7 100644 --- a/tests/components/prometheus/common.yaml +++ b/tests/components/prometheus/common.yaml @@ -35,9 +35,8 @@ sensor: lambda: |- if (millis() > 10000) { return 42.0; - } else { - return 0.0; } + return 0.0; update_interval: 60s text_sensor: @@ -49,9 +48,8 @@ text_sensor: lambda: |- if (millis() > 10000) { return {"Hello World"}; - } else { - return {"Goodbye (cruel) World"}; } + return {"Goodbye (cruel) World"}; update_interval: 60s binary_sensor: @@ -60,9 +58,8 @@ binary_sensor: lambda: |- if (millis() > 10000) { return true; - } else { - return false; } + return false; switch: - platform: template @@ -70,9 +67,8 @@ switch: lambda: |- if (millis() > 10000) { return true; - } else { - return false; } + return false; optimistic: true fan: @@ -85,9 +81,8 @@ cover: lambda: |- if (millis() > 10000) { return COVER_OPEN; - } else { - return COVER_CLOSED; } + return COVER_CLOSED; lock: - platform: template @@ -95,9 +90,8 @@ lock: lambda: |- if (millis() > 10000) { return LOCK_STATE_LOCKED; - } else { - return LOCK_STATE_UNLOCKED; } + return LOCK_STATE_UNLOCKED; optimistic: true select: diff --git a/tests/components/template/common-base.yaml b/tests/components/template/common-base.yaml index 48537d21bc..ea812532d4 100644 --- a/tests/components/template/common-base.yaml +++ b/tests/components/template/common-base.yaml @@ -59,9 +59,8 @@ binary_sensor: - lambda: |- if (id(other_binary_sensor).state) { return x; - } else { - return {}; } + return {}; - settle: 500ms - timeout: 5s @@ -72,9 +71,8 @@ sensor: lambda: |- if (id(some_binary_sensor).state) { return 42.0; - } else { - return 0.0; } + return 0.0; update_interval: 60s filters: - calibrate_linear: @@ -183,9 +181,8 @@ switch: lambda: |- if (id(some_binary_sensor).state) { return true; - } else { - return false; } + return false; turn_on_action: - logger.log: "turn_on_action" turn_off_action: @@ -203,9 +200,8 @@ cover: lambda: |- if (id(some_binary_sensor).state) { return COVER_OPEN; - } else { - return COVER_CLOSED; } + return COVER_CLOSED; open_action: - logger.log: open_action close_action: @@ -238,9 +234,8 @@ lock: lambda: |- if (id(some_binary_sensor).state) { return LOCK_STATE_LOCKED; - } else { - return LOCK_STATE_UNLOCKED; } + return LOCK_STATE_UNLOCKED; lock_action: - logger.log: lock_action unlock_action: @@ -255,9 +250,8 @@ valve: lambda: |- if (id(some_binary_sensor).state) { return VALVE_OPEN; - } else { - return VALVE_CLOSED; } + return VALVE_CLOSED; open_action: - logger.log: open_action close_action: diff --git a/tests/integration/fixtures/batch_delay_zero_rapid_transitions.yaml b/tests/integration/fixtures/batch_delay_zero_rapid_transitions.yaml index 32cacfaa79..f7b0fdcb63 100644 --- a/tests/integration/fixtures/batch_delay_zero_rapid_transitions.yaml +++ b/tests/integration/fixtures/batch_delay_zero_rapid_transitions.yaml @@ -34,10 +34,9 @@ binary_sensor: ESP_LOGD("test", "Button ON at %u", now); } return true; - } else { - // Only log state change - if (id(ir_remote_button).state) { - ESP_LOGD("test", "Button OFF at %u", now); - } - return false; } + // Only log state change + if (id(ir_remote_button).state) { + ESP_LOGD("test", "Button OFF at %u", now); + } + return false;