diff --git a/packages/garage-door-esp32-base.yaml b/packages/garage-door-esp32-base.yaml index b02444f..0bb1d6c 100644 --- a/packages/garage-door-esp32-base.yaml +++ b/packages/garage-door-esp32-base.yaml @@ -12,7 +12,7 @@ substitutions: name: garage-door friendly_name: Garage Door Opener project_name: konnected.garage-door-esp32 - project_version: "0.4.1" + project_version: "0.4.2" garage_door_cover_name: Garage Door switch_name: Switch @@ -24,7 +24,7 @@ substitutions: #### # OPEN GARAGE DOOR DISTANCE MARGIN OF ERROR # The margin of error (+/-) in meters from the value above to consider the garage door in the open position. - open_garage_door_distance_margin_of_error: "0.1" + open_garage_door_distance_margin_of_error: "0.06" #### # GARAGE DOOR CLOSE WARNING DURATION diff --git a/packages/garage-door-esp8266-base.yaml b/packages/garage-door-esp8266-base.yaml index 96848f9..3671e1f 100644 --- a/packages/garage-door-esp8266-base.yaml +++ b/packages/garage-door-esp8266-base.yaml @@ -12,7 +12,7 @@ substitutions: name: garage-door friendly_name: Garage Door Opener project_name: konnected.garage-door-esp8266 - project_version: "0.4.1" + project_version: "0.4.2" garage_door_cover_name: Garage Door switch_name: Switch diff --git a/packages/vl53l0x-range-sensor.yaml b/packages/vl53l0x-range-sensor.yaml index e3d9309..29ddf97 100644 --- a/packages/vl53l0x-range-sensor.yaml +++ b/packages/vl53l0x-range-sensor.yaml @@ -1,3 +1,9 @@ +globals: + - id: gdo_err_margin + type: float + restore_value: true + initial_value: $open_garage_door_distance_margin_of_error + i2c: sda: $sda scl: $scl @@ -40,9 +46,9 @@ binary_sensor: internal: true lambda: |- float calibrated_distance = id(open_garage_door_distance_from_ceiling).state; - if (std::isnan(id(range_sensor).state) || id(range_sensor).state > calibrated_distance + $open_garage_door_distance_margin_of_error) { + if (std::isnan(id(range_sensor).state) || id(range_sensor).state > calibrated_distance + id(gdo_err_margin)) { return false; - } else if (id(range_sensor).state > calibrated_distance - $open_garage_door_distance_margin_of_error){ + } else if (id(range_sensor).state > calibrated_distance - id(gdo_err_margin)){ return true; } else { return {};