Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Integrations/ESPHome/Core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ globals:
restore_value: no
type: uint32_t
initial_value: '0'
- id: ltr390_last_update
restore_value: no
type: uint32_t
initial_value: '0'

i2c:
sda: GPIO1
Expand Down Expand Up @@ -147,6 +151,20 @@ number:
update_interval: never
step: 0.1
mode: box
- platform: template
name: LTR390 Update Interval
id: ltr390_update_interval
disabled_by_default: true
restore_value: true
initial_value: 60
min_value: 1
max_value: 300
entity_category: "CONFIG"
unit_of_measurement: "s"
optimistic: true
update_interval: never
step: 1
mode: box
# Setting start of zone 1 occupancy
- platform: template
name: "Radar Zone 1 Start"
Expand Down Expand Up @@ -525,6 +543,7 @@ sensor:

- platform: ltr390
id: ltr_390
update_interval: never
light:
name: "LTR390 Light"
id: ltr390light
Expand Down Expand Up @@ -704,3 +723,24 @@ interval:
- light.turn_off:
id: rgb_light
- lambda: 'id(cycleCounter) += 1;'

- interval: 1s
then:
- lambda: |-
uint32_t current_time = millis() / 1000; // Convert to seconds
uint32_t last_update = id(ltr390_last_update);
float configured_interval = id(ltr390_update_interval).state;
uint32_t interval = (configured_interval >= 1.0f) ? (uint32_t)configured_interval : 60u;

// Immediate update on boot (when last_update is still 0)
if (last_update == 0) {
id(ltr_390).update();
id(ltr390_last_update) = current_time;
return;
}

// Check if enough time has passed
if (current_time - last_update >= interval) {
id(ltr_390).update();
id(ltr390_last_update) = current_time;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.