From 19d3fe202fcd1b623cd5b0515a9128a5d6ca5446 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Mon, 27 May 2024 13:24:43 +0200 Subject: [PATCH] Add sun support To be changed later getting data from the blueprint --- ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml index f6b3a5e..9363012 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml @@ -5,6 +5,18 @@ substitutions: version: 0.0.1 api: + id: api_server + services: + - service: set_float + variables: + component: string + val: float + then: + - lambda: |- + if (!isnan(val)) { + if (component == "latitude") sun_entity->set_latitude(val); + else if (component == "longitude") sun_entity->set_longitude(val); + } binary_sensor: - id: bs_vibrating @@ -205,6 +217,34 @@ select: disabled_by_default: false icon: mdi:dip-switch +sensor: + - id: sun_elevation + name: Sun Elevation + platform: sun + type: elevation + internal: true + + - id: zone_home_latitude + platform: homeassistant + entity_id: zone.home + attribute: latitude + internal: false + on_value: + - lambda: if (!isnan(x)) sun_entity->set_latitude(x); + + - id: zone_home_longitude + platform: homeassistant + entity_id: zone.home + attribute: longitude + internal: false + on_value: + - lambda: if (!isnan(x)) sun_entity->set_longitude(x); + +sun: + id: sun_entity + latitude: 90 + longitude: 180 + switch: - id: sw_speaker_aplifier name: Speaker - Aplifier @@ -277,6 +317,10 @@ text_sensor: lambda: |- return {"${version}"}; +time: + - id: time_source + platform: homeassistant + uart: id: if_uart_touch tx_pin: GPIO19