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

Externalize platform sensors #12

Merged
merged 2 commits into from
Mar 3, 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
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Optionally:
### Pico-Relay-B hardware modifications

The stock Pico-Relay-B lacks GPIO exposed via a terminal - those are needed to
connect rain sensor and water tank empty one, the crew terminal (4 pins) has
connect rain sensor and water tank empty one, the screw terminal (4 pins) has
been added (lower left corner).

Also, the hardware initially had no RTC, DS3231 has been added (top left
Expand All @@ -124,7 +124,23 @@ version (see
[Releases](https://github.com/hostcc/esphome-config-sprinkler/releases)) to
ensure your configuration is stable over the time.

A temperature sensor is a prerequisite to the configuration, its ID should be
passed via `temperature_sensor_id` substitution - it is only used by display
component currently.


```yaml
substitutions:
temperature_sensor_id: temperature_sensor

sensor:
- platform: internal_temperature
id: ${temperature_sensor_id}
name: "Internal Temperature"
icon: "mdi:thermometer"
entity_category: diagnostic
update_interval: 60s

packages:
sprinkler: github://hostcc/esphome-config-sprinkler/main.yaml@<release version>
```
Expand Down
2 changes: 1 addition & 1 deletion display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,5 @@ display:
it.print( 0, 36, material, TextAlign::CENTER_LEFT, "\U0000e1ff");
it.printf(
84, 36, primary, TextAlign::CENTER_RIGHT, "%.1f C",
id(temperature).state
id(${temperature_sensor_id}).state
);
1 change: 1 addition & 0 deletions main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ substitutions:
display_rotation: '0'
rtc_id: rtc_time
timezone: UTC
temperature_sensor_id: temperature

packages:
outputs: !include outputs.yaml
Expand Down
8 changes: 0 additions & 8 deletions status_sensors.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2023 Ilia Sotnikov
---
sensor:
- platform: internal_temperature
id: temperature
name: "Internal Temperature"
icon: "mdi:thermometer"
entity_category: diagnostic
update_interval: 60s

text_sensor:
- platform: template
id: lawn_sprinklers_state
Expand Down
11 changes: 11 additions & 0 deletions tests/rp2040w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Minimal configuration to validate via ESPHome
---
substitutions:
temperature_sensor_id: temperature_sensor

logger:
level: debug

Expand All @@ -18,6 +21,14 @@ api:
wifi:
ap:

sensor:
- platform: internal_temperature
id: ${temperature_sensor_id}
name: "Internal Temperature"
icon: "mdi:thermometer"
entity_category: diagnostic
update_interval: 60s

packages:
main: !include
file: ../main.yaml
Loading