Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow RGB LED to be optional #18

Merged
merged 6 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 20 additions & 4 deletions controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ sprinkler:
}
${display_backlight_id}->turn_on();
#endif
- light.turn_on: ${led_id}
- lambda: |-
#ifdef HAS_RGB_LED
auto call = ${led_id}->turn_on();
call.perform();
#endif
on_turn_off:
- !include
file: script_refill_tank.yaml
Expand All @@ -30,7 +34,11 @@ sprinkler:
condition: >-
!id(disable_water_tank_refill).state
&& !id(water_tank_refill_after_each_valve).state
- light.turn_off: ${led_id}
- lambda: |-
#ifdef HAS_RGB_LED
auto call = ${led_id}->turn_off();
call.perform();
#endif
- lambda: |-
#ifdef HAS_DISPLAY
${display_backlight_id}->turn_off();
Expand Down Expand Up @@ -118,7 +126,11 @@ sprinkler:
}
${display_backlight_id}->turn_on();
#endif
- light.turn_on: ${led_id}
- lambda: |-
#ifdef HAS_RGB_LED
auto call = ${led_id}->turn_on();
call.perform();
#endif
on_turn_off:
- !include
file: script_refill_tank.yaml
Expand All @@ -128,7 +140,11 @@ sprinkler:
condition: >-
!id(disable_water_tank_refill).state
&& !id(water_tank_refill_after_each_valve).state
- light.turn_off: ${led_id}
- lambda: |-
#ifdef HAS_RGB_LED
auto call = ${led_id}->turn_off();
call.perform();
#endif
- lambda: |-
#ifdef HAS_DISPLAY
${display_backlight_id}->turn_off();
Expand Down
5 changes: 5 additions & 0 deletions indicators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
esphome:
# Required for 'rp2040_pio_led_strip' component
min_version: '2023.6.2'
platformio_options:
build_flags:
# Define the preprocessor macro indicating presence of RGB led so that
# dependent code could be conditional
- '-DHAS_RGB_LED'

light:
- platform: rp2040_pio_led_strip
Expand Down
2 changes: 1 addition & 1 deletion main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ packages:
inputs: !include inputs.yaml
schedule: !include schedule.yaml # Optional
display: !include display.yaml # Optional
indicators: !include indicators.yaml
indicators: !include indicators.yaml # Optional
controllers: !include controllers.yaml
status_sensors: !include status_sensors.yaml
time: !include time.yaml # Optional
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
esphome==2024.3.0
esphome==2024.9.1
pillow==10.2.0
8 changes: 6 additions & 2 deletions script_rain_water_tank_sensors_action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
// Explicitly shutdown any running operation in case of rain, also turn on
// LED indicating the condition
#ifdef TRIGGERED_BY_${rain_sensor_id}
auto call = id(${led_id}).turn_on();
#ifdef HAS_RGB_LED
auto call = ${led_id}->turn_on();
call.perform();
#endif
id(flowerbed_sprinklers).shutdown();
id(lawn_sprinklers).shutdown();
#endif
Expand Down Expand Up @@ -74,9 +76,11 @@

// Turn off LED indicating that rain is detected
#ifdef TRIGGERED_BY_${rain_sensor_id}
auto call = id(${led_id}).turn_off();
#ifdef HAS_RGB_LED
auto call = ${led_id}->turn_off();
call.perform();
#endif
#endif

// Resume any operation if any once water tank is full
// NOTE: should be called after moving controller out of standby otherwise
Expand Down
5 changes: 4 additions & 1 deletion tests/rp2040w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ esphome:
rp2040:
board: rpipicow
framework:
platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git
# Pinned to specific version to prevent compilation failure,
# see https://github.com/esphome/esphome/pull/7514
platform_version: >-
https://github.com/maxgerhardt/platform-raspberrypi.git#v1.2.0-gcc12

api:
wifi:
Expand Down
Loading