diff --git a/README.md b/README.md index a0e59bf0..ea99e959 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://github.com/aneisch/home-assistant-config/actions/workflows/check-ha-release-compatibility.yml/badge.svg)](https://github.com/aneisch/home-assistant-config/actions) [![GitHub last commit](https://img.shields.io/github/last-commit/aneisch/home-assistant-config)](https://github.com/aneisch/home-assistant-config/commits/master) [![GitHub commit activity](https://img.shields.io/github/commit-activity/y/aneisch/home-assistant-config)](https://github.com/aneisch/home-assistant-config/graphs/commit-activity) -[![HA Version](https://img.shields.io/badge/Running%20Home%20Assistant-2023.3.6%20(Latest)-brightgreen)](https://github.com/home-assistant/home-assistant/releases/latest) +[![HA Version](https://img.shields.io/badge/Running%20Home%20Assistant%20-2023.4.0b6%20(Out%20of%20Date)-Red)](https://github.com/home-assistant/home-assistant/releases/latest)
Buy Me A Coffee @@ -18,7 +18,6 @@ My Home Assistant installation contains many different components and runs on a - Milights with [Homebrew MiLight controller](http://blog.christophermullins.com/2017/02/11/milight-wifi-gateway-emulator-on-an-esp8266/) using D1 Mini and NRF24L01. - Wemo wall plugs - ZHA using [CC2531](https://amzn.to/2L5xKNB) running zigbee2mqtt firmware with various devices -_ZIGBEEDEVICES_ - [Lustreon E27](https://www.banggood.com/LUSTREON-E27-Smart-WiFi-Bulb-Adapter-Socket-Lamp-Holder-Work-With-Alexa-Google-Home-IFTTT-AC85-265V-p-1285550.html) bulb holders for lamp control using ~~Tasmota/MQTT~~ ESPHome (1MB flash) - Check out [my blog post](http://blog.aneis.ch/2019/01/tuya-convert-for-lustreon.html) for alternative firmware flashing instructions - Z-Wave JS using [Aeon Labs USB stick](https://amzn.to/39cmb1b) with various devices @@ -65,43 +64,43 @@ Z-Wave devices in [`zwave_js`](https://www.home-assistant.io/integrations/zwave_ Description | value -- | -- -Entities in the [`alarm_control_panel`](https://www.home-assistant.io/components/alarm_control_panel) domain | 3 -Entities in the [`automation`](https://www.home-assistant.io/components/automation) domain | 86 -Entities in the [`binary_sensor`](https://www.home-assistant.io/components/binary_sensor) domain | 87 -Entities in the [`button`](https://www.home-assistant.io/components/button) domain | 64 -Entities in the [`calendar`](https://www.home-assistant.io/components/calendar) domain | 1 -Entities in the [`camera`](https://www.home-assistant.io/components/camera) domain | 15 -Entities in the [`climate`](https://www.home-assistant.io/components/climate) domain | 1 -Entities in the [`counter`](https://www.home-assistant.io/components/counter) domain | 1 -Entities in the [`cover`](https://www.home-assistant.io/components/cover) domain | 5 -Entities in the [`device_tracker`](https://www.home-assistant.io/components/device_tracker) domain | 4 -Entities in the [`fan`](https://www.home-assistant.io/components/fan) domain | 3 +Entities in the [`person`](https://www.home-assistant.io/components/person) domain | 2 +Entities in the [`setter`](https://www.home-assistant.io/components/setter) domain | 1 +Entities in the [`plant`](https://www.home-assistant.io/components/plant) domain | 1 Entities in the [`group`](https://www.home-assistant.io/components/group) domain | 13 -Entities in the [`input_boolean`](https://www.home-assistant.io/components/input_boolean) domain | 24 -Entities in the [`input_datetime`](https://www.home-assistant.io/components/input_datetime) domain | 31 +Entities in the [`zone`](https://www.home-assistant.io/components/zone) domain | 6 +Entities in the [`timer`](https://www.home-assistant.io/components/timer) domain | 1 +Entities in the [`counter`](https://www.home-assistant.io/components/counter) domain | 1 +Entities in the [`sun`](https://www.home-assistant.io/components/sun) domain | 1 Entities in the [`input_number`](https://www.home-assistant.io/components/input_number) domain | 4 -Entities in the [`input_select`](https://www.home-assistant.io/components/input_select) domain | 19 Entities in the [`input_text`](https://www.home-assistant.io/components/input_text) domain | 4 +Entities in the [`input_select`](https://www.home-assistant.io/components/input_select) domain | 19 +Entities in the [`input_boolean`](https://www.home-assistant.io/components/input_boolean) domain | 24 +Entities in the [`input_datetime`](https://www.home-assistant.io/components/input_datetime) domain | 31 +Entities in the [`sensor`](https://www.home-assistant.io/components/sensor) domain | 338 +Entities in the [`scene`](https://www.home-assistant.io/components/scene) domain | 2 Entities in the [`light`](https://www.home-assistant.io/components/light) domain | 38 -Entities in the [`lock`](https://www.home-assistant.io/components/lock) domain | 2 +Entities in the [`automation`](https://www.home-assistant.io/components/automation) domain | 86 +Entities in the [`alarm_control_panel`](https://www.home-assistant.io/components/alarm_control_panel) domain | 3 +Entities in the [`script`](https://www.home-assistant.io/components/script) domain | 37 +Entities in the [`weather`](https://www.home-assistant.io/components/weather) domain | 2 Entities in the [`media_player`](https://www.home-assistant.io/components/media_player) domain | 12 +Entities in the [`vacuum`](https://www.home-assistant.io/components/vacuum) domain | 1 +Entities in the [`switch`](https://www.home-assistant.io/components/switch) domain | 149 +Entities in the [`camera`](https://www.home-assistant.io/components/camera) domain | 15 +Entities in the [`binary_sensor`](https://www.home-assistant.io/components/binary_sensor) domain | 84 +Entities in the [`button`](https://www.home-assistant.io/components/button) domain | 64 +Entities in the [`cover`](https://www.home-assistant.io/components/cover) domain | 5 +Entities in the [`lock`](https://www.home-assistant.io/components/lock) domain | 2 Entities in the [`number`](https://www.home-assistant.io/components/number) domain | 55 -Entities in the [`person`](https://www.home-assistant.io/components/person) domain | 2 -Entities in the [`plant`](https://www.home-assistant.io/components/plant) domain | 1 -Entities in the [`scene`](https://www.home-assistant.io/components/scene) domain | 2 -Entities in the [`script`](https://www.home-assistant.io/components/script) domain | 37 Entities in the [`select`](https://www.home-assistant.io/components/select) domain | 20 -Entities in the [`sensor`](https://www.home-assistant.io/components/sensor) domain | 335 -Entities in the [`setter`](https://www.home-assistant.io/components/setter) domain | 1 +Entities in the [`fan`](https://www.home-assistant.io/components/fan) domain | 3 +Entities in the [`device_tracker`](https://www.home-assistant.io/components/device_tracker) domain | 4 Entities in the [`siren`](https://www.home-assistant.io/components/siren) domain | 1 -Entities in the [`sun`](https://www.home-assistant.io/components/sun) domain | 1 -Entities in the [`switch`](https://www.home-assistant.io/components/switch) domain | 152 -Entities in the [`timer`](https://www.home-assistant.io/components/timer) domain | 1 +Entities in the [`calendar`](https://www.home-assistant.io/components/calendar) domain | 1 +Entities in the [`climate`](https://www.home-assistant.io/components/climate) domain | 1 Entities in the [`update`](https://www.home-assistant.io/components/update) domain | 25 -Entities in the [`vacuum`](https://www.home-assistant.io/components/vacuum) domain | 1 -Entities in the [`weather`](https://www.home-assistant.io/components/weather) domain | 2 -Entities in the [`zone`](https://www.home-assistant.io/components/zone) domain | 6 -**Total state objects** | **1059** +**Total state objects** | **1056** ## The HACS integrations/plugins that I use: **Appdaemon**:
[aneisch/follow_me_appdaemon](https://github.com/aneisch/follow_me_appdaemon)
diff --git a/configuration.yaml b/configuration.yaml index 22b19831..e0f1b43f 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -461,13 +461,13 @@ recorder: rest_command: !include rest_command.yaml -samsungtv: - - host: 10.0.1.51 - name: Living Room TV - turn_on_action: - - service: wake_on_lan.send_magic_packet - data: - mac: 44:5c:e9:2e:51:0a +# samsungtv: +# - host: 10.0.1.51 +# name: Living Room TV +# turn_on_action: +# - service: wake_on_lan.send_magic_packet +# data: +# mac: 44:5c:e9:2e:51:0a scene: !include scene.yaml diff --git a/custom_components/sonoff/climate.py b/custom_components/sonoff/climate.py index ccb0e742..fa8dbeb6 100644 --- a/custom_components/sonoff/climate.py +++ b/custom_components/sonoff/climate.py @@ -150,6 +150,7 @@ class XClimateNS(XEntity, ClimateEntity): _attr_hvac_modes = [HVAC_MODE_OFF, HVAC_MODE_HEAT_COOL, HVAC_MODE_AUTO] _attr_max_temp = 31 _attr_min_temp = 16 + _attr_supported_features = SUPPORT_TARGET_TEMPERATURE _attr_temperature_unit = TEMP_CELSIUS _attr_target_temperature_step = 1 @@ -159,23 +160,19 @@ def set_state(self, params: dict): cache.update(params) if "HMI_ATCDevice" in params and "etype" in params["HMI_ATCDevice"]: - self._attr_hvac_modes[1] = ( - HVAC_MODE_COOL - if cache["HMI_ATCDevice"]["etype"] == "cold" - else HVAC_MODE_HEAT - ) + if cache["HMI_ATCDevice"]["etype"] == "cold": + self._attr_hvac_modes[1] = HVAC_MODE_COOL + else: + self._attr_hvac_modes[1] = HVAC_MODE_HEAT if "ATCEnable" in params or "ATCMode" in params: if cache["ATCEnable"]: if cache["ATCMode"]: - self._attr_hvac_mode = HVAC_MODE_AUTO - self._attr_supported_features = 0 + self.set_hvac_attr(HVAC_MODE_AUTO) else: - self._attr_hvac_mode = self.hvac_modes[1] - self._attr_supported_features = SUPPORT_TARGET_TEMPERATURE + self.set_hvac_attr(self._attr_hvac_modes[1]) else: - self._attr_hvac_mode = HVAC_MODE_OFF - self._attr_supported_features = SUPPORT_TARGET_TEMPERATURE + self.set_hvac_attr(HVAC_MODE_OFF) if "ATCExpect0" in params: self._attr_target_temperature = cache["ATCExpect0"] @@ -190,11 +187,22 @@ def set_state(self, params: dict): except: pass + def set_hvac_attr(self, hvac_mode: str) -> None: + if hvac_mode == HVAC_MODE_AUTO: + self._attr_hvac_mode = hvac_mode + self._attr_supported_features = 0 + elif hvac_mode == HVAC_MODE_OFF: + self._attr_hvac_mode = hvac_mode + self._attr_supported_features = SUPPORT_TARGET_TEMPERATURE + elif hvac_mode in (HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_HEAT_COOL): + self._attr_hvac_mode = self._attr_hvac_modes[1] + self._attr_supported_features = SUPPORT_TARGET_TEMPERATURE + @staticmethod def get_params(hvac_mode: str) -> dict: if hvac_mode == HVAC_MODE_AUTO: return {"ATCEnable": 1, "ATCMode": 1} - elif hvac_mode in (HVAC_MODE_HEAT_COOL, HVAC_MODE_HEAT): + elif hvac_mode in (HVAC_MODE_COOL, HVAC_MODE_HEAT): return {"ATCEnable": 1, "ATCMode": 0} elif hvac_mode == HVAC_MODE_HEAT_COOL: return {"ATCEnable": 1} # async_turn_on @@ -210,11 +218,13 @@ async def async_set_hvac_mode(self, hvac_mode: str) -> None: async def async_set_temperature( self, temperature: float = None, hvac_mode: str = None, **kwargs ) -> None: - params = self.get_params(hvac_mode) if temperature is not None: - params["ATCExpect0"] = temperature - if not params: - params["ATCEnable"] = 1 + # https://github.com/AlexxIT/SonoffLAN/issues/1107 + params = {"ATCMode": 0, "ATCExpect0": temperature} + elif hvac_mode is not None: + params = self.get_params(hvac_mode) + else: + params = {"ATCEnable": 1} await self.ewelink.cloud.send(self.device, params) diff --git a/custom_components/sonoff/core/devices.py b/custom_components/sonoff/core/devices.py index b497d186..924ccbbc 100644 --- a/custom_components/sonoff/core/devices.py +++ b/custom_components/sonoff/core/devices.py @@ -49,8 +49,16 @@ XUnknown, XWiFiDoorBattery, XEnergySensorDualR3, + XEnergySensorPOWR3, +) +from ..switch import ( + XSwitch, + XSwitches, + XSwitchTH, + XToggle, + XZigbeeSwitches, + XSwitchPOWR3, ) -from ..switch import XSwitch, XSwitches, XSwitchTH, XToggle, XZigbeeSwitches # supported custom device_class DEVICE_CLASS = { @@ -109,29 +117,12 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: Power2 = spec(XSensor100, param="actPow_01", uid="power_2") Power3 = spec(XSensor100, param="actPow_02", uid="power_3") Power4 = spec(XSensor100, param="actPow_03", uid="power_4") -Energy1 = spec( - XEnergySensor, param="kwhHistories_00", uid="energy_1", get_params={"getKwh_00": 2} -) -Energy2 = spec( - XEnergySensor, param="kwhHistories_01", uid="energy_2", get_params={"getKwh_01": 2} -) -Energy3 = spec( - XEnergySensor, param="kwhHistories_01", uid="energy_3", get_params={"getKwh_02": 2} -) -Energy4 = spec( - XEnergySensor, param="kwhHistories_01", uid="energy_4", get_params={"getKwh_03": 2} -) -Energy1_DualR3 = spec( - XEnergySensorDualR3, - param="kwhHistories_00", - uid="energy_1", - get_params={"getKwh_00": 2}, -) -Energy2_DualR3 = spec( - XEnergySensorDualR3, - param="kwhHistories_01", - uid="energy_2", - get_params={"getKwh_01": 2}, + +EnergyPOW = spec( + XEnergySensor, + param="hundredDaysKwhData", + uid="energy", + get_params={"hundredDaysKwh": "get"}, ) # https://github.com/CoolKit-Technologies/eWeLink-API/blob/main/en/UIIDProtocol.md @@ -145,12 +136,7 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: LED, RSSI, spec(XSensor, param="power"), - spec( - XEnergySensor, - param="hundredDaysKwhData", - uid="energy", - get_params={"hundredDaysKwh": "get"}, - ), + EnergyPOW, ], # Sonoff POW (first) 6: SPEC_SWITCH, 7: SPEC_2CH, # Sonoff T1 2CH @@ -192,12 +178,7 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: spec(XSensor, param="current"), spec(XSensor, param="power"), spec(XSensor, param="voltage"), - spec( - XEnergySensor, - param="hundredDaysKwhData", - uid="energy", - get_params={"hundredDaysKwh": "get"}, - ), + EnergyPOW, ], # Sonoff POWR2 33: [XLightL1, RSSI], # https://github.com/AlexxIT/SonoffLAN/issues/985 34: [ @@ -231,8 +212,18 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: Voltage2, Power1, Power2, - Energy1_DualR3, - Energy2_DualR3, + spec( + XEnergySensorDualR3, + param="kwhHistories_00", + uid="energy_1", + get_params={"getKwh_00": 2}, + ), + spec( + XEnergySensorDualR3, + param="kwhHistories_01", + uid="energy_2", + get_params={"getKwh_01": 2}, + ), ], # Sonoff DualR3 127: [XThermostat], # https://github.com/AlexxIT/SonoffLAN/issues/358 128: [LED], # SPM-Main @@ -253,10 +244,30 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: Power2, Power3, Power4, - Energy1, - Energy2, - Energy3, - Energy4, + spec( + XEnergySensorDualR3, + param="kwhHistories_00", + uid="energy_1", + get_params={"getKwh_00": 2}, + ), + spec( + XEnergySensorDualR3, + param="kwhHistories_01", + uid="energy_2", + get_params={"getKwh_01": 2}, + ), + spec( + XEnergySensorDualR3, + param="kwhHistories_01", + uid="energy_3", + get_params={"getKwh_02": 2}, + ), + spec( + XEnergySensorDualR3, + param="kwhHistories_01", + uid="energy_4", + get_params={"getKwh_03": 2}, + ), ], # SPM-4Relay, https://github.com/AlexxIT/SonoffLAN/issues/658 133: [ # Humidity. ALWAYS 50... NSPanel DOESN'T HAVE HUMIDITY SENSOR @@ -270,7 +281,10 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: # https://github.com/AlexxIT/SonoffLAN/issues/1026 135: [XLightB02, RSSI], # Sonoff B02-BL # https://github.com/AlexxIT/SonoffLAN/issues/766 - 136: [XLightB05B, RSSI], # Sonoff B05-BL + # https://github.com/AlexxIT/SonoffLAN/issues/890 + # https://github.com/AlexxIT/SonoffLAN/pull/892 + # https://github.com/AlexxIT/SonoffLAN/pull/1035 + 136: [spec(XLightB05B, min_ct=0, max_ct=100), RSSI], # Sonoff B05-BL 137: [XLightL1, RSSI], # https://github.com/AlexxIT/SonoffLAN/issues/623#issuecomment-1365841454 138: SPEC_1CH, # MINIR3 @@ -285,7 +299,6 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: 177: [XRemoteButton], # Sonoff S-Mate 181: [ XSwitchTH, - XClimateTH, XTemperatureTH, XHumidityTH, LED, @@ -298,19 +311,22 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: spec(XSensor, param="current"), spec(XSensor, param="power"), spec(XSensor, param="voltage"), + EnergyPOW, ], # Sonoff S40 190: [ - Switch1, + XSwitchPOWR3, LED, RSSI, spec(XSensor100, param="current"), spec(XSensor100, param="power"), spec(XSensor100, param="voltage"), + spec(XSensor100, param="dayKwh", uid="energy_day"), + spec(XSensor100, param="monthKwh", uid="energy_month"), spec( - XEnergySensor, - param="hundredDaysKwhData", + XEnergySensorPOWR3, + param="hoursKwhData", uid="energy", - get_params={"hundredDaysKwh": "get"}, + get_params={"getHoursKwh": {"start": 0, "end": 24 * 30 - 1}}, ), ], # Sonoff POWR3 1000: [XRemoteButton, Battery], # zigbee_ON_OFF_SWITCH_1000 @@ -323,6 +339,11 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: spec(XSensor100, param="humidity"), Battery, ], # ZCL_HA_DEVICEID_TEMPERATURE_SENSOR + 1771: [ + spec(XSensor100, param="temperature"), + spec(XSensor100, param="humidity"), + Battery, + ], # https://github.com/AlexxIT/SonoffLAN/issues/1150 2026: [XZigbeeMotion, Battery], # ZIGBEE_MOBILE_SENSOR # ZIGBEE_DOOR_AND_WINDOW_SENSOR 3026: [ @@ -440,7 +461,7 @@ def set_default_class(device_class: str): # DIY type, UIID, Brand, Model/Name "plug": [1, None, "Single Channel DIY"], # POWR316 "strip": [4, None, "Multi Channel DIY"], # 4CHPROR3 - "diy_plug": [1, "SONOFF", "MINI DIY"], + "diy_plug": [138, "SONOFF", "MINI DIY"], "enhanced_plug": [5, "SONOFF", "POW DIY"], # POWR2 "th_plug": [15, "SONOFF", "TH DIY"], # TH16R2 "rf": [28, "SONOFF", "RFBridge DIY"], diff --git a/custom_components/sonoff/core/ewelink/__init__.py b/custom_components/sonoff/core/ewelink/__init__.py index 171d1ad4..1ede4a60 100644 --- a/custom_components/sonoff/core/ewelink/__init__.py +++ b/custom_components/sonoff/core/ewelink/__init__.py @@ -84,6 +84,7 @@ async def send( params_lan: dict = None, cmd_lan: str = None, query_cloud: bool = True, + timeout_lan: int = 1, ): """Send command to device with LAN and Cloud. Usual params are same. @@ -95,6 +96,7 @@ async def send( :param cmd_lan: optional if LAN command different :param query_cloud: optional query Cloud state after update state, ignored if params empty + :param timeout_lan: optional custom LAN timeout """ seq = self.sequence() @@ -112,7 +114,7 @@ async def send( if can_local and can_cloud: # try to send a command locally (wait no more than a second) ok = await self.local.send( - main_device, params_lan or params, cmd_lan, seq, 1 + main_device, params_lan or params, cmd_lan, seq, timeout_lan ) # otherwise send a command through the cloud @@ -126,7 +128,7 @@ async def send( elif can_local: ok = await self.local.send( - main_device, params_lan or params, cmd_lan, seq, 5 + main_device, params_lan or params, cmd_lan, seq ) if ok != "online": asyncio.create_task(self.check_offline(main_device)) @@ -222,8 +224,8 @@ def cloud_update(self, msg: dict): self.dispatcher_send(did, params) def local_update(self, msg: dict): - did: str = msg["deviceid"] - device: XDevice = self.devices.get(did) + mainid: str = msg["deviceid"] + device: XDevice = self.devices.get(mainid) params: dict = msg.get("params") # check device in known devices list if not device: @@ -232,12 +234,12 @@ def local_update(self, msg: dict): try: # try to decrypt payload if we have right key in config msg["params"] = params = self.local.decrypt_msg( - msg, self.config["devices"][did]["devicekey"] + msg, self.config["devices"][mainid]["devicekey"] ) except Exception: - _LOGGER.debug(f"{did} !! skip setup for encrypted device") + _LOGGER.debug(f"{mainid} !! skip setup for encrypted device") # save device to known list, so no more decrypt tries - self.devices[did] = msg + self.devices[mainid] = msg return from ..devices import setup_diy @@ -263,11 +265,12 @@ def local_update(self, msg: dict): # DIY device is still connected to the ewelink account device.pop("devicekey") - did = msg.get("subdevid", did) + # realid can be different from mainid for SPM-4RELAY + realid = msg.get("subdevid", mainid) tag = "Local3" if "host" in msg else "Local0" _LOGGER.debug( - f"{did} <= {tag} | {msg.get('host', '')} | %s | {msg.get('seq', '')}", + f"{realid} <= {tag} | {msg.get('host', '')} | %s | {msg.get('seq', '')}", params, ) @@ -283,12 +286,11 @@ def local_update(self, msg: dict): device["local_ts"] = time.time() + LOCAL_TTL device["local"] = True - if did == msg["deviceid"]: - self.dispatcher_send(did, params) - else: - # SPM-MAIN/SPM-4RELAY - self.dispatcher_send(msg["subdevid"], params) - self.dispatcher_send(did, None) + self.dispatcher_send(realid, params) + + # send empty msg to main device for updating available flag + if realid != mainid: + self.dispatcher_send(mainid, None) async def run_forever(self): """This daemon function doing two things: @@ -312,8 +314,9 @@ def update_device(self, device: XDevice): uiid = device["extra"]["uiid"] - # POW, POWR2, S40, POWR3 - one channel, only cloud update - if uiid in (5, 32, 182, 190): + # [5] POW, [32] POWR2, [182] S40, [190] POWR3 - one channel, only cloud update + # [181] THR316D/THR320D + if uiid in (5, 32, 182, 190, 181): if self.cloud.online and device.get("online"): params = {"uiActive": 60} asyncio.create_task(self.cloud.send(device, params, timeout=0)) diff --git a/custom_components/sonoff/core/ewelink/cloud.py b/custom_components/sonoff/core/ewelink/cloud.py index 15f2f5d4..5b1159ed 100644 --- a/custom_components/sonoff/core/ewelink/cloud.py +++ b/custom_components/sonoff/core/ewelink/cloud.py @@ -8,7 +8,7 @@ import json import logging import time -from typing import Optional +from typing import Optional, Dict from aiohttp import ClientConnectorError, ClientWebSocketResponse, WSMessage @@ -49,30 +49,34 @@ class AuthError(Exception): class ResponseWaiter: """Class wait right sequences in response messages.""" - _waiters = {} + _waiters: Dict[str, asyncio.Future] = {} def _set_response(self, sequence: str, error: int) -> bool: if sequence not in self._waiters: return False - # sometimes the error doesn't exists - result = DATA_ERROR[error] if error in DATA_ERROR else f"E#{error}" - self._waiters[sequence].set_result(result) - return True - async def _wait_response(self, sequence: str, timeout: int): - self._waiters[sequence] = asyncio.get_event_loop().create_future() + try: + # sometimes the error doesn't exists + result = DATA_ERROR[error] if error in DATA_ERROR else f"E#{error}" + self._waiters[sequence].set_result(result) + return True + except Exception: + return False + + async def _wait_response(self, sequence: str, timeout: float): + self._waiters[sequence] = fut = asyncio.get_event_loop().create_future() try: # limit future wait time - await asyncio.wait_for(self._waiters[sequence], timeout) + await asyncio.wait_for(fut, timeout) except asyncio.TimeoutError: - # remove future from waiters, in very rare cases, we can send two - # commands with the same sequence - self._waiters.pop(sequence, None) return "timeout" + finally: + # remove future from waiters + _ = self._waiters.pop(sequence, None) # remove future from waiters and return result - return self._waiters.pop(sequence).result() + return fut.result() class XRegistryCloud(ResponseWaiter, XRegistryBase): @@ -199,7 +203,7 @@ async def send( device: XDevice, params: dict = None, sequence: str = None, - timeout: int = 5, + timeout: float = 5, ): """With params - send new state to device, without - request device state. With zero timeout - won't wait response. diff --git a/custom_components/sonoff/light.py b/custom_components/sonoff/light.py index d7e5f66a..38860f08 100644 --- a/custom_components/sonoff/light.py +++ b/custom_components/sonoff/light.py @@ -731,6 +731,12 @@ class XLightB02(XLight): _attr_supported_color_modes = {COLOR_MODE_COLOR_TEMP} _attr_supported_features = SUPPORT_EFFECT + # ewelink specs + min_br = 1 + max_br = 100 + min_ct = 0 + max_ct = 255 + def __init__(self, ewelink: XRegistry, device: dict): XEntity.__init__(self, ewelink, device) @@ -752,10 +758,10 @@ def set_state(self, params: dict): state = params[self.effect] if "br" in state: - self._attr_brightness = conv(state["br"], 1, 100, 1, 255) + self._attr_brightness = conv(state["br"], self.min_br, self.max_br, 1, 255) if "ct" in state: self._attr_color_temp = conv( - state["ct"], 0, 255, self.max_mireds, self.min_mireds + state["ct"], self.min_ct, self.max_ct, self.max_mireds, self.min_mireds ) def get_params(self, brightness, color_temp, rgb_color, effect) -> dict: @@ -763,13 +769,15 @@ def get_params(self, brightness, color_temp, rgb_color, effect) -> dict: return { "ltype": "white", "white": { - "br": conv(brightness or self.brightness, 1, 255, 1, 100), + "br": conv( + brightness or self.brightness, 1, 255, self.min_br, self.max_br + ), "ct": conv( color_temp or self.color_temp, self.max_mireds, self.min_mireds, - 0, - 255, + self.min_ct, + self.max_ct, ), }, } @@ -816,11 +824,11 @@ def set_state(self, params: dict): # fix https://github.com/AlexxIT/SonoffLAN/issues/1093 state = params.get(effect) or B05_MODE_PAYLOADS.get(effect) or {} if "br" in state: - self._attr_brightness = conv(state["br"], 1, 100, 1, 255) + self._attr_brightness = conv(state["br"], self.min_br, self.max_br, 1, 255) if "ct" in state: self._attr_color_temp = conv( - state["ct"], 0, 255, self.max_mireds, self.min_mireds + state["ct"], self.min_ct, self.max_ct, self.max_mireds, self.min_mireds ) if "r" in state or "g" in state or "b" in state: @@ -835,15 +843,25 @@ def get_params(self, brightness, color_temp, rgb_color, effect) -> dict: return { "ltype": "white", "white": { - "br": conv(brightness or self.brightness, 1, 255, 1, 100), - "ct": conv(color_temp, self.max_mireds, self.min_mireds, 0, 255), + "br": conv( + brightness or self.brightness, 1, 255, self.min_br, self.max_br + ), + "ct": conv( + color_temp, + self.max_mireds, + self.min_mireds, + self.min_ct, + self.max_ct, + ), }, } if rgb_color: return { "ltype": "color", "color": { - "br": conv(brightness or self.brightness, 1, 255, 1, 100), + "br": conv( + brightness or self.brightness, 1, 255, self.min_br, self.max_br + ), "r": rgb_color[0], "g": rgb_color[1], "b": rgb_color[2], diff --git a/custom_components/sonoff/manifest.json b/custom_components/sonoff/manifest.json index 26ebfb35..f21075c4 100644 --- a/custom_components/sonoff/manifest.json +++ b/custom_components/sonoff/manifest.json @@ -14,6 +14,6 @@ "requirements": [ "pycryptodome>=3.6.6" ], - "version": "3.5.0", + "version": "3.5.1", "iot_class": "local_push" } diff --git a/custom_components/sonoff/sensor.py b/custom_components/sonoff/sensor.py index b31e3a74..d8539771 100644 --- a/custom_components/sonoff/sensor.py +++ b/custom_components/sonoff/sensor.py @@ -1,5 +1,6 @@ import asyncio import time +from typing import Optional from homeassistant.components.sensor import ( SensorDeviceClass, @@ -7,7 +8,6 @@ SensorStateClass, ) from homeassistant.const import ( - DEVICE_CLASS_TIMESTAMP, ELECTRIC_CURRENT_AMPERE, ELECTRIC_POTENTIAL_VOLT, ENERGY_KILO_WATT_HOUR, @@ -37,6 +37,8 @@ async def async_setup_entry(hass, config_entry, add_entities): "battery": SensorDeviceClass.BATTERY, "battery_voltage": SensorDeviceClass.VOLTAGE, "current": SensorDeviceClass.CURRENT, + "energy_day": SensorDeviceClass.ENERGY, + "energy_month": SensorDeviceClass.ENERGY, "humidity": SensorDeviceClass.HUMIDITY, "outdoor_temp": SensorDeviceClass.TEMPERATURE, "power": SensorDeviceClass.POWER, @@ -49,6 +51,8 @@ async def async_setup_entry(hass, config_entry, add_entities): "battery": PERCENTAGE, "battery_voltage": ELECTRIC_POTENTIAL_VOLT, "current": ELECTRIC_CURRENT_AMPERE, + "energy_day": ENERGY_KILO_WATT_HOUR, + "energy_month": ENERGY_KILO_WATT_HOUR, "humidity": PERCENTAGE, "outdoor_temp": TEMP_CELSIUS, "power": POWER_WATT, @@ -181,53 +185,78 @@ class XEnergySensor(XEntity, SensorEntity): def __init__(self, ewelink: XRegistry, device: dict): XEntity.__init__(self, ewelink, device) - self.report_dt, self.report_history = device.get("reporting", {}).get( - self.uid - ) or (3600, 0) + reporting = device.get("reporting", {}) + self.report_dt, self.report_history = reporting.get(self.uid) or (3600, 0) - def set_state(self, params: dict): - value = params[self.param] + @staticmethod + def decode_energy(value: str) -> Optional[list]: try: - history = [ + return [ round( - int(value[i : i + 2], 16) + int(value[i + 3] + value[i + 5]) * 0.01, + int(value[i : i + 2], 16) + + int(value[i + 3], 10) * 0.1 + + int(value[i + 5], 10) * 0.01, 2, ) for i in range(0, len(value), 6) ] - self._attr_native_value = history[0] - if self.report_history: - self._attr_extra_state_attributes = { - "history": history[0 : self.report_history] - } except Exception: - pass + return None + + def set_state(self, params: dict): + history = self.decode_energy(params[self.param]) + if not history: + return + + self._attr_native_value = history[0] + + if self.report_history: + self._attr_extra_state_attributes = { + "history": history[0 : self.report_history] + } async def async_update(self): ts = time.time() - if ts > self.next_ts and self.available and self.ewelink.cloud.online: + if ts < self.next_ts or not self.available or not self.ewelink.cloud.online: + return + ok = await self.ewelink.cloud.send(self.device, self.get_params) + if ok == "online": self.next_ts = ts + self.report_dt - await self.ewelink.cloud.send(self.device, self.get_params) class XEnergySensorDualR3(XEnergySensor, SensorEntity): - def set_state(self, params: dict): - value = params[self.param] + @staticmethod + def decode_energy(value: str) -> Optional[list]: try: - history = [ + return [ round( - int(value[i : i + 2], 10) + int(value[i + 2] + value[i + 3]) * 0.01, - 2, + int(value[i : i + 2], 16) + int(value[i + 2 : i + 4], 10) * 0.01, 2 ) for i in range(0, len(value), 4) ] - self._attr_native_value = history[0] - if self.report_history: - self._attr_extra_state_attributes = { - "history": history[0 : self.report_history] - } except Exception: - pass + return None + + +class XEnergySensorPOWR3(XEnergySensor, SensorEntity): + @staticmethod + def decode_energy(value: str) -> Optional[list]: + try: + return [ + round(int(value[i], 16) + int(value[i + 1 : i + 3], 10) * 0.01, 2) + for i in range(0, len(value), 3) + ] + except Exception: + return None + + async def async_update(self): + ts = time.time() + if ts < self.next_ts or not self.available: + return + # POWR3 support LAN energy request (POST /zeroconf/getHoursKwh) + ok = await self.ewelink.send(self.device, self.get_params, timeout_lan=5) + if ok == "online": + self.next_ts = ts + self.report_dt class XTemperatureNS(XSensor): @@ -294,7 +323,7 @@ async def clear_state(self): class XUnknown(XEntity, SensorEntity): - _attr_device_class = DEVICE_CLASS_TIMESTAMP + _attr_device_class = SensorDeviceClass.TIMESTAMP def internal_update(self, params: dict = None): self._attr_native_value = dt.utcnow() diff --git a/custom_components/sonoff/switch.py b/custom_components/sonoff/switch.py index 07fbfb6c..b28b27ec 100644 --- a/custom_components/sonoff/switch.py +++ b/custom_components/sonoff/switch.py @@ -71,6 +71,17 @@ async def async_turn_off(self): await self.ewelink.send(self.device, params) +# noinspection PyAbstractClass +class XSwitchPOWR3(XSwitches): + async def async_turn_on(self): + params = {"switches": [{"outlet": 0, "switch": "on"}], "operSide": 1} + await self.ewelink.send(self.device, params) + + async def async_turn_off(self): + params = {"switches": [{"outlet": 0, "switch": "off"}], "operSide": 1} + await self.ewelink.send(self.device, params) + + # noinspection PyAbstractClass class XZigbeeSwitches(XSwitches): async def async_turn_on(self, **kwargs): diff --git a/extras/Node-RED/flows.json b/extras/Node-RED/flows.json index 15ac40b2..0c87f902 100644 --- a/extras/Node-RED/flows.json +++ b/extras/Node-RED/flows.json @@ -1 +1 @@ -[{"id":"9584418c.dafc2","type":"tab","label":"Automations","disabled":false,"info":""},{"id":"f602e6ba.609d28","type":"tab","label":"Irrigation","disabled":false,"info":""},{"id":"e1dc0b88.463bb8","type":"server","name":"Home Assistant","version":5,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"546e31ed.0db1c","type":"mqtt-broker","name":"Mosquitto","broker":"10.0.1.22","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9f81fd881d01a666","type":"position-config","name":"","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timeZoneOffset":"99","timeZoneDST":"0","stateTimeFormat":"3","stateDateFormat":"12"},{"id":"4f8f8feffed26998","type":"sqlitedb","db":"/data/amazon.db","mode":"RWC"},{"id":"2022689a.938918","type":"api-call-service","z":"9584418c.dafc2","name":"Notify Via Wrapper: Opened 1 Minute","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": \"The \" & $lowercase(msg.data.new_state.attributes.friendly_name) & \" has been opened for 1 minute\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":100,"wires":[[]]},{"id":"8ec438b6.4eb2e8","type":"api-current-state","z":"9584418c.dafc2","name":"Door Notify On","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.door_notify","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":480,"y":42,"wires":[["c5124616.c9bd48"],[]]},{"id":"28fa66cd.af058a","type":"trigger","z":"9584418c.dafc2","name":"Wait 1m","op1":"","op2":"1","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":100,"wires":[["2022689a.938918"]]},{"id":"9c1d9c7c.ed9c7","type":"change","z":"9584418c.dafc2","name":"Reset If Closed","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":200,"wires":[["28fa66cd.af058a","5c24f744.30fcb8","cf758271.d4fd6","5a740c2d.009864"]]},{"id":"896f5b34.7b4328","type":"api-call-service","z":"9584418c.dafc2","name":"Notify Via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": payload, \"data\": {\"priority\": 1} \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":970,"y":40,"wires":[[]]},{"id":"c5124616.c9bd48","type":"template","z":"9584418c.dafc2","name":"Opened","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{ data.new_state.attributes.friendly_name }} opened","output":"str","x":740,"y":40,"wires":[["896f5b34.7b4328"]]},{"id":"f9d93af6.184028","type":"server-state-changed","z":"9584418c.dafc2","name":"Door Opened","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.*_door$","entityidfiltertype":"regex","outputinitially":false,"state_type":"habool","haltifstate":"true","halt_if_type":"bool","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":80,"wires":[["8ec438b6.4eb2e8","28fa66cd.af058a","5c24f744.30fcb8","cf758271.d4fd6","5a740c2d.009864"],["9c1d9c7c.ed9c7"]]},{"id":"42796298.a0104c","type":"api-current-state","z":"9584418c.dafc2","name":"Heading Comparison","server":"e1dc0b88.463bb8","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.gate_heading_comparison","state_type":"habool","blockInputOverrides":true,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":600,"y":340,"wires":[["115d9f48.071141"]]},{"id":"222ebf24.bfbfa","type":"inject","z":"9584418c.dafc2","name":"Every Hour","repeat":"","crontab":"0 0-23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":340,"wires":[["3b804cf9.ada174"]]},{"id":"115d9f48.071141","type":"switch","z":"9584418c.dafc2","name":"Last Changed > 4 hours","property":"data.timeSinceChangedMs","propertyType":"msg","rules":[{"t":"gt","v":"14400000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":340,"wires":[["1eab32fa.1312bd"]]},{"id":"c444f1de.8365f","type":"api-call-service","z":"9584418c.dafc2","name":"Notify Via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": payload \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1330,"y":360,"wires":[[]]},{"id":"9aee0f4b.44e93","type":"trigger-state","z":"9584418c.dafc2","name":"Gate Offline/Online","server":"e1dc0b88.463bb8","version":2,"entityid":"sensor.gate_online_offline","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"inputs":1,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":true,"x":290,"y":400,"wires":[["cc1f97c7.911bf8"],[]]},{"id":"1fdf1fb6.8cd5d","type":"function","z":"9584418c.dafc2","name":"Create msg object","func":"var message = \"Gate reports \" + msg.payload + \"..\"\n\nreturn { payload: message,topic:msg.topic };","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1090,"y":380,"wires":[["c444f1de.8365f"]]},{"id":"cc1f97c7.911bf8","type":"api-current-state","z":"9584418c.dafc2","name":"Gate Alert On","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.gate_alert","state_type":"habool","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":680,"y":400,"wires":[["1fdf1fb6.8cd5d"],[]]},{"id":"3b804cf9.ada174","type":"api-current-state","z":"9584418c.dafc2","name":"Gate Alert On","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.gate_alert","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":380,"y":340,"wires":[["42796298.a0104c"],[]]},{"id":"1eab32fa.1312bd","type":"function","z":"9584418c.dafc2","name":"Create msg object","func":"var last_time = msg.data.timeSinceChangedMs\n\nfunction msToTime(duration) {\n var milliseconds = parseInt((duration % 1000) / 100),\n seconds = Math.floor((duration / 1000) % 60),\n minutes = Math.floor((duration / (1000 * 60)) % 60),\n hours = Math.floor((duration / (1000 * 60 * 60)) % 24);\n\n hours = (hours < 10) ? \"0\" + hours : hours;\n minutes = (minutes < 10) ? \"0\" + minutes : minutes;\n seconds = (seconds < 10) ? \"0\" + seconds : seconds;\n\n return hours + \":\" + minutes + \":\" + seconds + \".\" + milliseconds;\n}\n\nvar message = msg.data.entity_id + \" last changed \" + msToTime(last_time) + \" ago\"\n\nreturn { payload: message,topic:msg.topic };","outputs":1,"noerr":0,"x":1090,"y":340,"wires":[["c444f1de.8365f"]]},{"id":"73550501.be7fbc","type":"trigger-state","z":"9584418c.dafc2","name":"Rack Temperature","server":"e1dc0b88.463bb8","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.rack_exhaust_temperature","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"inputs":1,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"num","enableInput":true,"x":190,"y":578,"wires":[["7dff3ae1.e36a04"],[]]},{"id":"7dff3ae1.e36a04","type":"switch","z":"9584418c.dafc2","name":"Above 90?","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"95","vt":"num"},{"t":"lte","v":"90","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":410,"y":578,"wires":[["29b17ed7.fab972"],["96b5207d.407dd"]]},{"id":"88822bfe.2cc598","type":"api-call-service","z":"9584418c.dafc2","name":"Turn on Fan","server":"e1dc0b88.463bb8","version":5,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["fan.rack_fan"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":850,"y":520,"wires":[[]]},{"id":"96b5207d.407dd","type":"api-current-state","z":"9584418c.dafc2","name":"Rack Fan","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"fan.rack_fan","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":640,"y":598,"wires":[["c7ff978f.ff0728"],[]]},{"id":"b259f0eb.3e83","type":"api-call-service","z":"9584418c.dafc2","name":"Turn off fan","server":"e1dc0b88.463bb8","version":5,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["fan.rack_fan"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":1090,"y":620,"wires":[[]]},{"id":"fa90c550.d6c948","type":"inject","z":"9584418c.dafc2","name":"At 8 PM","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 20 * * 1,2,4,5,6,0","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":738,"wires":[["1457bf6605a50448"]]},{"id":"e93027cb.6a6308","type":"api-current-state","z":"9584418c.dafc2","name":"Master Bedroom Lamps On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.master_bedroom_lamps","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":700,"y":740,"wires":[["fc81cfda.29ff5"],[]]},{"id":"fc81cfda.29ff5","type":"api-call-service","z":"9584418c.dafc2","name":"Set brightness to 128","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{\"brightness\":\"128\",\"transition\":5, \"entity_id\": msg.data.entity_id}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1021,"y":738,"wires":[[]]},{"id":"c7ff978f.ff0728","type":"api-current-state","z":"9584418c.dafc2","name":"Rack fan auto off?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.rack_fan_auto_off","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":870,"y":620,"wires":[["b259f0eb.3e83"],[]]},{"id":"29b17ed7.fab972","type":"api-current-state","z":"9584418c.dafc2","name":"Rack Fan","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"fan.rack_fan","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":640,"y":520,"wires":[[],["88822bfe.2cc598"]]},{"id":"3314ec9f.ca8994","type":"server-state-changed","z":"9584418c.dafc2","name":"Garage Opened","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"cover.garage_door","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"open","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":140,"wires":[["8ec438b6.4eb2e8"],[]]},{"id":"8ee35d65.a7569","type":"api-current-state","z":"9584418c.dafc2","d":true,"name":"Kitchen Cans On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.kitchen_can_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":670,"y":980,"wires":[["5420f9c0.5356c8"],[]]},{"id":"41b918d5.7ce018","type":"api-current-state","z":"9584418c.dafc2","d":true,"name":"Kitchen Table On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.kitchen_table_light","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":670,"y":1100,"wires":[["d8ad0651.bf7a18"],[]]},{"id":"5420f9c0.5356c8","type":"api-call-service","z":"9584418c.dafc2","name":"Set brightness to 40","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{\"brightness\":\"40\",\"transition\": \"5\", \"entity_id\": msg.data.entity_id}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1020,"y":880,"wires":[[]]},{"id":"77184c93.8790d4","type":"api-current-state","z":"9584418c.dafc2","d":true,"name":"Kitchen Sink On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.kitchen_sink_light","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":670,"y":920,"wires":[["5420f9c0.5356c8"],[]]},{"id":"39a5ce57.78e3d2","type":"api-current-state","z":"9584418c.dafc2","name":"Living Room Cans On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.living_room_can_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":690,"y":860,"wires":[["5420f9c0.5356c8"],[]]},{"id":"5c24f744.30fcb8","type":"trigger","z":"9584418c.dafc2","name":"Wait 5m","op1":"","op2":"5","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":140,"wires":[["6aa388d0.707768"]]},{"id":"6aa388d0.707768","type":"api-call-service","z":"9584418c.dafc2","name":"Alexa Announce Opened","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"notify","service":"alexa_media","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"The\" & $lowercase(msg.data.new_state.attributes.friendly_name) & \"has been opened for\" & msg.payload & \" minutes.\",\"data\":{\"method\":\"all\",\"type\":\"announce\"},\"target\":[\"Office\",\"Kitchen\",\"Master\",\"Living Room\"]}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":870,"y":160,"wires":[[]]},{"id":"cf758271.d4fd6","type":"trigger","z":"9584418c.dafc2","name":"Wait 10m","op1":"","op2":"10","op1type":"nul","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":180,"wires":[["6aa388d0.707768"]]},{"id":"5a740c2d.009864","type":"trigger","z":"9584418c.dafc2","name":"Wait 15m","op1":"","op2":"15","op1type":"nul","op2type":"str","duration":"15","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":220,"wires":[["6aa388d0.707768"]]},{"id":"ea19fe14.80749","type":"api-current-state","z":"9584418c.dafc2","d":true,"name":"Entryway On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.entryway_light","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":660,"y":1040,"wires":[["5420f9c0.5356c8"],[]]},{"id":"ea2604f9.4cdf98","type":"api-current-state","z":"9584418c.dafc2","name":"Living Room Sconces On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.living_room_sconces","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":700,"y":800,"wires":[["fc81cfda.29ff5"],[]]},{"id":"8a82f465.846018","type":"comment","z":"9584418c.dafc2","name":"100% = 255","info":"","x":990,"y":811,"wires":[]},{"id":"d8ad0651.bf7a18","type":"api-call-service","z":"9584418c.dafc2","name":"Set brightness to 80","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{\"brightness\":\"80\",\"transition\": \"5\", \"entity_id\": msg.data.entity_id}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1020,"y":960,"wires":[[]]},{"id":"86bc310cbc0562af","type":"inject","z":"9584418c.dafc2","name":"At 10PM","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":1260,"wires":[["2fb6a7afb6502a32","8c55985bffebd56a"]]},{"id":"2fb6a7afb6502a32","type":"api-call-service","z":"9584418c.dafc2","name":"Front Porch Lights to 40","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.front_porch_lights"],"data":"{\"brightness\":\"40\",\"transition\":5}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":430,"y":1260,"wires":[[]]},{"id":"3f2a2e4d99057b69","type":"server-state-changed","z":"9584418c.dafc2","name":"Front Door Motion","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.front_door_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"habool","haltifstate":"true","halt_if_type":"bool","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":190,"y":1440,"wires":[["17b35d69307a8455"],[]]},{"id":"67312d79a5108126","type":"api-current-state","z":"9584418c.dafc2","name":"Front Porch On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.front_porch_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":650,"y":1400,"wires":[["3e399d83e4e7f4c3"],[]]},{"id":"3e399d83e4e7f4c3","type":"api-call-service","z":"9584418c.dafc2","name":"Front Porch Lights to 254","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.front_porch_lights"],"data":"{\"brightness\":\"254\",\"transition\":2}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":1400,"wires":[["59f5bc2571b0f12f"]]},{"id":"59f5bc2571b0f12f","type":"delay","z":"9584418c.dafc2","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":580,"y":1500,"wires":[["c68c969a6b8c2833"]]},{"id":"c68c969a6b8c2833","type":"api-call-service","z":"9584418c.dafc2","name":"Front Porch Lights to 40","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.front_porch_lights"],"data":"{\"brightness\":\"40\",\"transition\":5}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":810,"y":1500,"wires":[[]]},{"id":"d9cc182cc3eb2a93","type":"inject","z":"9584418c.dafc2","name":"At 10 PM","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 22 * * 3","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":780,"wires":[["1457bf6605a50448"]]},{"id":"b1a99d9698d831b2","type":"server-state-changed","z":"9584418c.dafc2","name":"433 Motion","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.433_front_porch_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":1500,"wires":[["17b35d69307a8455","d11c183fff8d848d"]]},{"id":"17b35d69307a8455","type":"within-time-switch","z":"9584418c.dafc2","name":"","nameInt":"","positionConfig":"9f81fd881d01a666","startTime":"22:00","startTimeType":"entered","startOffset":0,"startOffsetType":"none","startOffsetMultiplier":60000,"endTime":"sunriseStart","endTimeType":"pdsTime","endOffset":"-30","endOffsetType":"num","endOffsetMultiplier":60000,"timeRestrictions":0,"timeRestrictionsType":"none","timeDays":"*","timeOnlyOddDays":false,"timeOnlyEvenDays":false,"timeOnlyOddWeeks":false,"timeOnlyEvenWeeks":false,"timeMonths":"*","timedatestart":"","timedateend":"","propertyStart":"","propertyStartType":"none","propertyStartCompare":"true","propertyStartThreshold":"","propertyStartThresholdType":"num","startTimeAlt":"","startTimeAltType":"entered","startOffsetAlt":0,"startOffsetAltType":"none","startOffsetAltMultiplier":60000,"propertyEnd":"","propertyEndType":"none","propertyEndCompare":"true","propertyEndThreshold":"","propertyEndThresholdType":"num","endTimeAlt":"","endTimeAltType":"entered","endOffsetAlt":0,"endOffsetAltType":"none","endOffsetAltMultiplier":60000,"withinTimeValue":"","withinTimeValueType":"msgInput","outOfTimeValue":"","outOfTimeValueType":"msgInput","tsCompare":"0","x":420,"y":1440,"wires":[["67312d79a5108126"],[]]},{"id":"d11c183fff8d848d","type":"change","z":"9584418c.dafc2","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":1500,"wires":[["59f5bc2571b0f12f"]]},{"id":"a9a323de66b6f772","type":"http request","z":"9584418c.dafc2","name":"Get Aircraft","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://vrs:8080/VirtualRadar/AircraftList.json","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"application/json"}],"x":410,"y":1760,"wires":[["7da69a7e8ecadc7c","91afebbf8b9edf05","4ca1a5ad47ce7a18","2cd08c8da06afaf6"]]},{"id":"ee139512bcad0966","type":"inject","z":"9584418c.dafc2","name":"Every 10 Seconds","props":[],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":210,"y":1760,"wires":[["a9a323de66b6f772"]]},{"id":"7da69a7e8ecadc7c","type":"function","z":"9584418c.dafc2","name":"Amazon","func":"var alert = {}\nvar message = \"Airborne:\\n\"\n\nfor (var i = 0; i < msg.payload.acList.length; i++) {\n if (typeof msg.payload.acList[i].Reg !== \"undefined\" && typeof msg.payload.acList[i].Man !== \"undefined\") {\n if (msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n //if (msg.payload.acList[i].Reg.endsWith(\"PA\") && msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n alert[msg.payload.acList[i].Reg] = msg.payload.acList[i].Icao\n }\n }\n}\n\nif (Object.keys(alert).length > 0) {\n for (const [key, value] of Object.entries(alert)) {\n message += key + \": https://globe.adsbexchange.com/?icao=\" + value + \"\\n\"\n }\n return { payload: message + \"https://vrs.aneis.ch\" }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":1740,"wires":[["5684b08aacd6d225"]]},{"id":"26e32b1d7824356a","type":"api-call-service","z":"9584418c.dafc2","name":"Notify Via Signal","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"notify","service":"signal_adsb","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": payload \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1000,"y":1740,"wires":[[]]},{"id":"3a82b835.c57d48","type":"function","z":"9584418c.dafc2","name":"Rate Limiter","func":"var interval = (1000*60*10); // minimum interval between messages (ms)\ncontext.lastTime = context.lastTime || 0;\n\nvar now = Date.now();\n\nif (now-context.lastTime > interval) {\n context.lastTime = now;\n return msg;\n} else {\n return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":1680,"wires":[["26e32b1d7824356a"]]},{"id":"91afebbf8b9edf05","type":"function","z":"9584418c.dafc2","name":"Interesting Tail #","func":"var alert = {}\nvar message = \"Interesting:\\n\"\n\nvar interesting = [\"N518GS\", \"N628TS\", \"82-8000\"]\n\nfor (var i = 0; i < msg.payload.acList.length; i++) {\n if (typeof msg.payload.acList[i].Reg !== \"undefined\") {\n if (interesting.includes(msg.payload.acList[i].Reg)) {\n alert[msg.payload.acList[i].Reg] = msg.payload.acList[i].Icao\n }\n }\n}\n\nif (Object.keys(alert).length > 0) {\n for (const [key, value] of Object.entries(alert)) {\n message += key + \": https://globe.adsbexchange.com/?icao=\" + value + \"\\n\"\n }\n return { payload: message + \"https://vrs.aneis.ch\" }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":1680,"wires":[["3a82b835.c57d48"]]},{"id":"5684b08aacd6d225","type":"function","z":"9584418c.dafc2","name":"Rate Limiter","func":"var interval = (1000*60); // minimum interval between messages (ms)\ncontext.lastTime = context.lastTime || 0;\n\nvar now = Date.now();\n\nif (now-context.lastTime > interval) {\n context.lastTime = now;\n return msg;\n} else {\n return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":1740,"wires":[["26e32b1d7824356a"]]},{"id":"4ca1a5ad47ce7a18","type":"function","z":"9584418c.dafc2","name":"Amazon Landing","func":"var alert = {}\nvar message = \"Landing:\\n\"\n\nfor (var i = 0; i < msg.payload.acList.length; i++) {\n if (typeof msg.payload.acList[i].Reg !== \"undefined\" && typeof msg.payload.acList[i].Man !== \"undefined\") {\n //if (msg.payload.acList[i].Reg.endsWith(\"PA\") && msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n if (msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n if (msg.payload.acList[i].Alt < 50){\n alert[msg.payload.acList[i].Reg] = msg.payload.acList[i].Icao\n }\n }\n }\n}\n\nif (Object.keys(alert).length > 0) {\n for (const [key, value] of Object.entries(alert)) {\n message += key + \": https://globe.adsbexchange.com/?icao=\" + value + \"\\n\"\n }\n return { payload: message + \"https://vrs.aneis.ch\" }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":1800,"wires":[["ba68e03143ba4af8"]]},{"id":"ba68e03143ba4af8","type":"function","z":"9584418c.dafc2","name":"Rate Limiter","func":"var interval = (1000*60); // minimum interval between messages (ms)\ncontext.lastTime = context.lastTime || 0;\n\nvar now = Date.now();\n\nif (now-context.lastTime > interval) {\n context.lastTime = now;\n return msg;\n} else {\n return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":1800,"wires":[["26e32b1d7824356a"]]},{"id":"5f1d1b471a1c7cbb","type":"sqlite","z":"9584418c.dafc2","mydb":"4f8f8feffed26998","sqlquery":"msg.topic","sql":"","name":"Amazon","x":800,"y":1860,"wires":[["ea911291f04c7d18"]]},{"id":"2cd08c8da06afaf6","type":"function","z":"9584418c.dafc2","name":"Write Amazon Landing","func":"var sql = \"\"\n\nfor (var i = 0; i < msg.payload.acList.length; i++) {\n var latlong = \"0,0\"\n if (typeof msg.payload.acList[i].Reg !== \"undefined\" && typeof msg.payload.acList[i].Lat !== \"undefined\" && typeof msg.payload.acList[i].Long !== \"undefined\") {\n //if (msg.payload.acList[i].Reg.endsWith(\"PA\") && msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n if (msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n if (msg.payload.acList[i].Alt < 50){\n latlong = msg.payload.acList[i].Lat + \",\" + msg.payload.acList[i].Long.toString()\n sql += `INSERT INTO deliveries (timestamp, registration, latlong, altitude) VALUES (\"${Date.now()}\", \"${msg.payload.acList[i].Reg}\", \"${latlong}\", \"${msg.payload.acList[i].Alt}\"); `\n }\n }\n }\n}\n\nif (sql.length > 0){\n msg.topic = sql\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":1860,"wires":[["5f1d1b471a1c7cbb"]]},{"id":"ea911291f04c7d18","type":"api-call-service","z":"9584418c.dafc2","name":"Generate Heatmap","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"shell_command","service":"generate_heatmap","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1010,"y":1860,"wires":[[]]},{"id":"cde7b3c9ca39891b","type":"link in","z":"9584418c.dafc2","name":"","links":["1457bf6605a50448"],"x":345,"y":760,"wires":[["e93027cb.6a6308","ea2604f9.4cdf98","39a5ce57.78e3d2","77184c93.8790d4","8ee35d65.a7569","ea19fe14.80749","41b918d5.7ce018"]]},{"id":"1457bf6605a50448","type":"link out","z":"9584418c.dafc2","name":"","links":["cde7b3c9ca39891b"],"x":315,"y":760,"wires":[]},{"id":"8c55985bffebd56a","type":"api-call-service","z":"9584418c.dafc2","name":"Front Sconces Off","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.front_sconces"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":410,"y":1200,"wires":[[]]},{"id":"fae7fa701710e258","type":"server-state-changed","z":"9584418c.dafc2","name":"Front Door Unlock","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"lock.front_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unlocked","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":190,"y":1380,"wires":[["17b35d69307a8455"],[]]},{"id":"54bad548.7e9fcc","type":"ha-get-entities","z":"f602e6ba.609d28","name":"Get \"On\" Sprinklers","server":"e1dc0b88.463bb8","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"switch.irrigation","valueType":"str"},{"property":"entity_id","logic":"does_not_include","value":"switch.irrigation_master_valve,switch.irrigation_24v_power,switch.irrigation_drip","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":370,"y":100,"wires":[["bcbf413e.7b188"]]},{"id":"5a10cd93.8e94b4","type":"inject","z":"f602e6ba.609d28","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":100,"wires":[["54bad548.7e9fcc"]]},{"id":"a77808ff.3f1288","type":"switch","z":"f602e6ba.609d28","name":"On Longer than 26 minutes?","property":"payload[0].timeSinceChangedMs","propertyType":"msg","rules":[{"t":"gte","v":"1600000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":700,"y":60,"wires":[["54ae6ec3.1bc63"]]},{"id":"54ae6ec3.1bc63","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload[0].entity_id }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":960,"y":60,"wires":[[]]},{"id":"bcbf413e.7b188","type":"switch","z":"f602e6ba.609d28","name":"More Than 0 Entities?","property":"payload","propertyType":"msg","rules":[{"t":"nempty"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":160,"wires":[["a77808ff.3f1288","3b848bce.76aea4"],["c42e6d62.7a24c"]]},{"id":"3b848bce.76aea4","type":"change","z":"f602e6ba.609d28","name":"Reset Delay","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":100,"wires":[["cdd3b7ef.04a618"]]},{"id":"43dedcca.ac7734","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Master","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1460,"y":180,"wires":[[]]},{"id":"b4335c36.09adb","type":"comment","z":"f602e6ba.609d28","name":"Set Auto-Off for Sprinkler","info":"","x":210,"y":40,"wires":[]},{"id":"c42e6d62.7a24c","type":"api-current-state","z":"f602e6ba.609d28","name":"Master On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.irrigation_master_valve","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":650,"y":160,"wires":[["cdd3b7ef.04a618"],["3b848bce.76aea4"]]},{"id":"d269f175.c9dc6","type":"server-events","z":"f602e6ba.609d28","name":"Custom Water Event Fired","server":"e1dc0b88.463bb8","version":2,"eventType":"irrigation_custom_water","exposeToHomeAssistant":false,"eventData":"","haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":170,"y":320,"wires":[["883f2c00.1d94e8"]]},{"id":"3367e45f.cc981c","type":"function","z":"f602e6ba.609d28","name":"++","func":"if ( (msg.i += 1) < msg.zones.length ) return msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":380,"wires":[["116d5bb3.ee92a4"]]},{"id":"116d5bb3.ee92a4","type":"function","z":"f602e6ba.609d28","name":"For Each","func":"if( msg.i == undefined ) msg.i = 0;\n\nmsg.payload = msg.zones[ msg.i ];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":820,"y":320,"wires":[["565ee5c1.561bfc","80df47d5.602888","e2c37b65c5582c2b"]]},{"id":"80df47d5.602888","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":320,"wires":[[]]},{"id":"fb46876c.845298","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":380,"wires":[["98eeafa7.bd2b9","860a4c61d7557dc9"]]},{"id":"98eeafa7.bd2b9","type":"delay","z":"f602e6ba.609d28","name":"Delay 5","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":960,"y":460,"wires":[["3367e45f.cc981c"]]},{"id":"7c3d09ca.229958","type":"comment","z":"f602e6ba.609d28","name":"Fired From HA Python Script or Automation","info":"","x":270,"y":260,"wires":[]},{"id":"565ee5c1.561bfc","type":"change","z":"f602e6ba.609d28","name":"Set Delay Variable","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload.time* 60000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":380,"wires":[["22a20603.86a06a"]]},{"id":"22a20603.86a06a","type":"stoptimer-varidelay","z":"f602e6ba.609d28","duration":"5","durationType":"num","units":"Millisecond","payloadtype":"num","payloadval":"0","name":"Delay","reporting":"every_second","persist":false,"x":1070,"y":380,"wires":[["fb46876c.845298"],[],["a8d96e.1f00969"]]},{"id":"a8d96e.1f00969","type":"mqtt out","z":"f602e6ba.609d28","name":"Publish Time Remaining","topic":"sensor/irrigation_time_remaining","qos":"","retain":"","broker":"546e31ed.0db1c","x":1330,"y":320,"wires":[]},{"id":"cdd3b7ef.04a618","type":"trigger","z":"f602e6ba.609d28","name":"Wait 1m","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":860,"y":120,"wires":[["5e9007a27732bba9"]]},{"id":"3b838f49.e10c","type":"comment","z":"f602e6ba.609d28","name":"Garden Drip - Bib timer start 7:58 and runs for 55 min - Handled by BHyve Now.","info":"","x":380,"y":540,"wires":[]},{"id":"3b656b89.1ac154","type":"inject","z":"f602e6ba.609d28","name":"5:00 Attempt","props":[{"p":"payload"}],"repeat":"","crontab":"00 05 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"zone\":\"switch.irrigation_front_beds\",\"time\":10,\"name\":\"Front beds\"},{\"zone\":\"switch.irrigation_front_lawn\",\"time\":20,\"name\":\"Front lawn\"},{\"zone\":\"switch.irrigation_left_and_main_rear_lawn\",\"time\":20,\"name\":\"Left and main rear lawn\"},{\"zone\":\"switch.irrigation_front_and_right_rear_lawn\",\"time\":20,\"name\":\"Front and right rear lawn\"},{\"zone\":\"switch.irrigation_side_lawn\",\"time\":20,\"name\":\"Side lawn\"}]","payloadType":"json","x":180,"y":1380,"wires":[["493b435f.c9851c"]]},{"id":"fdb6234.55064e","type":"function","z":"f602e6ba.609d28","name":"++","func":"if ( (msg.i += 1) < msg.zones.length ) return msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":2280,"wires":[["857c8b4f.d19808"]]},{"id":"857c8b4f.d19808","type":"function","z":"f602e6ba.609d28","name":"For Each","func":"if( msg.i == undefined ) msg.i = 0;\n\nmsg.payload = msg.zones[ msg.i ];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":2220,"wires":[["5ebabb53.f9e834"]]},{"id":"a60b0459.b34598","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1220,"y":2220,"wires":[["12f649bd.98f9f6"]]},{"id":"a082bd08.49c44","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":2400,"wires":[["6c216ad5.e58054"]]},{"id":"6c216ad5.e58054","type":"delay","z":"f602e6ba.609d28","name":"Delay 10","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":540,"y":2340,"wires":[["fdb6234.55064e"]]},{"id":"12f649bd.98f9f6","type":"change","z":"f602e6ba.609d28","name":"Set Delay Variable","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload.time* 60000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":2280,"wires":[["d029ec72.ae401"]]},{"id":"5eaebc41.9491c4","type":"switch","z":"f602e6ba.609d28","name":"Last Ran >= Template Hrs Ago","property":"data.continue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":2280,"wires":[["b7ac1681.a64af8"],["fdb6234.55064e"]]},{"id":"a9b82dcc.1843e","type":"api-render-template","z":"f602e6ba.609d28","name":"Evaluate Template","server":"e1dc0b88.463bb8","version":0,"template":"","resultsLocation":"data.continue","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":890,"y":2160,"wires":[["a298ba43aff58e18"]]},{"id":"5ebabb53.f9e834","type":"template","z":"f602e6ba.609d28","name":"Template: Zone Last Ran >= 71 hours","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{%- set entity_name = \"input_datetime{{ payload.zone }}\" | regex_replace(find='switch', replace='', ignorecase=False) -%}\n{%- set time = (as_timestamp(now()) - as_timestamp(states(entity_name+\"_last_start\"))) | int -%}\n{% if time >= 71*3600 %}1{% else %}0{% endif %}","output":"str","x":590,"y":2160,"wires":[["a9b82dcc.1843e"]]},{"id":"b7ac1681.a64af8","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Master Valve","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":900,"y":2220,"wires":[["3c20bed9.9f3812"]]},{"id":"d029ec72.ae401","type":"stoptimer-varidelay","z":"f602e6ba.609d28","duration":"5","durationType":"num","units":"Millisecond","payloadtype":"num","payloadval":"0","name":"Delay","reporting":"every_second","persist":false,"ignoretimerpass":false,"x":850,"y":2340,"wires":[["a082bd08.49c44","8a25411f.1fe15"],[],["df183b71.5ccca8"]]},{"id":"df183b71.5ccca8","type":"mqtt out","z":"f602e6ba.609d28","name":"Publish Time Remaining","topic":"sensor/irrigation_time_remaining","qos":"","retain":"","broker":"546e31ed.0db1c","x":1130,"y":2360,"wires":[]},{"id":"da687baa.d8ed88","type":"api-call-service","z":"f602e6ba.609d28","name":"Notify via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": alert \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1330,"y":2320,"wires":[[]]},{"id":"8a25411f.1fe15","type":"function","z":"f602e6ba.609d28","name":"Create msg object","func":"var message = \"Sprinkler auto-run: \" + msg.payload.name + \" ran for \" + msg.payload.time + \" minutes\"\n\nreturn { alert: message };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1110,"y":2320,"wires":[["da687baa.d8ed88"]]},{"id":"3c20bed9.9f3812","type":"delay","z":"f602e6ba.609d28","name":"2s","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1070,"y":2220,"wires":[["a60b0459.b34598"]]},{"id":"493b435f.c9851c","type":"api-current-state","z":"f602e6ba.609d28","name":"Schedule Enabled","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.lawn_irrigation_scheduling","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":410,"y":1380,"wires":[["8c060f00.cf577"],["7b12e66f.57d068"]]},{"id":"7b12e66f.57d068","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Automation Off\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":1400,"wires":[[]]},{"id":"8c060f00.cf577","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","576b66fa1bd202a3"],"x":595,"y":1360,"wires":[]},{"id":"4422f61c.847d88","type":"link in","z":"f602e6ba.609d28","name":"","links":["3ff9ce03ef7b554b"],"x":135,"y":1580,"wires":[["219b37105a8304f1"]]},{"id":"dcdeabc7.780578","type":"link out","z":"f602e6ba.609d28","name":"","links":["1eaa857e.b6b8db","c90fd5e6.c5c678","b8fe96458628f202"],"x":595,"y":1560,"wires":[]},{"id":"722d03d6.2ff77c","type":"link in","z":"f602e6ba.609d28","name":"","links":["8d4bfe8e.ee805","d67106b42368e630"],"x":135,"y":2000,"wires":[["b3c4a3638c17629e"]]},{"id":"af4788fe.215ba8","type":"link out","z":"f602e6ba.609d28","name":"","links":["405789f7.0727a8"],"x":595,"y":2000,"wires":[]},{"id":"405789f7.0727a8","type":"link in","z":"f602e6ba.609d28","name":"","links":["db46e0c1.f9ab5","af4788fe.215ba8"],"x":135,"y":2160,"wires":[["9941ac76.663b1"]]},{"id":"9941ac76.663b1","type":"template","z":"f602e6ba.609d28","name":"Zone Settings Lawn","field":"zones","fieldType":"msg","format":"json","syntax":"mustache","template":"[\n {\n \"zone\": \"switch.irrigation_front_lawn\",\n \"time\": 25,\n \"name\": \"Front lawn\"\n },\n {\n \"zone\": \"switch.irrigation_left_and_main_rear_lawn\",\n \"time\": 25,\n \"name\": \"Left and main rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_front_and_right_rear_lawn\",\n \"time\": 25,\n \"name\": \"Front and right rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_side_lawn\",\n \"time\": 20,\n \"name\": \"Side lawn\"\n }\n]","output":"json","x":280,"y":2160,"wires":[["857c8b4f.d19808"]]},{"id":"5933da9a.d9f024","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Lawn Zones","info":"","x":360,"y":2120,"wires":[]},{"id":"c90fd5e6.c5c678","type":"link in","z":"f602e6ba.609d28","name":"","links":["dcdeabc7.780578","89d715ddf12d2195"],"x":135,"y":1700,"wires":[["e7430e17f0b24ed8"]]},{"id":"862ad27a.d347d","type":"link out","z":"f602e6ba.609d28","name":"","links":["83edf648.3f9ed8"],"x":595,"y":1680,"wires":[]},{"id":"808e6a81.92e2e8","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Master Valve","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":440,"y":380,"wires":[["e42ff3d9.593dc"]]},{"id":"883f2c00.1d94e8","type":"api-current-state","z":"f602e6ba.609d28","name":"24v Power","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.irrigation_24v_power","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":230,"y":380,"wires":[["808e6a81.92e2e8"],[]]},{"id":"e42ff3d9.593dc","type":"delay","z":"f602e6ba.609d28","name":"Delay 5","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":460,"y":320,"wires":[["76160bc4.8cd644"]]},{"id":"76160bc4.8cd644","type":"change","z":"f602e6ba.609d28","name":"","rules":[{"t":"set","p":"zones","pt":"msg","to":"payload.event.zones","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":320,"wires":[["116d5bb3.ee92a4"]]},{"id":"83edf648.3f9ed8","type":"link in","z":"f602e6ba.609d28","name":"","links":["862ad27a.d347d","1bb3825011174363"],"x":135,"y":1800,"wires":[["b6e7d5b8891bba6d"]]},{"id":"8d4bfe8e.ee805","type":"link out","z":"f602e6ba.609d28","name":"","links":["722d03d6.2ff77c"],"x":595,"y":1820,"wires":[]},{"id":"70dfaa6a.be6a74","type":"inject","z":"f602e6ba.609d28","d":true,"name":"08:00","props":[{"p":"payload"}],"repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"zone\":\"switch.irrigation_front_beds\",\"time\":10,\"name\":\"Front beds\"},{\"zone\":\"switch.irrigation_front_lawn\",\"time\":20,\"name\":\"Front lawn\"},{\"zone\":\"switch.irrigation_left_and_main_rear_lawn\",\"time\":20,\"name\":\"Left and main rear lawn\"},{\"zone\":\"switch.irrigation_front_and_right_rear_lawn\",\"time\":20,\"name\":\"Front and right rear lawn\"},{\"zone\":\"switch.irrigation_side_lawn\",\"time\":20,\"name\":\"Side lawn\"}]","payloadType":"json","x":140,"y":580,"wires":[["c05e6454.2f85b8"]]},{"id":"c05e6454.2f85b8","type":"api-current-state","z":"f602e6ba.609d28","name":"Drip Irrigation Enabled","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.drip_irrigation_scheduling","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":320,"y":580,"wires":[["3461c5c.34e3d3a"],[]]},{"id":"3461c5c.34e3d3a","type":"api-call-service","z":"f602e6ba.609d28","name":"On","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_drip"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":490,"y":580,"wires":[["293b659b.8348ea"]]},{"id":"acd1bab8.aee3d8","type":"api-call-service","z":"f602e6ba.609d28","name":"Off","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.irrigation_drip"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":730,"y":580,"wires":[["c68eb12d.9599a"]]},{"id":"293b659b.8348ea","type":"delay","z":"f602e6ba.609d28","name":"30 Min","pauseType":"delay","timeout":"30","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":610,"y":580,"wires":[["acd1bab8.aee3d8"]]},{"id":"b60d2f74.cc7f6","type":"api-call-service","z":"f602e6ba.609d28","name":"On","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_drip"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":970,"y":580,"wires":[["da67a902.f7ef48"]]},{"id":"ed0380b5.fa017","type":"api-call-service","z":"f602e6ba.609d28","name":"Off","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.irrigation_drip"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1210,"y":580,"wires":[[]]},{"id":"da67a902.f7ef48","type":"delay","z":"f602e6ba.609d28","name":"5 Sec","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1090,"y":580,"wires":[["ed0380b5.fa017"]]},{"id":"c68eb12d.9599a","type":"delay","z":"f602e6ba.609d28","name":"30 Min","pauseType":"delay","timeout":"30","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":850,"y":580,"wires":[["b60d2f74.cc7f6"]]},{"id":"b76b5030.7d402","type":"comment","z":"f602e6ba.609d28","name":"Release Pressure","info":"","x":900,"y":540,"wires":[]},{"id":"edc724f1.d2e458","type":"comment","z":"f602e6ba.609d28","name":"Lawn Attempt","info":"","x":170,"y":1320,"wires":[]},{"id":"583f46a3.fc4c38","type":"inject","z":"f602e6ba.609d28","name":"8:00 Attempt","props":[{"p":"payload"}],"repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"zone\":\"switch.irrigation_front_beds\",\"time\":10,\"name\":\"Front beds\"},{\"zone\":\"switch.irrigation_front_lawn\",\"time\":20,\"name\":\"Front lawn\"},{\"zone\":\"switch.irrigation_left_and_main_rear_lawn\",\"time\":20,\"name\":\"Left and main rear lawn\"},{\"zone\":\"switch.irrigation_front_and_right_rear_lawn\",\"time\":20,\"name\":\"Front and right rear lawn\"},{\"zone\":\"switch.irrigation_side_lawn\",\"time\":20,\"name\":\"Side lawn\"}]","payloadType":"json","x":220,"y":2540,"wires":[["d9147878.b61cf8"]]},{"id":"d9147878.b61cf8","type":"api-current-state","z":"f602e6ba.609d28","name":"Schedule Enabled","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.front_bed_irrigation_scheduling","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":450,"y":2540,"wires":[["c7e5552e.7f8a08"],["45c5dbbbd8ce50a1"]]},{"id":"c7e5552e.7f8a08","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","f6881b4bf93c27c5"],"x":635,"y":2520,"wires":[]},{"id":"6bcf06fb.9ca748","type":"link in","z":"f602e6ba.609d28","name":"","links":["4f2902edc77f2d3b"],"x":175,"y":2740,"wires":[["ed6e3d4225582e20"]]},{"id":"f587589f.d739e8","type":"link out","z":"f602e6ba.609d28","name":"","links":["1eaa857e.b6b8db","9d851699.6a8458"],"x":635,"y":2720,"wires":[]},{"id":"d9d17e8f.590e6","type":"link in","z":"f602e6ba.609d28","name":"","links":["4fae5b92.a9cd44"],"x":175,"y":2960,"wires":[["d8637d8d96b68fca"]]},{"id":"d9f893eb.834f3","type":"link out","z":"f602e6ba.609d28","name":"","links":["5ce1803b.06628"],"x":635,"y":2960,"wires":[]},{"id":"9d851699.6a8458","type":"link in","z":"f602e6ba.609d28","name":"","links":["f587589f.d739e8"],"x":175,"y":2860,"wires":[["593bee0e8c958df8"]]},{"id":"4fae5b92.a9cd44","type":"link out","z":"f602e6ba.609d28","name":"","links":["d9d17e8f.590e6"],"x":635,"y":2840,"wires":[]},{"id":"aaacee72.fc35a","type":"comment","z":"f602e6ba.609d28","name":"Front Beds Attempt","info":"","x":230,"y":2480,"wires":[]},{"id":"a2ab7368.923fb","type":"template","z":"f602e6ba.609d28","name":"Zone Settings Front Beds","field":"zones","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n \"zone\": \"switch.irrigation_front_beds\",\n \"time\": 15,\n \"name\": \"Front beds\"\n}","output":"json","x":290,"y":3140,"wires":[["62b5545bc6d6e627"]]},{"id":"a31e3daf.17207","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Master Valve","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":3140,"wires":[["21ced698.708b5a"]]},{"id":"21ced698.708b5a","type":"delay","z":"f602e6ba.609d28","name":"2s","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":770,"y":3140,"wires":[["c661d489.9c9bc8"]]},{"id":"c661d489.9c9bc8","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": msg.zones.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":3140,"wires":[["accc6697.196268"]]},{"id":"accc6697.196268","type":"change","z":"f602e6ba.609d28","name":"Set Delay Variable","rules":[{"t":"set","p":"delay","pt":"msg","to":"msg.zones.time* 60000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":3140,"wires":[["487ff788.8c5c98"]]},{"id":"487ff788.8c5c98","type":"stoptimer-varidelay","z":"f602e6ba.609d28","duration":"5","durationType":"num","units":"Millisecond","payloadtype":"num","payloadval":"0","name":"Delay","reporting":"every_second","persist":false,"ignoretimerpass":false,"x":890,"y":3200,"wires":[["2238b09b.1b5b5","9129b06e.d8925"],[],["84258ddd.41da4"]]},{"id":"2238b09b.1b5b5","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": msg.zones.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":3280,"wires":[[]]},{"id":"84258ddd.41da4","type":"mqtt out","z":"f602e6ba.609d28","name":"Publish Time Remaining","topic":"sensor/irrigation_time_remaining","qos":"","retain":"","broker":"546e31ed.0db1c","x":1170,"y":3260,"wires":[]},{"id":"9129b06e.d8925","type":"function","z":"f602e6ba.609d28","name":"Create msg object","func":"var message = \"Sprinkler auto-run: \" + msg.zones.name + \" ran for \" + msg.zones.time + \" minutes\"\n\nreturn { alert: message };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1090,"y":3200,"wires":[["d83b5ff7a2212931"]]},{"id":"5ce1803b.06628","type":"link in","z":"f602e6ba.609d28","name":"","links":["db46e0c1.f9ab5","d9f893eb.834f3"],"x":135,"y":3140,"wires":[["a2ab7368.923fb"]]},{"id":"2afa6b1a.8012b4","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Front Beds","info":"","x":350,"y":3100,"wires":[]},{"id":"815fddc0.6604c","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On 24v","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_24v_power"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":470,"y":2000,"wires":[["af4788fe.215ba8"]]},{"id":"418058c4.af3158","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On 24v","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_24v_power"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":510,"y":2960,"wires":[["d9f893eb.834f3"]]},{"id":"1ae21386.a831bc","type":"inject","z":"f602e6ba.609d28","name":"10:00 24v Off","props":[],"repeat":"","crontab":"00 10 * * *","once":false,"onceDelay":0.1,"topic":"","x":180,"y":1200,"wires":[["117145a7.67e99a","882aff35f788008b"]]},{"id":"117145a7.67e99a","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off 24v","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.irrigation_24v_power"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":390,"y":1160,"wires":[[]]},{"id":"63f07877e73b952a","type":"switch","z":"f602e6ba.609d28","name":"More Than 0 Entities?","property":"payload","propertyType":"msg","rules":[{"t":"nempty"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":2,"x":1080,"y":180,"wires":[[],["749afd72791a5127"]]},{"id":"5e9007a27732bba9","type":"ha-get-entities","z":"f602e6ba.609d28","name":"Get \"On\" Sprinklers","server":"e1dc0b88.463bb8","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"switch.irrigation","valueType":"str"},{"property":"entity_id","logic":"does_not_include","value":"switch.irrigation_master_valve,switch.irrigation_24v_power","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":1050,"y":120,"wires":[["63f07877e73b952a"]]},{"id":"06d6255efdc31c47","type":"api-current-state","z":"f602e6ba.609d28","name":"Force Run","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_force_run","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":250,"y":1480,"wires":[["2fc67b25514de5a5"],["3ff9ce03ef7b554b"]]},{"id":"5420d0eed32223fb","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","08e3098cf183e086"],"x":595,"y":1460,"wires":[]},{"id":"3ff9ce03ef7b554b","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","4422f61c.847d88","8524a273a6a8ffd0"],"x":595,"y":1500,"wires":[]},{"id":"576b66fa1bd202a3","type":"link in","z":"f602e6ba.609d28","name":"","links":["8c060f00.cf577"],"x":135,"y":1480,"wires":[["06d6255efdc31c47"]]},{"id":"7350c911a0b1a86d","type":"api-current-state","z":"f602e6ba.609d28","name":"Force Run","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_force_run","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":290,"y":2640,"wires":[["abb8777dd08aa743"],["4f2902edc77f2d3b"]]},{"id":"fdcfa1521191fa40","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","b403eec7866aea22"],"x":635,"y":2620,"wires":[]},{"id":"4f2902edc77f2d3b","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","6bcf06fb.9ca748"],"x":635,"y":2660,"wires":[]},{"id":"f6881b4bf93c27c5","type":"link in","z":"f602e6ba.609d28","name":"","links":["c7e5552e.7f8a08"],"x":175,"y":2640,"wires":[["7350c911a0b1a86d"]]},{"id":"882aff35f788008b","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Force Run","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_force_run"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":410,"y":1220,"wires":[[]]},{"id":"a298ba43aff58e18","type":"api-current-state","z":"f602e6ba.609d28","name":"Force Run","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_force_run","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":610,"y":2220,"wires":[["b7ac1681.a64af8"],["5eaebc41.9491c4"]]},{"id":"a3d75225807b70eb","type":"delay","z":"f602e6ba.609d28","name":"30 Minute Delay","pauseType":"delay","timeout":"30","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":280,"y":1860,"wires":[["339ee0ada21856e0"]]},{"id":"e2c37b65c5582c2b","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Start/Stop tracking","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["automation.store_sprinkler_start_stop_times"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":280,"wires":[[]]},{"id":"860a4c61d7557dc9","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Start/Stop tracking","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["automation.store_sprinkler_start_stop_times"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1340,"y":440,"wires":[[]]},{"id":"061b74f643477dd9","type":"switch","z":"f602e6ba.609d28","name":"More Than 0 Entities?","property":"payload","propertyType":"msg","rules":[{"t":"nempty"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":2,"x":1360,"y":120,"wires":[["43dedcca.ac7734"],[]]},{"id":"749afd72791a5127","type":"trigger","z":"f602e6ba.609d28","name":"Wait 1m","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1240,"y":60,"wires":[["061b74f643477dd9"]]},{"id":"62b5545bc6d6e627","type":"template","z":"f602e6ba.609d28","name":"Template: Zone Last Ran >= 47 hours","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{%- set entity_name = \"input_datetime{{ zones.zone }}\" | regex_replace(find='switch', replace='', ignorecase=False) -%}\n{%- set time = (as_timestamp(now()) - as_timestamp(states(entity_name+\"_last_start\"))) | int -%}\n{% if time >= 47*3600 %}1{% else %}0{% endif %}","output":"str","x":350,"y":3200,"wires":[["aa53225140781dd7"]]},{"id":"aa53225140781dd7","type":"api-render-template","z":"f602e6ba.609d28","name":"Evaluate Template","server":"e1dc0b88.463bb8","version":0,"template":"","resultsLocation":"data.continue","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":290,"y":3260,"wires":[["8113d83074ff7701"]]},{"id":"8113d83074ff7701","type":"switch","z":"f602e6ba.609d28","name":"Last Ran >= Template Hrs Ago","property":"data.continue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":3260,"wires":[["a31e3daf.17207"],[]]},{"id":"d83b5ff7a2212931","type":"api-call-service","z":"f602e6ba.609d28","name":"Notify via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": alert \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1310,"y":3200,"wires":[[]]},{"id":"dd9855ca4017c8c0","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn on Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_rainfall_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":780,"wires":[[]]},{"id":"c3a696a117416327","type":"function","z":"f602e6ba.609d28","name":"Check Rainfall","func":"var rain_override = false\n\nfor (var i = 0; i < msg.payload.length; i++) {\n if (parseFloat(msg.payload[i].state) > 0.10) {\n rain_override = true\n }\n}\n\n// top = proceed\n// bottom = overridden\nif (rain_override === true) {\n return [ null, {rain_override} ];\n} \nelse {\n return [ {rain_override}, null ];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":740,"wires":[["47f1a8018e58e032"],["dd9855ca4017c8c0"]]},{"id":"27f2580e35031830","type":"api-get-history","z":"f602e6ba.609d28","name":"Rainfall 48h","server":"e1dc0b88.463bb8","version":0,"startdate":"","enddate":"","entityid":"sensor.netatmo_home_rain_sum_rain_today_inches","entityidtype":"is","useRelativeTime":true,"relativeTime":"48h","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":310,"y":740,"wires":[["c3a696a117416327"]]},{"id":"9cb8187c669c6485","type":"comment","z":"f602e6ba.609d28","name":"Rainfall Delay","info":"","x":170,"y":700,"wires":[]},{"id":"47f1a8018e58e032","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn off Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_rainfall_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":700,"wires":[[]]},{"id":"427f7fa58d86cc59","type":"inject","z":"f602e6ba.609d28","name":"*/30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1800","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":740,"wires":[["27f2580e35031830"]]},{"id":"1d9a4d0bb4645f32","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn on Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_rain_forecast_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":940,"wires":[[]]},{"id":"d9ebbaa37f5911a9","type":"comment","z":"f602e6ba.609d28","name":"Rain Forecast Delay","info":"","x":190,"y":860,"wires":[]},{"id":"eeecfc1e8864e39f","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn off Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_rain_forecast_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":860,"wires":[[]]},{"id":"89487a4efedec1db","type":"inject","z":"f602e6ba.609d28","name":"*/30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1800","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":900,"wires":[["2c45af5b3ee5cf0a"]]},{"id":"1e4b3bc7c25b294f","type":"function","z":"f602e6ba.609d28","name":"Rain Chance","func":"// Check next 4 precipitation_probability values\n// HA Template: \n// {% for j in state_attr(\"weather.kcll_daynight\",\"forecast\")[:4] %}\n// {{ j.precipitation_probability }}\n// {% endfor %}\n\nvar forecast_override = false\n\n// if (parseFloat(msg.payload) > 40) {\n// forecast_override = true\n// }\n \nfor (var i = 0; i < 4; i++) {\n if (parseFloat(msg.data.attributes.forecast[i].precipitation_probability) >= 40) {\n forecast_override = true\n }\n}\n\n// top = proceed\n// bottom = overridden\nif (forecast_override === true) {\n return [ null, {forecast_override} ];\n} \nelse {\n return [ {forecast_override}, null ];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":900,"wires":[["eeecfc1e8864e39f"],["1d9a4d0bb4645f32"]]},{"id":"2c45af5b3ee5cf0a","type":"api-current-state","z":"f602e6ba.609d28","name":"Weather","server":"e1dc0b88.463bb8","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"weather.kcll_daynight","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":300,"y":900,"wires":[["1e4b3bc7c25b294f"]]},{"id":"d7e50e7a2810667d","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn on Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_wind_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":1100,"wires":[[]]},{"id":"28936ec687ee4eb0","type":"comment","z":"f602e6ba.609d28","name":"Wind Delay","info":"","x":170,"y":1020,"wires":[]},{"id":"974833b6a2eca853","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn off Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_wind_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":1020,"wires":[[]]},{"id":"478a5a84d38ba181","type":"inject","z":"f602e6ba.609d28","name":"*/5","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":1060,"wires":[["c01fd0612615e927"]]},{"id":"c01fd0612615e927","type":"api-current-state","z":"f602e6ba.609d28","name":"Wind <= 10 MPH","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"10","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.neighbor_5in1_wind","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":330,"y":1060,"wires":[["974833b6a2eca853"],["d7e50e7a2810667d"]]},{"id":"219b37105a8304f1","type":"api-current-state","z":"f602e6ba.609d28","name":"Rainfall Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.irrigation_rainfall_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":260,"y":1580,"wires":[["dcdeabc7.780578"],["d01fbafafbb34692"]]},{"id":"e7430e17f0b24ed8","type":"api-current-state","z":"f602e6ba.609d28","name":"Rain Forecast Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.irrigation_rain_forecast_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":280,"y":1700,"wires":[["862ad27a.d347d"],["f5684be88477322f"]]},{"id":"b6e7d5b8891bba6d","type":"api-current-state","z":"f602e6ba.609d28","name":"Wind Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.irrigation_wind_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":1800,"wires":[["8d4bfe8e.ee805"],["a3d75225807b70eb"]]},{"id":"339ee0ada21856e0","type":"api-current-state","z":"f602e6ba.609d28","name":"Wind Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.irrigation_wind_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":1920,"wires":[["8d4bfe8e.ee805"],["336585d4eee0ca73"]]},{"id":"ed6e3d4225582e20","type":"api-current-state","z":"f602e6ba.609d28","name":"Rainfall Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_rainfall_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":300,"y":2740,"wires":[["f587589f.d739e8"],["f7ac7a90f3da2298"]]},{"id":"593bee0e8c958df8","type":"api-current-state","z":"f602e6ba.609d28","name":"Rain Forecast Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_rain_forecast_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":320,"y":2860,"wires":[["4fae5b92.a9cd44"],["67916c3a5554a794"]]},{"id":"d01fbafafbb34692","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Rainfall\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":1600,"wires":[[]]},{"id":"f5684be88477322f","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Rain Forecasted\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":1720,"wires":[[]]},{"id":"336585d4eee0ca73","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Wind\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":1920,"wires":[[]]},{"id":"b3c4a3638c17629e","type":"api-call-service","z":"f602e6ba.609d28","name":"Clear Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"None\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":260,"y":2000,"wires":[["815fddc0.6604c"]]},{"id":"67916c3a5554a794","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"Rain Forecasted\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":2880,"wires":[[]]},{"id":"f7ac7a90f3da2298","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"Rainfall\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":2760,"wires":[[]]},{"id":"45c5dbbbd8ce50a1","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"Automation Off\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":2560,"wires":[[]]},{"id":"2fc67b25514de5a5","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Force Run\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":450,"y":1460,"wires":[["5420d0eed32223fb"]]},{"id":"08e3098cf183e086","type":"link in","z":"f602e6ba.609d28","name":"","links":["5420d0eed32223fb"],"x":325,"y":2060,"wires":[["815fddc0.6604c"]]},{"id":"abb8777dd08aa743","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"Force Run\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":490,"y":2620,"wires":[["fdcfa1521191fa40"]]},{"id":"d8637d8d96b68fca","type":"api-call-service","z":"f602e6ba.609d28","name":"Clear Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"None\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":300,"y":2960,"wires":[["418058c4.af3158"]]},{"id":"b403eec7866aea22","type":"link in","z":"f602e6ba.609d28","name":"","links":["fdcfa1521191fa40"],"x":365,"y":3020,"wires":[["418058c4.af3158"]]}] \ No newline at end of file +[{"id":"9584418c.dafc2","type":"tab","label":"Automations","disabled":false,"info":""},{"id":"f602e6ba.609d28","type":"tab","label":"Irrigation","disabled":false,"info":""},{"id":"e1dc0b88.463bb8","type":"server","name":"Home Assistant","version":5,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"546e31ed.0db1c","type":"mqtt-broker","name":"Mosquitto","broker":"10.0.1.22","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9f81fd881d01a666","type":"position-config","name":"","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timeZoneOffset":"99","timeZoneDST":"0","stateTimeFormat":"3","stateDateFormat":"12"},{"id":"4f8f8feffed26998","type":"sqlitedb","db":"/data/amazon.db","mode":"RWC"},{"id":"2022689a.938918","type":"api-call-service","z":"9584418c.dafc2","name":"Notify Via Wrapper: Opened 1 Minute","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": \"The \" & $lowercase(msg.data.new_state.attributes.friendly_name) & \" has been opened for 1 minute\"\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":100,"wires":[[]]},{"id":"8ec438b6.4eb2e8","type":"api-current-state","z":"9584418c.dafc2","name":"Door Notify On","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.door_notify","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":480,"y":42,"wires":[["c5124616.c9bd48"],[]]},{"id":"28fa66cd.af058a","type":"trigger","z":"9584418c.dafc2","name":"Wait 1m","op1":"","op2":"1","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":100,"wires":[["2022689a.938918"]]},{"id":"9c1d9c7c.ed9c7","type":"change","z":"9584418c.dafc2","name":"Reset If Closed","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":200,"wires":[["28fa66cd.af058a","5c24f744.30fcb8","cf758271.d4fd6","5a740c2d.009864"]]},{"id":"896f5b34.7b4328","type":"api-call-service","z":"9584418c.dafc2","name":"Notify Via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": payload, \"data\": {\"priority\": 1} \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":970,"y":40,"wires":[[]]},{"id":"c5124616.c9bd48","type":"template","z":"9584418c.dafc2","name":"Opened","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{ data.new_state.attributes.friendly_name }} opened","output":"str","x":740,"y":40,"wires":[["896f5b34.7b4328"]]},{"id":"f9d93af6.184028","type":"server-state-changed","z":"9584418c.dafc2","name":"Door Opened","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.*_door$","entityidfiltertype":"regex","outputinitially":false,"state_type":"habool","haltifstate":"true","halt_if_type":"bool","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":80,"wires":[["8ec438b6.4eb2e8","28fa66cd.af058a","5c24f744.30fcb8","cf758271.d4fd6","5a740c2d.009864"],["9c1d9c7c.ed9c7"]]},{"id":"42796298.a0104c","type":"api-current-state","z":"9584418c.dafc2","name":"Heading Comparison","server":"e1dc0b88.463bb8","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.gate_heading_comparison","state_type":"habool","blockInputOverrides":true,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":600,"y":340,"wires":[["115d9f48.071141"]]},{"id":"222ebf24.bfbfa","type":"inject","z":"9584418c.dafc2","name":"Every Hour","repeat":"","crontab":"0 0-23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":340,"wires":[["3b804cf9.ada174"]]},{"id":"115d9f48.071141","type":"switch","z":"9584418c.dafc2","name":"Last Changed > 4 hours","property":"data.timeSinceChangedMs","propertyType":"msg","rules":[{"t":"gt","v":"14400000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":340,"wires":[["1eab32fa.1312bd"]]},{"id":"c444f1de.8365f","type":"api-call-service","z":"9584418c.dafc2","name":"Notify Via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": payload \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1330,"y":360,"wires":[[]]},{"id":"9aee0f4b.44e93","type":"trigger-state","z":"9584418c.dafc2","name":"Gate Offline/Online","server":"e1dc0b88.463bb8","version":2,"entityid":"sensor.gate_online_offline","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"inputs":1,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":true,"x":290,"y":400,"wires":[["cc1f97c7.911bf8"],[]]},{"id":"1fdf1fb6.8cd5d","type":"function","z":"9584418c.dafc2","name":"Create msg object","func":"var message = \"Gate reports \" + msg.payload + \"..\"\n\nreturn { payload: message,topic:msg.topic };","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1090,"y":380,"wires":[["c444f1de.8365f"]]},{"id":"cc1f97c7.911bf8","type":"api-current-state","z":"9584418c.dafc2","name":"Gate Alert On","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.gate_alert","state_type":"habool","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":680,"y":400,"wires":[["1fdf1fb6.8cd5d"],[]]},{"id":"3b804cf9.ada174","type":"api-current-state","z":"9584418c.dafc2","name":"Gate Alert On","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.gate_alert","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":380,"y":340,"wires":[["42796298.a0104c"],[]]},{"id":"1eab32fa.1312bd","type":"function","z":"9584418c.dafc2","name":"Create msg object","func":"var last_time = msg.data.timeSinceChangedMs\n\nfunction msToTime(duration) {\n var milliseconds = parseInt((duration % 1000) / 100),\n seconds = Math.floor((duration / 1000) % 60),\n minutes = Math.floor((duration / (1000 * 60)) % 60),\n hours = Math.floor((duration / (1000 * 60 * 60)) % 24);\n\n hours = (hours < 10) ? \"0\" + hours : hours;\n minutes = (minutes < 10) ? \"0\" + minutes : minutes;\n seconds = (seconds < 10) ? \"0\" + seconds : seconds;\n\n return hours + \":\" + minutes + \":\" + seconds + \".\" + milliseconds;\n}\n\nvar message = msg.data.entity_id + \" last changed \" + msToTime(last_time) + \" ago\"\n\nreturn { payload: message,topic:msg.topic };","outputs":1,"noerr":0,"x":1090,"y":340,"wires":[["c444f1de.8365f"]]},{"id":"73550501.be7fbc","type":"trigger-state","z":"9584418c.dafc2","name":"Rack Temperature","server":"e1dc0b88.463bb8","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.rack_exhaust_temperature","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"inputs":1,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"num","enableInput":true,"x":190,"y":578,"wires":[["7dff3ae1.e36a04"],[]]},{"id":"7dff3ae1.e36a04","type":"switch","z":"9584418c.dafc2","name":"Above 90?","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"95","vt":"num"},{"t":"lte","v":"90","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":410,"y":578,"wires":[["29b17ed7.fab972"],["96b5207d.407dd"]]},{"id":"88822bfe.2cc598","type":"api-call-service","z":"9584418c.dafc2","name":"Turn on Fan","server":"e1dc0b88.463bb8","version":5,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["fan.rack_fan"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":850,"y":520,"wires":[[]]},{"id":"96b5207d.407dd","type":"api-current-state","z":"9584418c.dafc2","name":"Rack Fan","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"fan.rack_fan","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":640,"y":598,"wires":[["c7ff978f.ff0728"],[]]},{"id":"b259f0eb.3e83","type":"api-call-service","z":"9584418c.dafc2","name":"Turn off fan","server":"e1dc0b88.463bb8","version":5,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["fan.rack_fan"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":1090,"y":620,"wires":[[]]},{"id":"fa90c550.d6c948","type":"inject","z":"9584418c.dafc2","name":"At 8 PM","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 20 * * 1,2,4,5,6,0","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":738,"wires":[["1457bf6605a50448"]]},{"id":"e93027cb.6a6308","type":"api-current-state","z":"9584418c.dafc2","name":"Master Bedroom Lamps On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.master_bedroom_lamps","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":700,"y":740,"wires":[["fc81cfda.29ff5"],[]]},{"id":"fc81cfda.29ff5","type":"api-call-service","z":"9584418c.dafc2","name":"Set brightness to 128","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{\"brightness\":\"128\",\"transition\":5, \"entity_id\": msg.data.entity_id}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1021,"y":738,"wires":[[]]},{"id":"c7ff978f.ff0728","type":"api-current-state","z":"9584418c.dafc2","name":"Rack fan auto off?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.rack_fan_auto_off","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":870,"y":620,"wires":[["b259f0eb.3e83"],[]]},{"id":"29b17ed7.fab972","type":"api-current-state","z":"9584418c.dafc2","name":"Rack Fan","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"fan.rack_fan","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":640,"y":520,"wires":[[],["88822bfe.2cc598"]]},{"id":"3314ec9f.ca8994","type":"server-state-changed","z":"9584418c.dafc2","name":"Garage Opened","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"cover.garage_door","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"open","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":140,"wires":[["8ec438b6.4eb2e8"],[]]},{"id":"8ee35d65.a7569","type":"api-current-state","z":"9584418c.dafc2","d":true,"name":"Kitchen Cans On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.kitchen_can_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":670,"y":980,"wires":[["5420f9c0.5356c8"],[]]},{"id":"41b918d5.7ce018","type":"api-current-state","z":"9584418c.dafc2","d":true,"name":"Kitchen Table On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.kitchen_table_light","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":670,"y":1100,"wires":[["d8ad0651.bf7a18"],[]]},{"id":"5420f9c0.5356c8","type":"api-call-service","z":"9584418c.dafc2","name":"Set brightness to 40","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{\"brightness\":\"40\",\"transition\": \"5\", \"entity_id\": msg.data.entity_id}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1020,"y":880,"wires":[[]]},{"id":"77184c93.8790d4","type":"api-current-state","z":"9584418c.dafc2","d":true,"name":"Kitchen Sink On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.kitchen_sink_light","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":670,"y":920,"wires":[["5420f9c0.5356c8"],[]]},{"id":"39a5ce57.78e3d2","type":"api-current-state","z":"9584418c.dafc2","name":"Living Room Cans On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.living_room_can_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":690,"y":860,"wires":[["5420f9c0.5356c8"],[]]},{"id":"5c24f744.30fcb8","type":"trigger","z":"9584418c.dafc2","name":"Wait 5m","op1":"","op2":"5","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":140,"wires":[["6aa388d0.707768"]]},{"id":"6aa388d0.707768","type":"api-call-service","z":"9584418c.dafc2","name":"Alexa Announce Opened","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"notify","service":"alexa_media","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"The\" & $lowercase(msg.data.new_state.attributes.friendly_name) & \"has been opened for\" & msg.payload & \" minutes.\",\"data\":{\"method\":\"all\",\"type\":\"announce\"},\"target\":[\"Office\",\"Kitchen\",\"Master\",\"Living Room\"]}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":870,"y":160,"wires":[[]]},{"id":"cf758271.d4fd6","type":"trigger","z":"9584418c.dafc2","name":"Wait 10m","op1":"","op2":"10","op1type":"nul","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":180,"wires":[["6aa388d0.707768"]]},{"id":"5a740c2d.009864","type":"trigger","z":"9584418c.dafc2","name":"Wait 15m","op1":"","op2":"15","op1type":"nul","op2type":"str","duration":"15","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":220,"wires":[["6aa388d0.707768"]]},{"id":"ea19fe14.80749","type":"api-current-state","z":"9584418c.dafc2","d":true,"name":"Entryway On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.entryway_light","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":660,"y":1040,"wires":[["5420f9c0.5356c8"],[]]},{"id":"ea2604f9.4cdf98","type":"api-current-state","z":"9584418c.dafc2","name":"Living Room Sconces On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.living_room_sconces","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":700,"y":800,"wires":[["fc81cfda.29ff5"],[]]},{"id":"8a82f465.846018","type":"comment","z":"9584418c.dafc2","name":"100% = 255","info":"","x":990,"y":811,"wires":[]},{"id":"d8ad0651.bf7a18","type":"api-call-service","z":"9584418c.dafc2","name":"Set brightness to 80","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{\"brightness\":\"80\",\"transition\": \"5\", \"entity_id\": msg.data.entity_id}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1020,"y":960,"wires":[[]]},{"id":"86bc310cbc0562af","type":"inject","z":"9584418c.dafc2","name":"At 10PM","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":1260,"wires":[["2fb6a7afb6502a32","8c55985bffebd56a"]]},{"id":"2fb6a7afb6502a32","type":"api-call-service","z":"9584418c.dafc2","name":"Front Porch Lights to 40","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.front_porch_lights"],"data":"{\"brightness\":\"40\",\"transition\":5}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":430,"y":1260,"wires":[[]]},{"id":"3f2a2e4d99057b69","type":"server-state-changed","z":"9584418c.dafc2","name":"Front Door Motion","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.front_door_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"habool","haltifstate":"true","halt_if_type":"bool","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":190,"y":1440,"wires":[["17b35d69307a8455"],[]]},{"id":"67312d79a5108126","type":"api-current-state","z":"9584418c.dafc2","name":"Front Porch On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.front_porch_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":650,"y":1400,"wires":[["3e399d83e4e7f4c3"],[]]},{"id":"3e399d83e4e7f4c3","type":"api-call-service","z":"9584418c.dafc2","name":"Front Porch Lights to 254","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.front_porch_lights"],"data":"{\"brightness\":\"254\",\"transition\":2}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":1400,"wires":[["59f5bc2571b0f12f"]]},{"id":"59f5bc2571b0f12f","type":"delay","z":"9584418c.dafc2","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":580,"y":1500,"wires":[["c68c969a6b8c2833"]]},{"id":"c68c969a6b8c2833","type":"api-call-service","z":"9584418c.dafc2","name":"Front Porch Lights to 40","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.front_porch_lights"],"data":"{\"brightness\":\"40\",\"transition\":5}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":810,"y":1500,"wires":[[]]},{"id":"d9cc182cc3eb2a93","type":"inject","z":"9584418c.dafc2","name":"At 10 PM","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 22 * * 3","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":780,"wires":[["1457bf6605a50448"]]},{"id":"b1a99d9698d831b2","type":"server-state-changed","z":"9584418c.dafc2","name":"433 Motion","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.433_front_porch_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":1500,"wires":[["17b35d69307a8455","d11c183fff8d848d"]]},{"id":"17b35d69307a8455","type":"within-time-switch","z":"9584418c.dafc2","name":"","nameInt":"","positionConfig":"9f81fd881d01a666","startTime":"22:00","startTimeType":"entered","startOffset":0,"startOffsetType":"none","startOffsetMultiplier":60000,"endTime":"sunriseStart","endTimeType":"pdsTime","endOffset":"-30","endOffsetType":"num","endOffsetMultiplier":60000,"timeRestrictions":0,"timeRestrictionsType":"none","timeDays":"*","timeOnlyOddDays":false,"timeOnlyEvenDays":false,"timeOnlyOddWeeks":false,"timeOnlyEvenWeeks":false,"timeMonths":"*","timedatestart":"","timedateend":"","propertyStart":"","propertyStartType":"none","propertyStartCompare":"true","propertyStartThreshold":"","propertyStartThresholdType":"num","startTimeAlt":"","startTimeAltType":"entered","startOffsetAlt":0,"startOffsetAltType":"none","startOffsetAltMultiplier":60000,"propertyEnd":"","propertyEndType":"none","propertyEndCompare":"true","propertyEndThreshold":"","propertyEndThresholdType":"num","endTimeAlt":"","endTimeAltType":"entered","endOffsetAlt":0,"endOffsetAltType":"none","endOffsetAltMultiplier":60000,"withinTimeValue":"","withinTimeValueType":"msgInput","outOfTimeValue":"","outOfTimeValueType":"msgInput","tsCompare":"0","x":420,"y":1440,"wires":[["67312d79a5108126"],[]]},{"id":"d11c183fff8d848d","type":"change","z":"9584418c.dafc2","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":1500,"wires":[["59f5bc2571b0f12f"]]},{"id":"a9a323de66b6f772","type":"http request","z":"9584418c.dafc2","name":"Get Aircraft","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://vrs:8080/VirtualRadar/AircraftList.json","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"application/json"}],"x":410,"y":1760,"wires":[["7da69a7e8ecadc7c","91afebbf8b9edf05","4ca1a5ad47ce7a18","2cd08c8da06afaf6"]]},{"id":"ee139512bcad0966","type":"inject","z":"9584418c.dafc2","name":"Every 10 Seconds","props":[],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":210,"y":1760,"wires":[["a9a323de66b6f772"]]},{"id":"7da69a7e8ecadc7c","type":"function","z":"9584418c.dafc2","name":"Amazon","func":"var alert = {}\nvar message = \"Airborne:\\n\"\n\nfor (var i = 0; i < msg.payload.acList.length; i++) {\n if (typeof msg.payload.acList[i].Reg !== \"undefined\" && typeof msg.payload.acList[i].Man !== \"undefined\") {\n if (msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n //if (msg.payload.acList[i].Reg.endsWith(\"PA\") && msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n alert[msg.payload.acList[i].Reg] = msg.payload.acList[i].Icao\n }\n }\n}\n\nif (Object.keys(alert).length > 0) {\n for (const [key, value] of Object.entries(alert)) {\n message += key + \": https://globe.adsbexchange.com/?icao=\" + value + \"\\n\"\n }\n return { payload: message + \"https://vrs.aneis.ch\" }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":1740,"wires":[["5684b08aacd6d225"]]},{"id":"26e32b1d7824356a","type":"api-call-service","z":"9584418c.dafc2","name":"Notify Via Signal","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"notify","service":"signal_adsb","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": payload \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1000,"y":1740,"wires":[[]]},{"id":"3a82b835.c57d48","type":"function","z":"9584418c.dafc2","name":"Rate Limiter","func":"var interval = (1000*60*10); // minimum interval between messages (ms)\ncontext.lastTime = context.lastTime || 0;\n\nvar now = Date.now();\n\nif (now-context.lastTime > interval) {\n context.lastTime = now;\n return msg;\n} else {\n return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":1680,"wires":[["26e32b1d7824356a"]]},{"id":"91afebbf8b9edf05","type":"function","z":"9584418c.dafc2","name":"Interesting Tail #","func":"var alert = {}\nvar message = \"Interesting:\\n\"\n\nvar interesting = [\"N518GS\", \"N628TS\", \"82-8000\"]\n\nfor (var i = 0; i < msg.payload.acList.length; i++) {\n if (typeof msg.payload.acList[i].Reg !== \"undefined\") {\n if (interesting.includes(msg.payload.acList[i].Reg)) {\n alert[msg.payload.acList[i].Reg] = msg.payload.acList[i].Icao\n }\n }\n}\n\nif (Object.keys(alert).length > 0) {\n for (const [key, value] of Object.entries(alert)) {\n message += key + \": https://globe.adsbexchange.com/?icao=\" + value + \"\\n\"\n }\n return { payload: message + \"https://vrs.aneis.ch\" }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":1680,"wires":[["3a82b835.c57d48"]]},{"id":"5684b08aacd6d225","type":"function","z":"9584418c.dafc2","name":"Rate Limiter","func":"var interval = (1000*60); // minimum interval between messages (ms)\ncontext.lastTime = context.lastTime || 0;\n\nvar now = Date.now();\n\nif (now-context.lastTime > interval) {\n context.lastTime = now;\n return msg;\n} else {\n return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":1740,"wires":[["26e32b1d7824356a"]]},{"id":"4ca1a5ad47ce7a18","type":"function","z":"9584418c.dafc2","name":"Amazon Landing","func":"var alert = {}\nvar message = \"Landing:\\n\"\n\nfor (var i = 0; i < msg.payload.acList.length; i++) {\n if (typeof msg.payload.acList[i].Reg !== \"undefined\" && typeof msg.payload.acList[i].Man !== \"undefined\") {\n //if (msg.payload.acList[i].Reg.endsWith(\"PA\") && msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n if (msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n if (msg.payload.acList[i].Alt < 50){\n alert[msg.payload.acList[i].Reg] = msg.payload.acList[i].Icao\n }\n }\n }\n}\n\nif (Object.keys(alert).length > 0) {\n for (const [key, value] of Object.entries(alert)) {\n message += key + \": https://globe.adsbexchange.com/?icao=\" + value + \"\\n\"\n }\n return { payload: message + \"https://vrs.aneis.ch\" }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":1800,"wires":[["ba68e03143ba4af8"]]},{"id":"ba68e03143ba4af8","type":"function","z":"9584418c.dafc2","name":"Rate Limiter","func":"var interval = (1000*60); // minimum interval between messages (ms)\ncontext.lastTime = context.lastTime || 0;\n\nvar now = Date.now();\n\nif (now-context.lastTime > interval) {\n context.lastTime = now;\n return msg;\n} else {\n return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":1800,"wires":[["26e32b1d7824356a"]]},{"id":"5f1d1b471a1c7cbb","type":"sqlite","z":"9584418c.dafc2","mydb":"4f8f8feffed26998","sqlquery":"msg.topic","sql":"","name":"Amazon","x":800,"y":1860,"wires":[["ea911291f04c7d18"]]},{"id":"2cd08c8da06afaf6","type":"function","z":"9584418c.dafc2","name":"Write Amazon Landing","func":"var sql = \"\"\n\nfor (var i = 0; i < msg.payload.acList.length; i++) {\n var latlong = \"0,0\"\n if (typeof msg.payload.acList[i].Reg !== \"undefined\" && typeof msg.payload.acList[i].Lat !== \"undefined\" && typeof msg.payload.acList[i].Long !== \"undefined\") {\n //if (msg.payload.acList[i].Reg.endsWith(\"PA\") && msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n if (msg.payload.acList[i].Man.toLowerCase().includes(\"amazon\")) {\n if (msg.payload.acList[i].Alt < 50){\n latlong = msg.payload.acList[i].Lat + \",\" + msg.payload.acList[i].Long.toString()\n sql += `INSERT INTO deliveries (timestamp, registration, latlong, altitude) VALUES (\"${Date.now()}\", \"${msg.payload.acList[i].Reg}\", \"${latlong}\", \"${msg.payload.acList[i].Alt}\"); `\n }\n }\n }\n}\n\nif (sql.length > 0){\n msg.topic = sql\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":1860,"wires":[["5f1d1b471a1c7cbb"]]},{"id":"ea911291f04c7d18","type":"api-call-service","z":"9584418c.dafc2","name":"Generate Heatmap","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"shell_command","service":"generate_heatmap","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1010,"y":1860,"wires":[[]]},{"id":"cde7b3c9ca39891b","type":"link in","z":"9584418c.dafc2","name":"","links":["1457bf6605a50448"],"x":345,"y":760,"wires":[["e93027cb.6a6308","ea2604f9.4cdf98","39a5ce57.78e3d2","77184c93.8790d4","8ee35d65.a7569","ea19fe14.80749","41b918d5.7ce018"]]},{"id":"1457bf6605a50448","type":"link out","z":"9584418c.dafc2","name":"","links":["cde7b3c9ca39891b"],"x":315,"y":760,"wires":[]},{"id":"8c55985bffebd56a","type":"api-call-service","z":"9584418c.dafc2","name":"Front Sconces Off","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.front_sconces"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":410,"y":1200,"wires":[[]]},{"id":"fae7fa701710e258","type":"server-state-changed","z":"9584418c.dafc2","name":"Front Door Unlock","server":"e1dc0b88.463bb8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"lock.front_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unlocked","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":190,"y":1380,"wires":[["17b35d69307a8455"],[]]},{"id":"54bad548.7e9fcc","type":"ha-get-entities","z":"f602e6ba.609d28","name":"Get \"On\" Sprinklers","server":"e1dc0b88.463bb8","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"switch.irrigation","valueType":"str"},{"property":"entity_id","logic":"does_not_include","value":"switch.irrigation_master_valve,switch.irrigation_24v_power,switch.irrigation_drip","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":370,"y":100,"wires":[["bcbf413e.7b188"]]},{"id":"5a10cd93.8e94b4","type":"inject","z":"f602e6ba.609d28","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":100,"wires":[["54bad548.7e9fcc"]]},{"id":"a77808ff.3f1288","type":"switch","z":"f602e6ba.609d28","name":"On Longer than 26 minutes?","property":"payload[0].timeSinceChangedMs","propertyType":"msg","rules":[{"t":"gte","v":"1600000","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":700,"y":60,"wires":[["54ae6ec3.1bc63"]]},{"id":"54ae6ec3.1bc63","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload[0].entity_id }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":960,"y":60,"wires":[[]]},{"id":"bcbf413e.7b188","type":"switch","z":"f602e6ba.609d28","name":"More Than 0 Entities?","property":"payload","propertyType":"msg","rules":[{"t":"nempty"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":160,"wires":[["a77808ff.3f1288","3b848bce.76aea4"],["c42e6d62.7a24c"]]},{"id":"3b848bce.76aea4","type":"change","z":"f602e6ba.609d28","name":"Reset Delay","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":100,"wires":[["cdd3b7ef.04a618"]]},{"id":"43dedcca.ac7734","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Master","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1460,"y":180,"wires":[[]]},{"id":"b4335c36.09adb","type":"comment","z":"f602e6ba.609d28","name":"Set Auto-Off for Sprinkler","info":"","x":210,"y":40,"wires":[]},{"id":"c42e6d62.7a24c","type":"api-current-state","z":"f602e6ba.609d28","name":"Master On?","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.irrigation_master_valve","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":650,"y":160,"wires":[["cdd3b7ef.04a618"],["3b848bce.76aea4"]]},{"id":"d269f175.c9dc6","type":"server-events","z":"f602e6ba.609d28","name":"Custom Water Event Fired","server":"e1dc0b88.463bb8","version":2,"eventType":"irrigation_custom_water","exposeToHomeAssistant":false,"eventData":"","haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":170,"y":320,"wires":[["883f2c00.1d94e8"]]},{"id":"3367e45f.cc981c","type":"function","z":"f602e6ba.609d28","name":"++","func":"if ( (msg.i += 1) < msg.zones.length ) return msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":380,"wires":[["116d5bb3.ee92a4"]]},{"id":"116d5bb3.ee92a4","type":"function","z":"f602e6ba.609d28","name":"For Each","func":"if( msg.i == undefined ) msg.i = 0;\n\nmsg.payload = msg.zones[ msg.i ];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":820,"y":320,"wires":[["565ee5c1.561bfc","80df47d5.602888","e2c37b65c5582c2b"]]},{"id":"80df47d5.602888","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":320,"wires":[[]]},{"id":"fb46876c.845298","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1300,"y":380,"wires":[["98eeafa7.bd2b9","860a4c61d7557dc9"]]},{"id":"98eeafa7.bd2b9","type":"delay","z":"f602e6ba.609d28","name":"Delay 5","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":960,"y":460,"wires":[["3367e45f.cc981c"]]},{"id":"7c3d09ca.229958","type":"comment","z":"f602e6ba.609d28","name":"Fired From HA Python Script or Automation","info":"","x":270,"y":260,"wires":[]},{"id":"565ee5c1.561bfc","type":"change","z":"f602e6ba.609d28","name":"Set Delay Variable","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload.time* 60000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":380,"wires":[["22a20603.86a06a"]]},{"id":"22a20603.86a06a","type":"stoptimer-varidelay","z":"f602e6ba.609d28","duration":"5","durationType":"num","units":"Millisecond","payloadtype":"num","payloadval":"0","name":"Delay","reporting":"every_second","persist":false,"x":1070,"y":380,"wires":[["fb46876c.845298"],[],["a8d96e.1f00969"]]},{"id":"a8d96e.1f00969","type":"mqtt out","z":"f602e6ba.609d28","name":"Publish Time Remaining","topic":"sensor/irrigation_time_remaining","qos":"","retain":"","broker":"546e31ed.0db1c","x":1330,"y":320,"wires":[]},{"id":"cdd3b7ef.04a618","type":"trigger","z":"f602e6ba.609d28","name":"Wait 1m","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":860,"y":120,"wires":[["5e9007a27732bba9"]]},{"id":"3b838f49.e10c","type":"comment","z":"f602e6ba.609d28","name":"Garden Drip - Bib timer start 7:58 and runs for 55 min - Handled by BHyve Now.","info":"","x":380,"y":540,"wires":[]},{"id":"3b656b89.1ac154","type":"inject","z":"f602e6ba.609d28","name":"5:00 Attempt","props":[{"p":"payload"}],"repeat":"","crontab":"00 05 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"zone\":\"switch.irrigation_front_beds\",\"time\":10,\"name\":\"Front beds\"},{\"zone\":\"switch.irrigation_front_lawn\",\"time\":20,\"name\":\"Front lawn\"},{\"zone\":\"switch.irrigation_left_and_main_rear_lawn\",\"time\":20,\"name\":\"Left and main rear lawn\"},{\"zone\":\"switch.irrigation_front_and_right_rear_lawn\",\"time\":20,\"name\":\"Front and right rear lawn\"},{\"zone\":\"switch.irrigation_side_lawn\",\"time\":20,\"name\":\"Side lawn\"}]","payloadType":"json","x":180,"y":1380,"wires":[["493b435f.c9851c"]]},{"id":"fdb6234.55064e","type":"function","z":"f602e6ba.609d28","name":"++","func":"if ( (msg.i += 1) < msg.zones.length ) return msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":2280,"wires":[["857c8b4f.d19808"]]},{"id":"857c8b4f.d19808","type":"function","z":"f602e6ba.609d28","name":"For Each","func":"if( msg.i == undefined ) msg.i = 0;\n\nmsg.payload = msg.zones[ msg.i ];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":2220,"wires":[["5ebabb53.f9e834"]]},{"id":"a60b0459.b34598","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1220,"y":2220,"wires":[["12f649bd.98f9f6"]]},{"id":"a082bd08.49c44","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":2400,"wires":[["6c216ad5.e58054"]]},{"id":"6c216ad5.e58054","type":"delay","z":"f602e6ba.609d28","name":"Delay 10","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":540,"y":2340,"wires":[["fdb6234.55064e"]]},{"id":"12f649bd.98f9f6","type":"change","z":"f602e6ba.609d28","name":"Set Delay Variable","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload.time* 60000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":2280,"wires":[["d029ec72.ae401"]]},{"id":"5eaebc41.9491c4","type":"switch","z":"f602e6ba.609d28","name":"Last Ran >= Template Hrs Ago","property":"data.continue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":2280,"wires":[["b7ac1681.a64af8"],["fdb6234.55064e"]]},{"id":"a9b82dcc.1843e","type":"api-render-template","z":"f602e6ba.609d28","name":"Evaluate Template","server":"e1dc0b88.463bb8","version":0,"template":"","resultsLocation":"data.continue","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":890,"y":2160,"wires":[["a298ba43aff58e18"]]},{"id":"5ebabb53.f9e834","type":"template","z":"f602e6ba.609d28","name":"Template: Zone Last Ran >= 71 hours","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{%- set entity_name = \"input_datetime{{ payload.zone }}\" | regex_replace(find='switch', replace='', ignorecase=False) -%}\n{%- set time = (as_timestamp(now()) - as_timestamp(states(entity_name+\"_last_start\"))) | int -%}\n{% if time >= 71*3600 %}1{% else %}0{% endif %}","output":"str","x":590,"y":2160,"wires":[["a9b82dcc.1843e"]]},{"id":"b7ac1681.a64af8","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Master Valve","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":900,"y":2220,"wires":[["3c20bed9.9f3812"]]},{"id":"d029ec72.ae401","type":"stoptimer-varidelay","z":"f602e6ba.609d28","duration":"5","durationType":"num","units":"Millisecond","payloadtype":"num","payloadval":"0","name":"Delay","reporting":"every_second","persist":false,"ignoretimerpass":false,"x":850,"y":2340,"wires":[["a082bd08.49c44","8a25411f.1fe15"],[],["df183b71.5ccca8"]]},{"id":"df183b71.5ccca8","type":"mqtt out","z":"f602e6ba.609d28","name":"Publish Time Remaining","topic":"sensor/irrigation_time_remaining","qos":"","retain":"","broker":"546e31ed.0db1c","x":1130,"y":2360,"wires":[]},{"id":"da687baa.d8ed88","type":"api-call-service","z":"f602e6ba.609d28","name":"Notify via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": alert \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1330,"y":2320,"wires":[[]]},{"id":"8a25411f.1fe15","type":"function","z":"f602e6ba.609d28","name":"Create msg object","func":"var message = \"Sprinkler auto-run: \" + msg.payload.name + \" ran for \" + msg.payload.time + \" minutes\"\n\nreturn { alert: message };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1110,"y":2320,"wires":[["da687baa.d8ed88"]]},{"id":"3c20bed9.9f3812","type":"delay","z":"f602e6ba.609d28","name":"2s","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1070,"y":2220,"wires":[["a60b0459.b34598"]]},{"id":"493b435f.c9851c","type":"api-current-state","z":"f602e6ba.609d28","name":"Schedule Enabled","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.lawn_irrigation_scheduling","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":410,"y":1380,"wires":[["8c060f00.cf577"],["7b12e66f.57d068"]]},{"id":"7b12e66f.57d068","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Automation Off\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":1400,"wires":[[]]},{"id":"8c060f00.cf577","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","576b66fa1bd202a3"],"x":595,"y":1360,"wires":[]},{"id":"4422f61c.847d88","type":"link in","z":"f602e6ba.609d28","name":"","links":["3ff9ce03ef7b554b"],"x":135,"y":1580,"wires":[["219b37105a8304f1"]]},{"id":"dcdeabc7.780578","type":"link out","z":"f602e6ba.609d28","name":"","links":["1eaa857e.b6b8db","c90fd5e6.c5c678","b8fe96458628f202"],"x":595,"y":1560,"wires":[]},{"id":"722d03d6.2ff77c","type":"link in","z":"f602e6ba.609d28","name":"","links":["8d4bfe8e.ee805","d67106b42368e630"],"x":135,"y":2000,"wires":[["b3c4a3638c17629e"]]},{"id":"af4788fe.215ba8","type":"link out","z":"f602e6ba.609d28","name":"","links":["405789f7.0727a8","eb1a5268c1aec843","9896327569c234da"],"x":595,"y":2000,"wires":[]},{"id":"405789f7.0727a8","type":"link in","z":"f602e6ba.609d28","d":true,"name":"","links":["af4788fe.215ba8"],"x":135,"y":2160,"wires":[["9941ac76.663b1"]]},{"id":"9941ac76.663b1","type":"template","z":"f602e6ba.609d28","name":"Zone Settings Lawn","field":"zones","fieldType":"msg","format":"json","syntax":"mustache","template":"[\n {\n \"zone\": \"switch.irrigation_front_lawn\",\n \"time\": 25,\n \"name\": \"Front lawn\"\n },\n {\n \"zone\": \"switch.irrigation_left_and_main_rear_lawn\",\n \"time\": 25,\n \"name\": \"Left and main rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_front_and_right_rear_lawn\",\n \"time\": 25,\n \"name\": \"Front and right rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_side_lawn\",\n \"time\": 20,\n \"name\": \"Side lawn\"\n }\n]","output":"json","x":280,"y":2160,"wires":[["857c8b4f.d19808"]]},{"id":"5933da9a.d9f024","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Lawn Zones","info":"","x":360,"y":2120,"wires":[]},{"id":"c90fd5e6.c5c678","type":"link in","z":"f602e6ba.609d28","name":"","links":["dcdeabc7.780578","89d715ddf12d2195"],"x":135,"y":1700,"wires":[["e7430e17f0b24ed8"]]},{"id":"862ad27a.d347d","type":"link out","z":"f602e6ba.609d28","name":"","links":["83edf648.3f9ed8"],"x":595,"y":1680,"wires":[]},{"id":"808e6a81.92e2e8","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Master Valve","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":440,"y":380,"wires":[["e42ff3d9.593dc"]]},{"id":"883f2c00.1d94e8","type":"api-current-state","z":"f602e6ba.609d28","name":"24v Power","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.irrigation_24v_power","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":230,"y":380,"wires":[["808e6a81.92e2e8"],[]]},{"id":"e42ff3d9.593dc","type":"delay","z":"f602e6ba.609d28","name":"Delay 5","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":460,"y":320,"wires":[["76160bc4.8cd644"]]},{"id":"76160bc4.8cd644","type":"change","z":"f602e6ba.609d28","name":"","rules":[{"t":"set","p":"zones","pt":"msg","to":"payload.event.zones","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":320,"wires":[["116d5bb3.ee92a4"]]},{"id":"83edf648.3f9ed8","type":"link in","z":"f602e6ba.609d28","name":"","links":["862ad27a.d347d","1bb3825011174363"],"x":135,"y":1800,"wires":[["b6e7d5b8891bba6d"]]},{"id":"8d4bfe8e.ee805","type":"link out","z":"f602e6ba.609d28","name":"","links":["722d03d6.2ff77c"],"x":595,"y":1820,"wires":[]},{"id":"70dfaa6a.be6a74","type":"inject","z":"f602e6ba.609d28","d":true,"name":"08:00","props":[{"p":"payload"}],"repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"zone\":\"switch.irrigation_front_beds\",\"time\":10,\"name\":\"Front beds\"},{\"zone\":\"switch.irrigation_front_lawn\",\"time\":20,\"name\":\"Front lawn\"},{\"zone\":\"switch.irrigation_left_and_main_rear_lawn\",\"time\":20,\"name\":\"Left and main rear lawn\"},{\"zone\":\"switch.irrigation_front_and_right_rear_lawn\",\"time\":20,\"name\":\"Front and right rear lawn\"},{\"zone\":\"switch.irrigation_side_lawn\",\"time\":20,\"name\":\"Side lawn\"}]","payloadType":"json","x":140,"y":580,"wires":[["c05e6454.2f85b8"]]},{"id":"c05e6454.2f85b8","type":"api-current-state","z":"f602e6ba.609d28","name":"Drip Irrigation Enabled","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.drip_irrigation_scheduling","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":320,"y":580,"wires":[["3461c5c.34e3d3a"],[]]},{"id":"3461c5c.34e3d3a","type":"api-call-service","z":"f602e6ba.609d28","name":"On","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_drip"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":490,"y":580,"wires":[["293b659b.8348ea"]]},{"id":"acd1bab8.aee3d8","type":"api-call-service","z":"f602e6ba.609d28","name":"Off","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.irrigation_drip"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":730,"y":580,"wires":[["c68eb12d.9599a"]]},{"id":"293b659b.8348ea","type":"delay","z":"f602e6ba.609d28","name":"30 Min","pauseType":"delay","timeout":"30","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":610,"y":580,"wires":[["acd1bab8.aee3d8"]]},{"id":"b60d2f74.cc7f6","type":"api-call-service","z":"f602e6ba.609d28","name":"On","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_drip"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":970,"y":580,"wires":[["da67a902.f7ef48"]]},{"id":"ed0380b5.fa017","type":"api-call-service","z":"f602e6ba.609d28","name":"Off","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.irrigation_drip"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1210,"y":580,"wires":[[]]},{"id":"da67a902.f7ef48","type":"delay","z":"f602e6ba.609d28","name":"5 Sec","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1090,"y":580,"wires":[["ed0380b5.fa017"]]},{"id":"c68eb12d.9599a","type":"delay","z":"f602e6ba.609d28","name":"30 Min","pauseType":"delay","timeout":"30","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":850,"y":580,"wires":[["b60d2f74.cc7f6"]]},{"id":"b76b5030.7d402","type":"comment","z":"f602e6ba.609d28","name":"Release Pressure","info":"","x":900,"y":540,"wires":[]},{"id":"edc724f1.d2e458","type":"comment","z":"f602e6ba.609d28","name":"Lawn Attempt","info":"","x":170,"y":1320,"wires":[]},{"id":"583f46a3.fc4c38","type":"inject","z":"f602e6ba.609d28","name":"8:00 Attempt","props":[{"p":"payload"}],"repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"zone\":\"switch.irrigation_front_beds\",\"time\":10,\"name\":\"Front beds\"},{\"zone\":\"switch.irrigation_front_lawn\",\"time\":20,\"name\":\"Front lawn\"},{\"zone\":\"switch.irrigation_left_and_main_rear_lawn\",\"time\":20,\"name\":\"Left and main rear lawn\"},{\"zone\":\"switch.irrigation_front_and_right_rear_lawn\",\"time\":20,\"name\":\"Front and right rear lawn\"},{\"zone\":\"switch.irrigation_side_lawn\",\"time\":20,\"name\":\"Side lawn\"}]","payloadType":"json","x":220,"y":3120,"wires":[["d9147878.b61cf8"]]},{"id":"d9147878.b61cf8","type":"api-current-state","z":"f602e6ba.609d28","name":"Schedule Enabled","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.front_bed_irrigation_scheduling","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":450,"y":3120,"wires":[["c7e5552e.7f8a08"],["45c5dbbbd8ce50a1"]]},{"id":"c7e5552e.7f8a08","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","f6881b4bf93c27c5"],"x":635,"y":3100,"wires":[]},{"id":"6bcf06fb.9ca748","type":"link in","z":"f602e6ba.609d28","name":"","links":["4f2902edc77f2d3b"],"x":175,"y":3320,"wires":[["ed6e3d4225582e20"]]},{"id":"f587589f.d739e8","type":"link out","z":"f602e6ba.609d28","name":"","links":["1eaa857e.b6b8db","9d851699.6a8458"],"x":635,"y":3300,"wires":[]},{"id":"d9d17e8f.590e6","type":"link in","z":"f602e6ba.609d28","name":"","links":["4fae5b92.a9cd44"],"x":175,"y":3540,"wires":[["d8637d8d96b68fca"]]},{"id":"d9f893eb.834f3","type":"link out","z":"f602e6ba.609d28","name":"","links":["5ce1803b.06628"],"x":635,"y":3540,"wires":[]},{"id":"9d851699.6a8458","type":"link in","z":"f602e6ba.609d28","name":"","links":["f587589f.d739e8"],"x":175,"y":3440,"wires":[["593bee0e8c958df8"]]},{"id":"4fae5b92.a9cd44","type":"link out","z":"f602e6ba.609d28","name":"","links":["d9d17e8f.590e6"],"x":635,"y":3420,"wires":[]},{"id":"aaacee72.fc35a","type":"comment","z":"f602e6ba.609d28","name":"Front Beds Attempt","info":"","x":230,"y":3060,"wires":[]},{"id":"a2ab7368.923fb","type":"template","z":"f602e6ba.609d28","name":"Zone Settings Front Beds","field":"zones","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n \"zone\": \"switch.irrigation_front_beds\",\n \"time\": 15,\n \"name\": \"Front beds\"\n}","output":"json","x":290,"y":3720,"wires":[["62b5545bc6d6e627"]]},{"id":"a31e3daf.17207","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Master Valve","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":3720,"wires":[["21ced698.708b5a"]]},{"id":"21ced698.708b5a","type":"delay","z":"f602e6ba.609d28","name":"2s","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":770,"y":3720,"wires":[["c661d489.9c9bc8"]]},{"id":"c661d489.9c9bc8","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": msg.zones.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":3720,"wires":[["accc6697.196268"]]},{"id":"accc6697.196268","type":"change","z":"f602e6ba.609d28","name":"Set Delay Variable","rules":[{"t":"set","p":"delay","pt":"msg","to":"msg.zones.time* 60000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":3720,"wires":[["487ff788.8c5c98"]]},{"id":"487ff788.8c5c98","type":"stoptimer-varidelay","z":"f602e6ba.609d28","duration":"5","durationType":"num","units":"Millisecond","payloadtype":"num","payloadval":"0","name":"Delay","reporting":"every_second","persist":false,"ignoretimerpass":false,"x":890,"y":3780,"wires":[["2238b09b.1b5b5","9129b06e.d8925"],[],["84258ddd.41da4"]]},{"id":"2238b09b.1b5b5","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": msg.zones.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":3860,"wires":[[]]},{"id":"84258ddd.41da4","type":"mqtt out","z":"f602e6ba.609d28","name":"Publish Time Remaining","topic":"sensor/irrigation_time_remaining","qos":"","retain":"","broker":"546e31ed.0db1c","x":1170,"y":3840,"wires":[]},{"id":"9129b06e.d8925","type":"function","z":"f602e6ba.609d28","name":"Create msg object","func":"var message = \"Sprinkler auto-run: \" + msg.zones.name + \" ran for \" + msg.zones.time + \" minutes\"\n\nreturn { alert: message };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1090,"y":3780,"wires":[["d83b5ff7a2212931"]]},{"id":"5ce1803b.06628","type":"link in","z":"f602e6ba.609d28","name":"","links":["db46e0c1.f9ab5","d9f893eb.834f3"],"x":135,"y":3720,"wires":[["a2ab7368.923fb"]]},{"id":"2afa6b1a.8012b4","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Front Beds","info":"","x":350,"y":3680,"wires":[]},{"id":"815fddc0.6604c","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On 24v","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_24v_power"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":470,"y":2000,"wires":[["af4788fe.215ba8"]]},{"id":"418058c4.af3158","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On 24v","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_24v_power"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":510,"y":3540,"wires":[["d9f893eb.834f3"]]},{"id":"1ae21386.a831bc","type":"inject","z":"f602e6ba.609d28","name":"10:00 24v Off","props":[],"repeat":"","crontab":"00 10 * * *","once":false,"onceDelay":0.1,"topic":"","x":180,"y":1200,"wires":[["117145a7.67e99a","882aff35f788008b"]]},{"id":"117145a7.67e99a","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off 24v","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.irrigation_24v_power"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":390,"y":1160,"wires":[[]]},{"id":"63f07877e73b952a","type":"switch","z":"f602e6ba.609d28","name":"More Than 0 Entities?","property":"payload","propertyType":"msg","rules":[{"t":"nempty"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":2,"x":1080,"y":180,"wires":[[],["749afd72791a5127"]]},{"id":"5e9007a27732bba9","type":"ha-get-entities","z":"f602e6ba.609d28","name":"Get \"On\" Sprinklers","server":"e1dc0b88.463bb8","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"switch.irrigation","valueType":"str"},{"property":"entity_id","logic":"does_not_include","value":"switch.irrigation_master_valve,switch.irrigation_24v_power","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":1050,"y":120,"wires":[["63f07877e73b952a"]]},{"id":"06d6255efdc31c47","type":"api-current-state","z":"f602e6ba.609d28","name":"Force Run","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_force_run","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":250,"y":1480,"wires":[["2fc67b25514de5a5"],["3ff9ce03ef7b554b"]]},{"id":"5420d0eed32223fb","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","08e3098cf183e086"],"x":595,"y":1460,"wires":[]},{"id":"3ff9ce03ef7b554b","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","4422f61c.847d88","8524a273a6a8ffd0"],"x":595,"y":1500,"wires":[]},{"id":"576b66fa1bd202a3","type":"link in","z":"f602e6ba.609d28","name":"","links":["8c060f00.cf577"],"x":135,"y":1480,"wires":[["06d6255efdc31c47"]]},{"id":"7350c911a0b1a86d","type":"api-current-state","z":"f602e6ba.609d28","name":"Force Run","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_force_run","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":290,"y":3220,"wires":[["abb8777dd08aa743"],["4f2902edc77f2d3b"]]},{"id":"fdcfa1521191fa40","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","b403eec7866aea22"],"x":635,"y":3200,"wires":[]},{"id":"4f2902edc77f2d3b","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","6bcf06fb.9ca748"],"x":635,"y":3240,"wires":[]},{"id":"f6881b4bf93c27c5","type":"link in","z":"f602e6ba.609d28","name":"","links":["c7e5552e.7f8a08"],"x":175,"y":3220,"wires":[["7350c911a0b1a86d"]]},{"id":"882aff35f788008b","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Force Run","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_force_run"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":410,"y":1220,"wires":[[]]},{"id":"a298ba43aff58e18","type":"api-current-state","z":"f602e6ba.609d28","name":"Force Run","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_force_run","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":610,"y":2220,"wires":[["b7ac1681.a64af8"],["5eaebc41.9491c4"]]},{"id":"a3d75225807b70eb","type":"delay","z":"f602e6ba.609d28","name":"30 Minute Delay","pauseType":"delay","timeout":"30","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":280,"y":1860,"wires":[["339ee0ada21856e0"]]},{"id":"e2c37b65c5582c2b","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Start/Stop tracking","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["automation.store_sprinkler_start_stop_times"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":280,"wires":[[]]},{"id":"860a4c61d7557dc9","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Start/Stop tracking","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["automation.store_sprinkler_start_stop_times"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1340,"y":440,"wires":[[]]},{"id":"061b74f643477dd9","type":"switch","z":"f602e6ba.609d28","name":"More Than 0 Entities?","property":"payload","propertyType":"msg","rules":[{"t":"nempty"},{"t":"empty"}],"checkall":"true","repair":false,"outputs":2,"x":1360,"y":120,"wires":[["43dedcca.ac7734"],[]]},{"id":"749afd72791a5127","type":"trigger","z":"f602e6ba.609d28","name":"Wait 1m","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1240,"y":60,"wires":[["061b74f643477dd9"]]},{"id":"62b5545bc6d6e627","type":"template","z":"f602e6ba.609d28","name":"Template: Zone Last Ran >= 47 hours","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{%- set entity_name = \"input_datetime{{ zones.zone }}\" | regex_replace(find='switch', replace='', ignorecase=False) -%}\n{%- set time = (as_timestamp(now()) - as_timestamp(states(entity_name+\"_last_start\"))) | int -%}\n{% if time >= 47*3600 %}1{% else %}0{% endif %}","output":"str","x":350,"y":3780,"wires":[["aa53225140781dd7"]]},{"id":"aa53225140781dd7","type":"api-render-template","z":"f602e6ba.609d28","name":"Evaluate Template","server":"e1dc0b88.463bb8","version":0,"template":"","resultsLocation":"data.continue","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":290,"y":3840,"wires":[["8113d83074ff7701"]]},{"id":"8113d83074ff7701","type":"switch","z":"f602e6ba.609d28","name":"Last Ran >= Template Hrs Ago","property":"data.continue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":3840,"wires":[["a31e3daf.17207"],[]]},{"id":"d83b5ff7a2212931","type":"api-call-service","z":"f602e6ba.609d28","name":"Notify via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": alert \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1310,"y":3780,"wires":[[]]},{"id":"dd9855ca4017c8c0","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn on Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_rainfall_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":780,"wires":[[]]},{"id":"c3a696a117416327","type":"function","z":"f602e6ba.609d28","name":"Check Rainfall","func":"var rain_override = false\n\nfor (var i = 0; i < msg.payload.length; i++) {\n if (parseFloat(msg.payload[i].state) > 0.10) {\n rain_override = true\n }\n}\n\n// top = proceed\n// bottom = overridden\nif (rain_override === true) {\n return [ null, {rain_override} ];\n} \nelse {\n return [ {rain_override}, null ];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":740,"wires":[["47f1a8018e58e032"],["dd9855ca4017c8c0"]]},{"id":"27f2580e35031830","type":"api-get-history","z":"f602e6ba.609d28","name":"Rainfall 48h","server":"e1dc0b88.463bb8","version":0,"startdate":"","enddate":"","entityid":"sensor.netatmo_home_rain_sum_rain_today_inches","entityidtype":"is","useRelativeTime":true,"relativeTime":"48h","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":310,"y":740,"wires":[["c3a696a117416327"]]},{"id":"9cb8187c669c6485","type":"comment","z":"f602e6ba.609d28","name":"Rainfall Delay","info":"","x":170,"y":700,"wires":[]},{"id":"47f1a8018e58e032","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn off Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_rainfall_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":700,"wires":[[]]},{"id":"427f7fa58d86cc59","type":"inject","z":"f602e6ba.609d28","name":"*/30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1800","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":740,"wires":[["27f2580e35031830"]]},{"id":"1d9a4d0bb4645f32","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn on Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_rain_forecast_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":940,"wires":[[]]},{"id":"d9ebbaa37f5911a9","type":"comment","z":"f602e6ba.609d28","name":"Rain Forecast Delay","info":"","x":190,"y":860,"wires":[]},{"id":"eeecfc1e8864e39f","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn off Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_rain_forecast_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":860,"wires":[[]]},{"id":"89487a4efedec1db","type":"inject","z":"f602e6ba.609d28","name":"*/30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1800","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":900,"wires":[["2c45af5b3ee5cf0a"]]},{"id":"1e4b3bc7c25b294f","type":"function","z":"f602e6ba.609d28","name":"Rain Chance","func":"// Check next 4 precipitation_probability values\n// HA Template: \n// {% for j in state_attr(\"weather.kcll_daynight\",\"forecast\")[:4] %}\n// {{ j.precipitation_probability }}\n// {% endfor %}\n\nvar forecast_override = false\n\n// if (parseFloat(msg.payload) > 40) {\n// forecast_override = true\n// }\n \nfor (var i = 0; i < 4; i++) {\n if (parseFloat(msg.data.attributes.forecast[i].precipitation_probability) >= 60) {\n forecast_override = true\n }\n}\n\n// top = proceed\n// bottom = overridden\nif (forecast_override === true) {\n return [ null, {forecast_override} ];\n} \nelse {\n return [ {forecast_override}, null ];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":900,"wires":[["eeecfc1e8864e39f"],["1d9a4d0bb4645f32"]]},{"id":"2c45af5b3ee5cf0a","type":"api-current-state","z":"f602e6ba.609d28","name":"Weather","server":"e1dc0b88.463bb8","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"weather.kcll_daynight","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":300,"y":900,"wires":[["1e4b3bc7c25b294f"]]},{"id":"d7e50e7a2810667d","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn on Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_wind_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":1100,"wires":[[]]},{"id":"28936ec687ee4eb0","type":"comment","z":"f602e6ba.609d28","name":"Wind Delay","info":"","x":170,"y":1020,"wires":[]},{"id":"974833b6a2eca853","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn off Boolean","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.irrigation_wind_delay"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":1020,"wires":[[]]},{"id":"478a5a84d38ba181","type":"inject","z":"f602e6ba.609d28","name":"*/5","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":1060,"wires":[["c01fd0612615e927"]]},{"id":"c01fd0612615e927","type":"api-current-state","z":"f602e6ba.609d28","name":"Wind <= 10 MPH","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"10","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.neighbor_5in1_wind","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":330,"y":1060,"wires":[["974833b6a2eca853"],["d7e50e7a2810667d"]]},{"id":"219b37105a8304f1","type":"api-current-state","z":"f602e6ba.609d28","name":"Rainfall Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.irrigation_rainfall_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":260,"y":1580,"wires":[["dcdeabc7.780578"],["d01fbafafbb34692"]]},{"id":"e7430e17f0b24ed8","type":"api-current-state","z":"f602e6ba.609d28","name":"Rain Forecast Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.irrigation_rain_forecast_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":280,"y":1700,"wires":[["862ad27a.d347d"],["f5684be88477322f"]]},{"id":"b6e7d5b8891bba6d","type":"api-current-state","z":"f602e6ba.609d28","name":"Wind Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.irrigation_wind_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":1800,"wires":[["8d4bfe8e.ee805"],["a3d75225807b70eb"]]},{"id":"339ee0ada21856e0","type":"api-current-state","z":"f602e6ba.609d28","name":"Wind Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.irrigation_wind_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":1920,"wires":[["8d4bfe8e.ee805"],["336585d4eee0ca73"]]},{"id":"ed6e3d4225582e20","type":"api-current-state","z":"f602e6ba.609d28","name":"Rainfall Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_rainfall_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":300,"y":3320,"wires":[["f587589f.d739e8"],["f7ac7a90f3da2298"]]},{"id":"593bee0e8c958df8","type":"api-current-state","z":"f602e6ba.609d28","name":"Rain Forecast Delay","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_rain_forecast_delay","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":320,"y":3440,"wires":[["4fae5b92.a9cd44"],["67916c3a5554a794"]]},{"id":"d01fbafafbb34692","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Rainfall\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":1600,"wires":[[]]},{"id":"f5684be88477322f","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Rain Forecasted\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":1720,"wires":[[]]},{"id":"336585d4eee0ca73","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Wind\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":630,"y":1920,"wires":[[]]},{"id":"b3c4a3638c17629e","type":"api-call-service","z":"f602e6ba.609d28","name":"Clear Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"None\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":260,"y":2000,"wires":[["815fddc0.6604c"]]},{"id":"67916c3a5554a794","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"Rain Forecasted\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":3460,"wires":[[]]},{"id":"f7ac7a90f3da2298","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"Rainfall\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":3340,"wires":[[]]},{"id":"45c5dbbbd8ce50a1","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"Automation Off\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":3140,"wires":[[]]},{"id":"2fc67b25514de5a5","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.lawn_irrigation_reason"],"data":"{\"value\":\"Force Run\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":450,"y":1460,"wires":[["5420d0eed32223fb"]]},{"id":"08e3098cf183e086","type":"link in","z":"f602e6ba.609d28","name":"","links":["5420d0eed32223fb"],"x":325,"y":2060,"wires":[["815fddc0.6604c"]]},{"id":"abb8777dd08aa743","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"Force Run\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":490,"y":3200,"wires":[["fdcfa1521191fa40"]]},{"id":"d8637d8d96b68fca","type":"api-call-service","z":"f602e6ba.609d28","name":"Clear Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.front_bed_irrigation_reason"],"data":"{\"value\":\"None\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":300,"y":3540,"wires":[["418058c4.af3158"]]},{"id":"b403eec7866aea22","type":"link in","z":"f602e6ba.609d28","name":"","links":["fdcfa1521191fa40"],"x":365,"y":3600,"wires":[["418058c4.af3158"]]},{"id":"f2c9c3a5b8b11a64","type":"switch","z":"f602e6ba.609d28","name":"Continue?","property":"data.continue","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":1270,"y":2520,"wires":[["287dd3b1af5dc2d0"],["bf015af2161c5ec2"]]},{"id":"38affe5cc680d076","type":"template","z":"f602e6ba.609d28","name":"Template: Zone Last Ran >= 71 hours","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{%- set entity_name = \"input_datetime{{ payload.zone }}\" | regex_replace(find='switch', replace='', ignorecase=False) -%}\n{%- set time = (as_timestamp(now()) - as_timestamp(states(entity_name+\"_last_start\"))) | int -%}\n{% if time >= 71*3600 %}1{% else %}0{% endif %}","output":"str","x":830,"y":2520,"wires":[["174186fb5d054240"]]},{"id":"9896327569c234da","type":"link in","z":"f602e6ba.609d28","name":"","links":["af4788fe.215ba8"],"x":135,"y":2520,"wires":[["e95ac52f03478921"]]},{"id":"e95ac52f03478921","type":"template","z":"f602e6ba.609d28","name":"Lawn Zones","field":"all_zones","fieldType":"msg","format":"json","syntax":"mustache","template":"[\n {\n \"zone\": \"switch.irrigation_front_lawn\",\n \"name\": \"Front lawn\"\n },\n {\n \"zone\": \"switch.irrigation_left_and_main_rear_lawn\",\n \"name\": \"Left and main rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_front_and_right_rear_lawn\",\n \"name\": \"Front and right rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_side_lawn\",\n \"name\": \"Side lawn\"\n }\n]","output":"json","x":330,"y":2520,"wires":[["287dd3b1af5dc2d0"]]},{"id":"563008215027d6a4","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Lawn Zones Dev","info":"","x":370,"y":2480,"wires":[]},{"id":"174186fb5d054240","type":"api-render-template","z":"f602e6ba.609d28","name":"Evaluate Template","server":"e1dc0b88.463bb8","version":0,"template":"","resultsLocation":"data.continue","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":1090,"y":2520,"wires":[["f2c9c3a5b8b11a64"]]},{"id":"613ec4390597f04a","type":"inject","z":"f602e6ba.609d28","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":2400,"wires":[["e95ac52f03478921"]]},{"id":"287dd3b1af5dc2d0","type":"array-loop","z":"f602e6ba.609d28","name":"Loop Through Zones","key":"al287dd3b1af5dc2d0","keyType":"msg","reset":true,"resetValue":"value-null","array":"all_zones","arrayType":"msg","x":260,"y":2580,"wires":[["74cd40702021e86d","acdcc72fea065aac"],["224d30a98f52c287"]]},{"id":"74cd40702021e86d","type":"template","z":"f602e6ba.609d28","name":"Zone Settings Lawn","field":"zones","fieldType":"msg","format":"json","syntax":"mustache","template":"[\n {\n \"zone\": \"switch.irrigation_front_lawn\",\n \"time\": 15,\n \"name\": \"Front lawn\"\n },\n {\n \"zone\": \"switch.irrigation_left_and_main_rear_lawn\",\n \"time\": 15,\n \"name\": \"Left and main rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_front_and_right_rear_lawn\",\n \"time\": 15,\n \"name\": \"Front and right rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_side_lawn\",\n \"time\": 10,\n \"name\": \"Side lawn\"\n },\n {\n \"zone\": \"switch.irrigation_front_lawn\",\n \"time\": 15,\n \"name\": \"Front lawn\"\n },\n {\n \"zone\": \"switch.irrigation_left_and_main_rear_lawn\",\n \"time\": 15,\n \"name\": \"Left and main rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_front_and_right_rear_lawn\",\n \"time\": 15,\n \"name\": \"Front and right rear lawn\"\n },\n {\n \"zone\": \"switch.irrigation_side_lawn\",\n \"time\": 10,\n \"name\": \"Side lawn\"\n }\n]","output":"json","x":500,"y":2640,"wires":[["151eb6ba5b2d39cd"]]},{"id":"bf015af2161c5ec2","type":"function","z":"f602e6ba.609d28","name":"Append Run Zones","func":"if (typeof msg.run_zones === 'undefined'){\n msg.run_zones = []\n}\n\n// Add zone to run_zones\nmsg.run_zones.push(msg.payload.zone)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":250,"y":2640,"wires":[["287dd3b1af5dc2d0"]]},{"id":"151eb6ba5b2d39cd","type":"array-loop","z":"f602e6ba.609d28","name":"Loop Through Zones","key":"al287dd3b1af5dc2d0","keyType":"msg","reset":true,"resetValue":"value-null","array":"zones","arrayType":"msg","x":760,"y":2640,"wires":[[],["45ee74d06e9cac2c"]]},{"id":"45ee74d06e9cac2c","type":"switch","z":"f602e6ba.609d28","name":"If Zone in Run Zone","property":"run_zones","propertyType":"msg","rules":[{"t":"cont","v":"payload.zone","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":750,"y":2700,"wires":[["8d3c8370996be2da"],["151eb6ba5b2d39cd"]]},{"id":"95a54981805b22f2","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":2780,"wires":[["02d1e639f7ac6596","7b985932412db47d"]]},{"id":"a4b3eba196a504dc","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn Off Zone","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{ \"entity_id\": payload.zone}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":580,"y":2960,"wires":[["6ea0448df1383ec2"]]},{"id":"02d1e639f7ac6596","type":"change","z":"f602e6ba.609d28","name":"Set Delay Variable","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload.time* 60000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":2840,"wires":[["863b8fa63f210ebe"]]},{"id":"8d3c8370996be2da","type":"api-call-service","z":"f602e6ba.609d28","name":"Turn On Master Valve","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.irrigation_master_valve"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":2780,"wires":[["b1c9631973c2f4b1"]]},{"id":"863b8fa63f210ebe","type":"stoptimer-varidelay","z":"f602e6ba.609d28","duration":"5","durationType":"num","units":"Millisecond","payloadtype":"num","payloadval":"0","name":"Delay","reporting":"every_second","persist":false,"ignoretimerpass":false,"x":550,"y":2900,"wires":[["a4b3eba196a504dc","de509d99b9d965b3"],[],["7d8374976c01e3dc"]]},{"id":"7d8374976c01e3dc","type":"mqtt out","z":"f602e6ba.609d28","name":"Publish Time Remaining","topic":"sensor/irrigation_time_remaining","qos":"","retain":"","broker":"546e31ed.0db1c","x":830,"y":2920,"wires":[]},{"id":"b0debe46542c4c67","type":"api-call-service","z":"f602e6ba.609d28","name":"Notify via Wrapper","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"script","service":"notify_wrapper","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"message\": alert \t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1030,"y":2880,"wires":[[]]},{"id":"de509d99b9d965b3","type":"function","z":"f602e6ba.609d28","name":"Create msg object","func":"var message = \"Sprinkler auto-run: \" + msg.payload.name + \" ran for \" + msg.payload.time + \" minutes\"\n\nreturn { alert: message };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":2880,"wires":[["b0debe46542c4c67"]]},{"id":"b1c9631973c2f4b1","type":"delay","z":"f602e6ba.609d28","name":"2s","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":770,"y":2780,"wires":[["95a54981805b22f2"]]},{"id":"6ea0448df1383ec2","type":"delay","z":"f602e6ba.609d28","name":"Delay 10","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":360,"y":2900,"wires":[["151eb6ba5b2d39cd"]]},{"id":"224d30a98f52c287","type":"api-current-state","z":"f602e6ba.609d28","name":"Force Run","server":"e1dc0b88.463bb8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.irrigation_force_run","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":550,"y":2520,"wires":[["bf015af2161c5ec2"],["38affe5cc680d076"]]},{"id":"5a27d31bfb4a6990","type":"comment","z":"f602e6ba.609d28","name":"Actually Handle Watering","info":"","x":1190,"y":2800,"wires":[]},{"id":"197853479ad9eeda","type":"comment","z":"f602e6ba.609d28","name":"Decide Which Zones to Run","info":"","x":1060,"y":2620,"wires":[]},{"id":"7b985932412db47d","type":"debug","z":"f602e6ba.609d28","name":"Log Zone On","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1140,"y":2740,"wires":[]},{"id":"acdcc72fea065aac","type":"debug","z":"f602e6ba.609d28","name":"Log Run Zones","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":2720,"wires":[]}] \ No newline at end of file diff --git a/extras/appdaemon/apps/apps.yaml b/extras/appdaemon/apps/apps.yaml index ec35ccdf..e6055282 100644 --- a/extras/appdaemon/apps/apps.yaml +++ b/extras/appdaemon/apps/apps.yaml @@ -1,20 +1,24 @@ +suntest: + module: suntest + class: SunTest + AC Automation: module: ac_automation class: AutoAdjust constrain_input_boolean: input_boolean.ac_automation thermostats: climate.thermostat device_tracker: group.trackers - morning_adjust_weekday: '09:00:00' - morning_adjust_weekend: '11:00:00' - night_adjust_weekday: '01:00:00' - night_adjust_weekend: '01:00:00' + morning_adjust_weekday: "09:00:00" + morning_adjust_weekend: "11:00:00" + night_adjust_weekday: "01:00:00" + night_adjust_weekend: "01:00:00" # Below depends on the manual setting of heat or cool on the thermostat - cool_day: '82' - cool_night: '74' - cool_unoccupied: '82' - heat_day: '63' - heat_night: '62' - heat_unoccupied: '55' + cool_day: "82" + cool_night: "72" + cool_unoccupied: "82" + heat_day: "63" + heat_night: "62" + heat_unoccupied: "55" Back Bedroom Zigbee Remote: module: zigbee_remote @@ -91,12 +95,12 @@ Occupancy Simulator: class: OccuSim enable: input_boolean.occusim reset_time: 02:00:00 - dump_times: '1' - log_msg: '1' + dump_times: "1" + log_msg: "1" step_evening_name: Evening step_evening_start: sunset - 00:30:00 step_night_name: Night - step_night_start: '23:59:59' + step_night_start: "23:59:59" # Turn on some devices in the evening step_evening_on_1: light.master_bedroom_lamps @@ -147,7 +151,7 @@ Occupancy Simulator: # Ensure all off late step_dark_name: Dark - step_dark_start: '23:32:00' + step_dark_start: "23:32:00" step_dark_off_1: light.master_bedroom_lamps step_dark_off_2: light.dining_room_light step_dark_off_3: light.kitchen_table_light @@ -244,17 +248,17 @@ NAS: module: entity_timer class: Timer entities: switch.nas - time_on: '03:00:00' + time_on: "03:00:00" # There is an automation to turn this off automatically after rsync - time_off: '05:00:00' + time_off: "05:00:00" constrain_days: wed Dyson Charger: module: entity_timer class: Timer entities: switch.garage_dyson - time_on: '15:00:00' - time_off: '18:00:00' + time_on: "15:00:00" + time_off: "18:00:00" constrain_presence: anyone AC Filter Change: @@ -292,7 +296,7 @@ Garage Exterior Light at Night With Door: trigger_sensor: binary_sensor.garage_exterior_door toggle_entity: switch.garage_exterior_light # Seconds to turn entity on when triggered - time_on: '5' + time_on: "5" Office Light at Night With Door: module: door_open @@ -303,7 +307,7 @@ Office Light at Night With Door: trigger_sensor: binary_sensor.front_door toggle_entity: light.andrew_desk_lamp # Seconds to turn entity on when triggered - time_on: '60' + time_on: "60" Kitchen Light at Night With Door: module: door_open @@ -314,7 +318,7 @@ Kitchen Light at Night With Door: trigger_sensor: binary_sensor.garage_interior_door,binary_sensor.back_porch_door toggle_entity: light.kitchen_table_leds # Seconds to turn entity on when triggered - time_on: '60' + time_on: "60" Living Room Sconces at Night With Motion: module: door_open @@ -325,7 +329,7 @@ Living Room Sconces at Night With Motion: toggle_entity: light.living_room_sconces brightness: 70 # Seconds to turn entity on when triggered - time_on: '1' + time_on: "1" Garage Lights with Cover and Door: module: door_open @@ -366,15 +370,15 @@ Entryway Light Sunset: class: Timer constrain_days: wed time_on: sunset - 00:20:00 - time_off: '23:00:00' + time_off: "23:00:00" entities: light.entryway_light brightness: 255 Plant Light: module: entity_timer class: Timer - time_on: '09:30:00' - time_off: '21:00:00' + time_on: "09:30:00" + time_off: "21:00:00" entities: switch.plant_light Living Room Lamp Follow: diff --git a/extras/appdaemon/apps/door_open.py b/extras/appdaemon/apps/door_open.py index 0a76d76d..0653199c 100755 --- a/extras/appdaemon/apps/door_open.py +++ b/extras/appdaemon/apps/door_open.py @@ -12,6 +12,7 @@ def initialize(self): self.listen_state(self.state_change, sensor) def state_change(self, entity, attribute, old, new, kwargs): + self.log(self.time()) if (old in ["off", "closed"]) and (new in ["on", "open"]): # Cancel turn_off timer if there is one if self.timer != None: diff --git a/extras/appdaemon/apps/suntest.py b/extras/appdaemon/apps/suntest.py new file mode 100644 index 00000000..cbaef194 --- /dev/null +++ b/extras/appdaemon/apps/suntest.py @@ -0,0 +1,8 @@ +import hassapi as hass +class SunTest(hass.Hass): + + def initialize(self): + self.log('Test sunset/sunrise:') + self.log(self.parse_time('sunset')) + self.log(self.parse_time('sunrise')) + self.log(self.time()) diff --git a/extras/docker-compose/homeassistant/docker-compose.yml b/extras/docker-compose/homeassistant/docker-compose.yml index 98bc07af..20eb441d 100644 --- a/extras/docker-compose/homeassistant/docker-compose.yml +++ b/extras/docker-compose/homeassistant/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.2' services: homeassistant: container_name: hass - image: ghcr.io/home-assistant/home-assistant:stable + image: ghcr.io/home-assistant/home-assistant:beta labels: com.centurylinklabs.watchtower.monitor-only: "true" volumes: @@ -96,7 +96,7 @@ services: appdaemon: container_name: appdaemon #image: acockburn/appdaemon:4.0.5 - image: acockburn/appdaemon:latest + image: acockburn/appdaemon:dev #user: '99' healthcheck: test: "curl -sf http://localhost:8888" diff --git a/extras/docker-compose/unified/docker-compose.yml b/extras/docker-compose/unified/docker-compose.yml index 69acbdca..15ffda6b 100644 --- a/extras/docker-compose/unified/docker-compose.yml +++ b/extras/docker-compose/unified/docker-compose.yml @@ -3,7 +3,7 @@ version: '3.2' services: homeassistant: container_name: hass - image: ghcr.io/home-assistant/home-assistant:stable + image: ghcr.io/home-assistant/home-assistant:beta labels: com.centurylinklabs.watchtower.monitor-only: "true" volumes: @@ -97,7 +97,7 @@ services: appdaemon: container_name: appdaemon #image: acockburn/appdaemon:4.0.5 - image: acockburn/appdaemon:latest + image: acockburn/appdaemon:dev #user: '99' healthcheck: test: "curl -sf http://localhost:8888" diff --git a/images/nodered_1.png b/images/nodered_1.png index 6a8034e9..7b9eb0ae 100644 Binary files a/images/nodered_1.png and b/images/nodered_1.png differ diff --git a/images/nodered_2.png b/images/nodered_2.png index 77cc81b7..993af030 100644 Binary files a/images/nodered_2.png and b/images/nodered_2.png differ diff --git a/www/community/lovelace-card-mod/card-mod.js b/www/community/lovelace-card-mod/card-mod.js index 6929cac4..82a730c9 100644 --- a/www/community/lovelace-card-mod/card-mod.js +++ b/www/community/lovelace-card-mod/card-mod.js @@ -1,5 +1,5 @@ -function t(){return document.querySelector("hc-main")?document.querySelector("hc-main").hass:document.querySelector("home-assistant")?document.querySelector("home-assistant").hass:void 0}function e(t,e,o,s){var i,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(n<3?i(r):n>3?i(e,o,r):i(e,o))||r);return n>3&&r&&Object.defineProperty(e,o,r),r}const o=window,s=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;const r=t=>new class{constructor(t,e,o){if(this._$cssResult$=!0,o!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(s&&void 0===t){const o=void 0!==e&&1===e.length;o&&(t=n.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&n.set(e,t))}return t}toString(){return this.cssText}}("string"==typeof t?t:t+"",void 0,i),a=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const o of t.cssRules)e+=o.cssText;return r(e)})(t):t;var d;const l=window,c=l.trustedTypes,h=c?c.emptyScript:"",u=l.reactiveElementPolyfillSupport,p={toAttribute(t,e){switch(e){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let o=t;switch(e){case Boolean:o=null!==t;break;case Number:o=null===t?null:Number(t);break;case Object:case Array:try{o=JSON.parse(t)}catch(t){o=null}}return o}},m=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:m};let v=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,o)=>{const s=this._$Ep(o,e);void 0!==s&&(this._$Ev.set(s,o),t.push(s))})),t}static createProperty(t,e=f){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const o="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,o,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,o){return{get(){return this[e]},set(s){const i=this[t];this[e]=s,this.requestUpdate(t,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const o of e)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const o=new Set(t.flat(1/0).reverse());for(const t of o)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Ep(t,e){const o=e.attribute;return!1===o?void 0:"string"==typeof o?o:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,o;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(o=t.hostConnected)||void 0===o||o.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{s?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const s=document.createElement("style"),i=o.litNonce;void 0!==i&&s.setAttribute("nonce",i),s.textContent=e.cssText,t.appendChild(s)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,o){this._$AK(t,o)}_$EO(t,e,o=f){var s;const i=this.constructor._$Ep(t,o);if(void 0!==i&&!0===o.reflect){const n=(void 0!==(null===(s=o.converter)||void 0===s?void 0:s.toAttribute)?o.converter:p).toAttribute(e,o.type);this._$El=t,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$El=null}}_$AK(t,e){var o;const s=this.constructor,i=s._$Ev.get(t);if(void 0!==i&&this._$El!==i){const t=s.getPropertyOptions(i),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(o=t.converter)||void 0===o?void 0:o.fromAttribute)?t.converter:p;this._$El=i,this[i]=n.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,o){let s=!0;void 0!==t&&(((o=o||this.constructor.getPropertyOptions(t)).hasChanged||m)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===o.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,o))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const o=this._$AL;try{e=this.shouldUpdate(o),e?(this.willUpdate(o),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(o)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(o)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};var y;v.finalized=!0,v.elementProperties=new Map,v.elementStyles=[],v.shadowRootOptions={mode:"open"},null==u||u({ReactiveElement:v}),(null!==(d=l.reactiveElementVersions)&&void 0!==d?d:l.reactiveElementVersions=[]).push("1.4.2");const _=window,g=_.trustedTypes,$=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,w=`lit$${(Math.random()+"").slice(9)}$`,E="?"+w,b=`<${E}>`,A=document,S=(t="")=>A.createComment(t),C=t=>null===t||"object"!=typeof t&&"function"!=typeof t,N=Array.isArray,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,U=/>/g,R=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),M=/'/g,x=/"/g,D=/^(?:script|style|textarea|title)$/i,T=(t=>(e,...o)=>({_$litType$:t,strings:e,values:o}))(1),k=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),L=new WeakMap,q=A.createTreeWalker(A,129,null,!1),I=(t,e)=>{const o=t.length-1,s=[];let i,n=2===e?"":"",r=P;for(let e=0;e"===d[0]?(r=null!=i?i:P,l=-1):void 0===d[1]?l=-2:(l=r.lastIndex-d[2].length,a=d[1],r=void 0===d[3]?R:'"'===d[3]?x:M):r===x||r===M?r=R:r===O||r===U?r=P:(r=R,i=void 0);const h=r===R&&t[e+1].startsWith("/>")?" ":"";n+=r===P?o+b:l>=0?(s.push(a),o.slice(0,l)+"$lit$"+o.slice(l)+w+h):o+w+(-2===l?(s.push(void 0),e):h)}const a=n+(t[o]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==$?$.createHTML(a):a,s]};class j{constructor({strings:t,_$litType$:e},o){let s;this.parts=[];let i=0,n=0;const r=t.length-1,a=this.parts,[d,l]=I(t,e);if(this.el=j.createElement(d,o),q.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=q.nextNode())&&a.length0){s.textContent=g?g.emptyScript:"";for(let o=0;oN(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==H&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(A.createTextNode(t)),this._$AH=t}$(t){var e;const{values:o,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=j.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.p(o);else{const t=new B(i,this),e=t.v(this.options);t.p(o),this.T(e),this._$AH=t}}_$AC(t){let e=L.get(t.strings);return void 0===e&&L.set(t.strings,e=new j(t)),e}k(t){N(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let o,s=0;for(const i of t)s===e.length?e.push(o=new V(this.O(S()),this.O(S()),this,this.options)):o=e[s],o._$AI(i),s++;s2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=H}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,o,s){const i=this.strings;let n=!1;if(void 0===i)t=z(this,t,e,0),n=!C(t)||t!==this._$AH&&t!==k,n&&(this._$AH=t);else{const s=t;let r,a;for(t=i[0],r=0;r{var s,i;const n=null!==(s=null==o?void 0:o.renderBefore)&&void 0!==s?s:e;let r=n._$litPart$;if(void 0===r){const t=null!==(i=null==o?void 0:o.renderBefore)&&void 0!==i?i:null;n._$litPart$=r=new V(e.insertBefore(S(),t),t,void 0,null!=o?o:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return k}}tt.finalized=!0,tt._$litElement$=!0,null===(Q=globalThis.litElementHydrateSupport)||void 0===Q||Q.call(globalThis,{LitElement:tt});const et=globalThis.litElementPolyfillSupport;null==et||et({LitElement:tt}),(null!==(X=globalThis.litElementVersions)&&void 0!==X?X:globalThis.litElementVersions=[]).push("3.2.2");const ot=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(o){o.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(o){o.createProperty(e.key,t)}};function st(t){return(e,o)=>void 0!==o?((t,e,o)=>{e.constructor.createProperty(o,t)})(t,e,o):ot(t,e)}var it;null===(it=window.HTMLSlotElement)||void 0===it||it.prototype.assignedElements;const nt="lovelace-player-device-id";function rt(){if(!localStorage[nt]){const t=()=>Math.floor(1e5*(1+Math.random())).toString(16).substring(1);window.fully&&"function"==typeof fully.getDeviceId?localStorage[nt]=fully.getDeviceId():localStorage[nt]=`${t()}${t()}-${t()}${t()}`}return localStorage[nt]}let at=rt();const dt=new URLSearchParams(window.location.search);var lt;dt.get("deviceID")&&null!==(lt=dt.get("deviceID"))&&("clear"===lt?localStorage.removeItem(nt):localStorage[nt]=lt,at=rt()),window.cardMod_template_cache=window.cardMod_template_cache||{};const ct=window.cardMod_template_cache;async function ht(e,o,s){const i=t().connection,n=JSON.stringify([o,s]);let r=ct[n];r?(r.callbacks.has(e)||ut(e),e(r.value),r.callbacks.add(e)):(ut(e),e(""),s=Object.assign({user:t().user.name,browser:at,hash:location.hash.substr(1)||""},s),ct[n]=r={template:o,variables:s,value:"",callbacks:new Set([e]),unsubscribe:i.subscribeMessage((t=>function(t,e){const o=ct[t];o&&(o.value=e.result,o.callbacks.forEach((t=>t(e.result))))}(n,t)),{type:"render_template",template:o,variables:s})})}async function ut(t){let e;for(const[o,s]of Object.entries(ct))if(s.callbacks.has(t)){s.callbacks.delete(t),0==s.callbacks.size&&(e=s.unsubscribe,delete ct[o]);break}e&&await(await e)()}var pt="3.2.0";async function mt(t,e,o=!1){let s=t;"string"==typeof e&&(e=e.split(/(\$| )/)),""===e[e.length-1]&&e.pop();for(const[t,i]of e.entries())if(i.trim().length){if(!s)return null;s.localName&&s.localName.includes("-")&&await customElements.whenDefined(s.localName),s.updateComplete&&await s.updateComplete,s="$"===i?o&&t==e.length-1?[s.shadowRoot]:s.shadowRoot:o&&t==e.length-1?s.querySelectorAll(i):s.querySelector(i)}return s}async function ft(t,e,o=!1,s=1e4){return Promise.race([mt(t,e,o),new Promise(((t,e)=>setTimeout((()=>e(new Error("timeout"))),s)))]).catch((t=>{if(!t.message||"timeout"!==t.message)throw t;return null}))}const vt=async t=>{await(async()=>{if(customElements.get("developer-tools-event"))return;await customElements.whenDefined("partial-panel-resolver");const t=document.createElement("partial-panel-resolver");t.hass={panels:[{url_path:"tmp",component_name:"developer-tools"}]},t._updateRoutes(),await t.routerOptions.routes.tmp.load(),await customElements.whenDefined("developer-tools-router");const e=document.createElement("developer-tools-router");await e.routerOptions.routes.event.load()})();return document.createElement("developer-tools-event")._computeParsedEventData(t)};async function yt(t,e,o="",s={},i=null,n=!0){var r;if(!t)return;let a;(null===(r=t.localName)||void 0===r?void 0:r.includes("-"))&&await customElements.whenDefined(t.localName),t.updateComplete&&await t.updateComplete,void 0===t._cardMod&&(t._cardMod=[]);for(const o of t._cardMod)if(o.type===e){a=o;break}return a||(a=document.createElement("card-mod"),a.type=e,t._cardMod.push(a)),queueMicrotask((async()=>{const e=t.modElement?t.modElement:n&&t.shadowRoot||t;e.contains(a)||e.appendChild(a),a.variables=s,a.styles=o})),a}function _t(t,e){const o=t=>t&&"object"==typeof t&&!Array.isArray(t);if(o(t)&&o(e))for(const s in e)o(e[s])?(t[s]||Object.assign(t,{[s]:{}}),"string"==typeof t[s]&&(t[s]={".":t[s]}),_t(t[s],e[s])):t[s]?t[s]=e[s]+t[s]:t[s]=e[s];return t}function gt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(!(t instanceof Object&&e instanceof Object))return!1;for(const o in t)if(t.hasOwnProperty(o)){if(!e.hasOwnProperty(o))return!1;if(t[o]!==e[o]){if("object"!=typeof t[o])return!1;if(!gt(t[o],e[o]))return!1}}for(const o in e)if(e.hasOwnProperty(o)&&!t.hasOwnProperty(o))return!1;return!0}function $t(t){return t.config?t.config:t._config?t._config:t.host?$t(t.host):t.parentElement?$t(t.parentElement):t.parentNode?$t(t.parentNode):null}function wt(t,e){for(const o of e)t.add(o)}async function Et(t,e=0){let o=new Set;if(10==e)return o;if(!t)return o;if(t._cardMod)for(const e of t._cardMod)e.styles&&o.add(e);return t.updateComplete&&await t.updateComplete,t.parentElement?wt(o,await Et(t.parentElement,e+1)):t.parentNode&&wt(o,await Et(t.parentNode,e+1)),t.host&&wt(o,await Et(t.host,e+1)),o}class bt extends tt{static get applyToElement(){return yt}constructor(){super(),this._rendered_styles="",this._styleChildren=new Set,this._observer=new MutationObserver((t=>{for(const e of t){if("card-mod"===e.target.localName)return;e.addedNodes.length&&e.addedNodes.forEach((t=>{t.localName})),e.removedNodes.length&&e.removedNodes.forEach((t=>{t.localName}))}stop||this.refresh()})),document.addEventListener("cm_update",(()=>{this.refresh()}))}connectedCallback(){super.connectedCallback(),this._connect(),this.setAttribute("slot","none")}disconnectedCallback(){super.disconnectedCallback(),this._disconnect()}set styles(e){gt(e,this._input_styles)||(this._input_styles=e,(async()=>{let o=JSON.parse(JSON.stringify(e||{}));"string"==typeof o&&(o={".":o});_t(o,await async function(e){var o,s;if(!e.type)return null;const i=e.parentElement?e.parentElement:e,n=window.getComputedStyle(i).getPropertyValue("--card-mod-theme");if(!t())return{};const r=null!==(s=null===(o=t())||void 0===o?void 0:o.themes.themes)&&void 0!==s?s:{};return r[n]?r[n][`card-mod-${e.type}-yaml`]?vt(r[n][`card-mod-${e.type}-yaml`]):r[n][`card-mod-${e.type}`]?{".":r[n][`card-mod-${e.type}`]}:{}:{}}(this)),this._fixed_styles=o,this._connect()})())}get styles(){return this._styles}refresh(){this._connect()}async _styleChildEl(t,e){if(void 0===e){const o=this._fixed_styles;for(const[s,i]of Object.entries(o)){if("."===s)continue;if((await ft(this.parentElement||this.parentNode,s,!0)).forEach((o=>{o===t&&(e=i)})),void 0!==e)break}if(void 0===e)return}if(!t)return;const o=await yt(t,`${this.type}-child`,e,this.variables,null,!1);return o.refresh,o}async _connect(){var t;const e=null!==(t=this._fixed_styles)&&void 0!==t?t:{},o=new Set;let s="",i=!1;const n=this.parentElement||this.parentNode;for(const[t,r]of Object.entries(e))if("."===t)s=r;else{i=!0;const e=await ft(n,t,!0);if(!e)continue;for(const t of e){const e=await this._styleChildEl(t,r);e&&o.add(e)}}for(const t of this._styleChildren)o.has(t)||t&&(t.styles="");var r;(this._styleChildren=o,this._styles!==s)&&(this._styles=s,this._styles&&(r=this._styles,String(r).includes("{%")||String(r).includes("{{"))?(this._renderer=this._renderer||this._style_rendered.bind(this),ht(this._renderer,this._styles,this.variables)):this._style_rendered(this._styles||""),i&&(this._observer.disconnect(),this._observer.observe(function(t){if(!t)return;const e=t.parentElement||t.parentNode;return e?e.host?e.host:e:void 0}(this),{childList:!0})))}async _disconnect(){this._observer.disconnect(),this._styles="",await ut(this._renderer)}_style_rendered(t){this._rendered_styles!==t&&(this._rendered_styles=t),this.dispatchEvent(new Event("card-mod-update"))}createRenderRoot(){return this}render(){return T` +function t(){return document.querySelector("hc-main")?document.querySelector("hc-main").hass:document.querySelector("home-assistant")?document.querySelector("home-assistant").hass:void 0}function e(t,e,o,s){var i,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(n<3?i(r):n>3?i(e,o,r):i(e,o))||r);return n>3&&r&&Object.defineProperty(e,o,r),r}const o=window,s=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;const r=t=>new class{constructor(t,e,o){if(this._$cssResult$=!0,o!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(s&&void 0===t){const o=void 0!==e&&1===e.length;o&&(t=n.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&n.set(e,t))}return t}toString(){return this.cssText}}("string"==typeof t?t:t+"",void 0,i),a=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const o of t.cssRules)e+=o.cssText;return r(e)})(t):t;var d;const l=window,c=l.trustedTypes,h=c?c.emptyScript:"",u=l.reactiveElementPolyfillSupport,p={toAttribute(t,e){switch(e){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let o=t;switch(e){case Boolean:o=null!==t;break;case Number:o=null===t?null:Number(t);break;case Object:case Array:try{o=JSON.parse(t)}catch(t){o=null}}return o}},m=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:m};let v=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,o)=>{const s=this._$Ep(o,e);void 0!==s&&(this._$Ev.set(s,o),t.push(s))})),t}static createProperty(t,e=f){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const o="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,o,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,o){return{get(){return this[e]},set(s){const i=this[t];this[e]=s,this.requestUpdate(t,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const o of e)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const o=new Set(t.flat(1/0).reverse());for(const t of o)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Ep(t,e){const o=e.attribute;return!1===o?void 0:"string"==typeof o?o:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,o;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(o=t.hostConnected)||void 0===o||o.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{s?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const s=document.createElement("style"),i=o.litNonce;void 0!==i&&s.setAttribute("nonce",i),s.textContent=e.cssText,t.appendChild(s)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,o){this._$AK(t,o)}_$EO(t,e,o=f){var s;const i=this.constructor._$Ep(t,o);if(void 0!==i&&!0===o.reflect){const n=(void 0!==(null===(s=o.converter)||void 0===s?void 0:s.toAttribute)?o.converter:p).toAttribute(e,o.type);this._$El=t,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$El=null}}_$AK(t,e){var o;const s=this.constructor,i=s._$Ev.get(t);if(void 0!==i&&this._$El!==i){const t=s.getPropertyOptions(i),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(o=t.converter)||void 0===o?void 0:o.fromAttribute)?t.converter:p;this._$El=i,this[i]=n.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,o){let s=!0;void 0!==t&&(((o=o||this.constructor.getPropertyOptions(t)).hasChanged||m)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===o.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,o))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const o=this._$AL;try{e=this.shouldUpdate(o),e?(this.willUpdate(o),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(o)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(o)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};var y;v.finalized=!0,v.elementProperties=new Map,v.elementStyles=[],v.shadowRootOptions={mode:"open"},null==u||u({ReactiveElement:v}),(null!==(d=l.reactiveElementVersions)&&void 0!==d?d:l.reactiveElementVersions=[]).push("1.4.2");const _=window,g=_.trustedTypes,$=g?g.createPolicy("lit-html",{createHTML:t=>t}):void 0,w=`lit$${(Math.random()+"").slice(9)}$`,E="?"+w,b=`<${E}>`,A=document,S=(t="")=>A.createComment(t),C=t=>null===t||"object"!=typeof t&&"function"!=typeof t,N=Array.isArray,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,R=/>/g,U=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),M=/'/g,x=/"/g,D=/^(?:script|style|textarea|title)$/i,T=(t=>(e,...o)=>({_$litType$:t,strings:e,values:o}))(1),k=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),L=new WeakMap,q=A.createTreeWalker(A,129,null,!1),I=(t,e)=>{const o=t.length-1,s=[];let i,n=2===e?"":"",r=P;for(let e=0;e"===d[0]?(r=null!=i?i:P,l=-1):void 0===d[1]?l=-2:(l=r.lastIndex-d[2].length,a=d[1],r=void 0===d[3]?U:'"'===d[3]?x:M):r===x||r===M?r=U:r===O||r===R?r=P:(r=U,i=void 0);const h=r===U&&t[e+1].startsWith("/>")?" ":"";n+=r===P?o+b:l>=0?(s.push(a),o.slice(0,l)+"$lit$"+o.slice(l)+w+h):o+w+(-2===l?(s.push(void 0),e):h)}const a=n+(t[o]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==$?$.createHTML(a):a,s]};class j{constructor({strings:t,_$litType$:e},o){let s;this.parts=[];let i=0,n=0;const r=t.length-1,a=this.parts,[d,l]=I(t,e);if(this.el=j.createElement(d,o),q.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=q.nextNode())&&a.length0){s.textContent=g?g.emptyScript:"";for(let o=0;oN(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==H&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(A.createTextNode(t)),this._$AH=t}$(t){var e;const{values:o,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=j.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.p(o);else{const t=new B(i,this),e=t.v(this.options);t.p(o),this.T(e),this._$AH=t}}_$AC(t){let e=L.get(t.strings);return void 0===e&&L.set(t.strings,e=new j(t)),e}k(t){N(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let o,s=0;for(const i of t)s===e.length?e.push(o=new V(this.O(S()),this.O(S()),this,this.options)):o=e[s],o._$AI(i),s++;s2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=H}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,o,s){const i=this.strings;let n=!1;if(void 0===i)t=z(this,t,e,0),n=!C(t)||t!==this._$AH&&t!==k,n&&(this._$AH=t);else{const s=t;let r,a;for(t=i[0],r=0;r{var s,i;const n=null!==(s=null==o?void 0:o.renderBefore)&&void 0!==s?s:e;let r=n._$litPart$;if(void 0===r){const t=null!==(i=null==o?void 0:o.renderBefore)&&void 0!==i?i:null;n._$litPart$=r=new V(e.insertBefore(S(),t),t,void 0,null!=o?o:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return k}}tt.finalized=!0,tt._$litElement$=!0,null===(Q=globalThis.litElementHydrateSupport)||void 0===Q||Q.call(globalThis,{LitElement:tt});const et=globalThis.litElementPolyfillSupport;null==et||et({LitElement:tt}),(null!==(X=globalThis.litElementVersions)&&void 0!==X?X:globalThis.litElementVersions=[]).push("3.2.2");const ot=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(o){o.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(o){o.createProperty(e.key,t)}};function st(t){return(e,o)=>void 0!==o?((t,e,o)=>{e.constructor.createProperty(o,t)})(t,e,o):ot(t,e)}var it;null===(it=window.HTMLSlotElement)||void 0===it||it.prototype.assignedElements;const nt="lovelace-player-device-id";function rt(){if(!localStorage[nt]){const t=()=>Math.floor(1e5*(1+Math.random())).toString(16).substring(1);window.fully&&"function"==typeof fully.getDeviceId?localStorage[nt]=fully.getDeviceId():localStorage[nt]=`${t()}${t()}-${t()}${t()}`}return localStorage[nt]}let at=rt();const dt=new URLSearchParams(window.location.search);var lt;dt.get("deviceID")&&null!==(lt=dt.get("deviceID"))&&("clear"===lt?localStorage.removeItem(nt):localStorage[nt]=lt,at=rt()),window.cardMod_template_cache=window.cardMod_template_cache||{};const ct=window.cardMod_template_cache;async function ht(e,o,s){const i=t().connection,n=JSON.stringify([o,s]);let r=ct[n];r?(r.callbacks.has(e)||ut(e),e(r.value),r.callbacks.add(e)):(ut(e),e(""),s=Object.assign({user:t().user.name,browser:at,hash:location.hash.substr(1)||""},s),ct[n]=r={template:o,variables:s,value:"",callbacks:new Set([e]),unsubscribe:i.subscribeMessage((t=>function(t,e){const o=ct[t];o&&(o.value=e.result,o.callbacks.forEach((t=>t(e.result))))}(n,t)),{type:"render_template",template:o,variables:s})})}async function ut(t){let e;for(const[o,s]of Object.entries(ct))if(s.callbacks.has(t)){s.callbacks.delete(t),0==s.callbacks.size&&(e=s.unsubscribe,delete ct[o]);break}e&&await(await e)()}var pt="3.2.1";async function mt(t,e,o=!1){let s=t;"string"==typeof e&&(e=e.split(/(\$| )/)),""===e[e.length-1]&&e.pop();for(const[t,i]of e.entries())if(i.trim().length){if(!s)return null;s.localName&&s.localName.includes("-")&&await customElements.whenDefined(s.localName),s.updateComplete&&await s.updateComplete,s="$"===i?o&&t==e.length-1?[s.shadowRoot]:s.shadowRoot:o&&t==e.length-1?s.querySelectorAll(i):s.querySelector(i)}return s}async function ft(t,e,o=!1,s=1e4){return Promise.race([mt(t,e,o),new Promise(((t,e)=>setTimeout((()=>e(new Error("timeout"))),s)))]).catch((t=>{if(!t.message||"timeout"!==t.message)throw t;return null}))}const vt=async t=>{await(async()=>{if(customElements.get("developer-tools-event"))return;await customElements.whenDefined("partial-panel-resolver");const t=document.createElement("partial-panel-resolver");t.hass={panels:[{url_path:"tmp",component_name:"developer-tools"}]},t._updateRoutes(),await t.routerOptions.routes.tmp.load(),await customElements.whenDefined("developer-tools-router");const e=document.createElement("developer-tools-router");await e.routerOptions.routes.event.load()})();return document.createElement("developer-tools-event")._computeParsedEventData(t)};async function yt(t,e,o="",s={},i=null,n=!0){var r;if(!t)return;let a;(null===(r=t.localName)||void 0===r?void 0:r.includes("-"))&&await customElements.whenDefined(t.localName),t.updateComplete&&await t.updateComplete,void 0===t._cardMod&&(t._cardMod=[]);for(const o of t._cardMod)if(o.type===e){a=o;break}return a||(a=document.createElement("card-mod"),a.type=e,t._cardMod.push(a)),queueMicrotask((async()=>{const e=t.modElement?t.modElement:n&&t.shadowRoot||t;e.contains(a)||e.appendChild(a),a.variables=s,a.styles=o})),a}function _t(t,e){const o=t=>t&&"object"==typeof t&&!Array.isArray(t);if(o(t)&&o(e))for(const s in e)o(e[s])?(t[s]||Object.assign(t,{[s]:{}}),"string"==typeof t[s]&&(t[s]={".":t[s]}),_t(t[s],e[s])):t[s]?t[s]=e[s]+t[s]:t[s]=e[s];return t}function gt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(!(t instanceof Object&&e instanceof Object))return!1;for(const o in t)if(t.hasOwnProperty(o)){if(!e.hasOwnProperty(o))return!1;if(t[o]!==e[o]){if("object"!=typeof t[o])return!1;if(!gt(t[o],e[o]))return!1}}for(const o in e)if(e.hasOwnProperty(o)&&!t.hasOwnProperty(o))return!1;return!0}function $t(t){return t.config?t.config:t._config?t._config:t.host?$t(t.host):t.parentElement?$t(t.parentElement):t.parentNode?$t(t.parentNode):null}function wt(t,e){for(const o of e)t.add(o)}async function Et(t,e=0){let o=new Set;if(10==e)return o;if(!t)return o;if(t._cardMod)for(const e of t._cardMod)e.styles&&o.add(e);return t.updateComplete&&await t.updateComplete,t.parentElement?wt(o,await Et(t.parentElement,e+1)):t.parentNode&&wt(o,await Et(t.parentNode,e+1)),t.host&&wt(o,await Et(t.host,e+1)),o}class bt extends tt{static get applyToElement(){return yt}constructor(){super(),this._rendered_styles="",this._styleChildren=new Set,this._observer=new MutationObserver((t=>{for(const e of t){if("card-mod"===e.target.localName)return;e.addedNodes.length&&e.addedNodes.forEach((t=>{t.localName})),e.removedNodes.length&&e.removedNodes.forEach((t=>{t.localName}))}stop||this.refresh()})),document.addEventListener("cm_update",(()=>{this.refresh()}))}connectedCallback(){super.connectedCallback(),this._connect(),this.setAttribute("slot","none")}disconnectedCallback(){super.disconnectedCallback(),this._disconnect()}set styles(e){gt(e,this._input_styles)||(this._input_styles=e,(async()=>{let o=JSON.parse(JSON.stringify(e||{}));"string"==typeof o&&(o={".":o});_t(o,await async function(e){var o,s;if(!e.type)return null;const i=e.parentElement?e.parentElement:e,n=window.getComputedStyle(i).getPropertyValue("--card-mod-theme");if(!t())return{};const r=null!==(s=null===(o=t())||void 0===o?void 0:o.themes.themes)&&void 0!==s?s:{};return r[n]?r[n][`card-mod-${e.type}-yaml`]?vt(r[n][`card-mod-${e.type}-yaml`]):r[n][`card-mod-${e.type}`]?{".":r[n][`card-mod-${e.type}`]}:{}:{}}(this)),this._fixed_styles=o,this._connect()})())}get styles(){return this._styles}refresh(){this._connect()}async _styleChildEl(t,e){if(void 0===e){const o=this._fixed_styles;for(const[s,i]of Object.entries(o)){if("."===s)continue;if((await ft(this.parentElement||this.parentNode,s,!0)).forEach((o=>{o===t&&(e=i)})),void 0!==e)break}if(void 0===e)return}if(!t)return;const o=await yt(t,`${this.type}-child`,e,this.variables,null,!1);return o.refresh,o}async _connect(){var t;const e=null!==(t=this._fixed_styles)&&void 0!==t?t:{},o=new Set;let s="",i=!1;const n=this.parentElement||this.parentNode;for(const[t,r]of Object.entries(e))if("."===t)s=r;else{i=!0;const e=await ft(n,t,!0);if(!e)continue;for(const t of e){const e=await this._styleChildEl(t,r);e&&o.add(e)}}for(const t of this._styleChildren)o.has(t)||t&&(t.styles="");var r;(this._styleChildren=o,this._styles!==s)&&(this._styles=s,this._styles&&(r=this._styles,String(r).includes("{%")||String(r).includes("{{"))?(this._renderer=this._renderer||this._style_rendered.bind(this),ht(this._renderer,this._styles,this.variables)):this._style_rendered(this._styles||""),i&&(this._observer.disconnect(),this._observer.observe(function(t){if(!t)return;const e=t.parentElement||t.parentNode;return e?e.host?e.host:e:void 0}(this),{childList:!0})))}async _disconnect(){this._observer.disconnect(),this._styles="",await ut(this._renderer)}_style_rendered(t){this._rendered_styles!==t&&(this._rendered_styles=t),this.dispatchEvent(new Event("card-mod-update"))}createRenderRoot(){return this}render(){return T` - `}}e([st()],bt.prototype,"_rendered_styles",void 0),(async()=>{for(;void 0===customElements.get("home-assistant");)await new Promise((t=>window.setTimeout(t,100)));customElements.get("card-mod")||(customElements.define("card-mod",bt),console.info(`%cCARD-MOD ${pt} IS INSTALLED`,"color: green; font-weight: bold"))})(),customElements.whenDefined("ha-card").then((()=>{const t=customElements.get("ha-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=function(...t){var o,s;null==e||e.bind(this)(...t);const i=$t(this);(null===(o=null==i?void 0:i.card_mod)||void 0===o?void 0:o.class)&&this.classList.add(i.card_mod.class),(null==i?void 0:i.type)&&this.classList.add(`type-${i.type.replace(":","-")}`),yt(this,"card",(null===(s=null==i?void 0:i.card_mod)||void 0===s?void 0:s.style)||(null==i?void 0:i.style)||"",{config:i},null,!1).then((t=>{var e;const o=null===(e=this.parentNode)||void 0===e?void 0:e.host;if(o){if(o.setConfig&&!o.setConfig.cm_patched){const e=o.setConfig;o.setConfig=function(o,...s){var i;e.bind(this)(o,...s),t.variables={config:o},t.styles=(null===(i=o.card_mod)||void 0===i?void 0:i.style)||{}},o.setConfig.cm_patched=!0}if(o.update&&!o.update.cm_patched){const e=o.update;o.update=function(...o){e.bind(this)(...o),this.updateComplete?this.updateComplete.then((()=>{t.refresh()})):t.refresh()},o.update.cm_patched=!0}}}))}})),customElements.whenDefined("hui-entities-card").then((()=>{const t=customElements.get("hui-entities-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.renderEntity;t.prototype.renderEntity=function(t,...o){var s;const i=e.bind(this)(t,...o);if(!i||!i.values)return i;const n=i.values[0];if(!n)return i;if("custom:mod-card"===(null==t?void 0:t.type))return i;(null===(s=null==t?void 0:t.card_mod)||void 0===s?void 0:s.class)&&n.classList.add(t.card_mod.class),(null==t?void 0:t.type)&&n.classList.add(`type-${t.type.replace(":","-")}`);const r=async()=>{var e;return yt(n,"row",(null===(e=null==t?void 0:t.card_mod)||void 0===e?void 0:e.style)||(null==t?void 0:t.style)||"",{config:t})};return(async()=>{const t=await r();if(n.update&&!n.update.cm_patched){const e=n.update;n.update=function(...o){e.bind(this)(...o),this.updateComplete?this.updateComplete.then((()=>{t.refresh()})):t.refresh()}}})(),this.updateComplete.then((()=>r())),i.values[0]&&i.values[0].addEventListener("ll-rebuild",r),i}}));customElements.whenDefined("hui-glance-card").then((()=>{const t=customElements.get("hui-glance-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){var o,s;null==e||e.bind(this)(...t);for(const t of this.shadowRoot.querySelectorAll("ha-card div.entity")){if(!t.cardmod_patched){t.cardmod_patched=!0;const e=t.attachShadow({mode:"open"});for(;t.firstChild;)e.append(t.firstChild);const o=document.createElement("style");e.appendChild(o),o.innerHTML="\ndiv {\n width: 100%;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.name {\n min-height: var(--paper-font-body1_-_line-height, 20px);\n}\nstate-badge {\n margin: 8px 0;\n}\n"}const e=t.config||t.entityConf;(null===(o=null==e?void 0:e.card_mod)||void 0===o?void 0:o.class)&&t.classList.add(e.card_mod.class),yt(t,"glance",(null===(s=null==e?void 0:e.card_mod)||void 0===s?void 0:s.style)||(null==e?void 0:e.style)||"",{config:e})}}})),customElements.whenDefined("hui-state-label-badge").then((()=>{const t=customElements.get("hui-state-label-badge");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=function(...t){var o,s;null==e||e.bind(this)(...t);const i=this._config;(null===(o=null==i?void 0:i.card_mod)||void 0===o?void 0:o.class)&&this.classList.add(i.card_mod.class),yt(this,"badge",(null===(s=null==i?void 0:i.card_mod)||void 0===s?void 0:s.style)||(null==i?void 0:i.style)||"",{config:i})}})),customElements.whenDefined("hui-view").then((()=>{const t=customElements.get("hui-view");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=function(...t){null==e||e.bind(this)(...t),yt(this,"view")}})),customElements.whenDefined("hui-root").then((()=>{const t=customElements.get("hui-root");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=async function(...t){null==e||e.bind(this)(...t),yt(this,"root")},ft(document,"home-assistant$home-assistant-main$app-drawer-layout partial-panel-resolver ha-panel-lovelace$hui-root",!1).then((t=>{null==t||t.firstUpdated()}))})),customElements.whenDefined("ha-more-info-dialog").then((()=>{const t=customElements.get("ha-more-info-dialog");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.showDialog;t.prototype.showDialog=function(t,...o){null==e||e.bind(this)(t,...o),this.requestUpdate(),this.updateComplete.then((async()=>{const e=this.shadowRoot.querySelector("ha-dialog");e&&yt(e,"more-info","",{config:t},null,!1)}))},ft(document,"home-assistant$ha-more-info-dialog",!1).then((e=>{e&&(e.showDialog=t.prototype.showDialog.bind(e),e.showDialog({entityId:e.entityId}))}))})),customElements.whenDefined("ha-sidebar").then((()=>{const t=customElements.get("ha-sidebar");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=async function(...t){null==e||e.bind(this)(...t),yt(this,"sidebar")},ft(document,"home-assistant$home-assistant-main$app-drawer-layout app-drawer ha-sidebar",!1).then((t=>null==t?void 0:t.firstUpdated()))})),customElements.whenDefined("hui-card-element-editor").then((()=>{const t=customElements.get("hui-card-element-editor");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.getConfigElement;t.prototype.getConfigElement=async function(){const t=await e.bind(this)();if(t){const e=t.setConfig;t.setConfig=function(t,...o){var s,i;const n=JSON.parse(JSON.stringify(t));if(this._cardModData={card:n.card_mod,entities:[]},n.entities)for(const[t,e]of null===(s=n.entities)||void 0===s?void 0:s.entries())this._cardModData.entities[t]=e.card_mod,delete e.card_mod;if(delete n.card_mod,e.bind(this)(n,...o),n.entities)for(const[t,e]of null===(i=n.entities)||void 0===i?void 0:i.entries())this._cardModData.entities[t]&&(e.card_mod=this._cardModData.entities[t])}}return t};const o=t.prototype._handleUIConfigChanged;t.prototype._handleUIConfigChanged=function(t,...e){if(this._configElement&&this._configElement._cardModData){const e=this._configElement._cardModData;e.card&&(t.detail.config.card_mod=e.card)}o.bind(this)(t,...e)}})),customElements.whenDefined("hui-dialog-edit-card").then((()=>{const t=customElements.get("hui-dialog-edit-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){null==e||e.bind(this)(...t),this.updateComplete.then((async()=>{var t,e,o;this._cardModIcon||(this._cardModIcon=document.createElement("ha-icon"),this._cardModIcon.icon="mdi:brush");const s=this.shadowRoot.querySelector("mwc-button[slot=secondaryAction]");s&&(s.appendChild(this._cardModIcon),(null===(t=this._cardConfig)||void 0===t?void 0:t.card_mod)||(null===(o=null===(e=this._cardConfig)||void 0===e?void 0:e.entities)||void 0===o?void 0:o.some((t=>t.card_mod)))?this._cardModIcon.style.visibility="visible":this._cardModIcon.style.visibility="hidden")}))}})),customElements.whenDefined("hui-picture-elements-card").then((()=>{const t=customElements.get("hui-picture-elements-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.setConfig;t.prototype.setConfig=function(...t){var o,s;null==e||e.bind(this)(...t);for(const[t,e]of this._elements.entries()){const i=this._config.elements[t];(null===(o=null==i?void 0:i.card_mod)||void 0===o?void 0:o.class)&&e.classList.add(i.card_mod.class),(null==i?void 0:i.type)&&e.classList.add(`type-${i.type.replace(":","-")}`),yt(e,"element",null===(s=null==i?void 0:i.card_mod)||void 0===s?void 0:s.style,{config:i})}}}));const At=t=>{const e=window.getComputedStyle(t);"none"===e.getPropertyValue("--card-mod-icon-dim")&&(t.style.filter="none");const o=e.getPropertyValue("--card-mod-icon");o&&(t.icon=o.trim());const s=e.getPropertyValue("--card-mod-icon-color");s&&(t.style.color=s)},St=async t=>{if(t.cardmod_bound)return;t.cardmod_bound=!0;const e=async()=>{const e=await Et(t);for(const o of e)o.addEventListener("card-mod-update",(async()=>{await o.updateComplete,At(t)}));return At(t),e};0==(await e()).size&&window.setTimeout((()=>e()),1e3)};customElements.whenDefined("ha-state-icon").then((()=>{const t=customElements.get("ha-state-icon");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){e.bind(this)(...t),St(this),At(this)}})),customElements.whenDefined("ha-icon").then((()=>{const t=customElements.get("ha-icon");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){null==e||e.bind(this)(...t),St(this)}})),customElements.whenDefined("ha-svg-icon").then((()=>{const t=customElements.get("ha-svg-icon");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){var o,s;null==e||e.bind(this)(...t),"ha-icon"!==(null===(s=null===(o=this.parentNode)||void 0===o?void 0:o.host)||void 0===s?void 0:s.localName)&&St(this)}}));const Ct="\nha-card {\n background: none;\n box-shadow: none;\n border: none;\n transition: none;\n}";class Nt extends tt{setConfig(t){var e;this._config=JSON.parse(JSON.stringify(t));let o=(null===(e=this._config.card_mod)||void 0===e?void 0:e.style)||this._config.style;void 0===o?o=Ct:"string"==typeof o?o=Ct+o:o["."]?o["."]=Ct+o["."]:o["."]=Ct,this._config.card_mod={style:o},this.build_card(t.card)}async build_card(t){void 0===this._hass&&await new Promise((t=>this._hassResolve=t)),this._hassResolve=void 0;const e=await window.loadCardHelpers();this.card=await e.createCardElement(t),this.card.hass=this._hass}firstUpdated(){window.setTimeout((()=>{var t,e;if(null===(e=null===(t=this.card)||void 0===t?void 0:t.shadowRoot)||void 0===e?void 0:e.querySelector("ha-card")){console.info("%cYou are doing it wrong!","color: red; font-weight: bold");let t=this.card.localName.replace(/hui-(.*)-card/,"$1");console.info(`mod-card should NEVER be used with a card that already has a ha-card element, such as ${t}`)}}),3e3)}set hass(t){this._hass=t,this.card&&(this.card.hass=t),this._hassResolve&&this._hassResolve()}render(){return T` ${this.card} `}getCardSize(){if(this._config.report_size)return this._config.report_size;let t=this.shadowRoot;return t&&(t=t.querySelector("ha-card card-maker")),t&&(t=t.getCardSize),t&&(t=t()),t||1}}function Pt(){document.dispatchEvent(new Event("cm_update"))}e([st()],Nt.prototype,"card",void 0),(async()=>{for(;void 0===customElements.get("home-assistant");)await new Promise((t=>window.setTimeout(t,100)));customElements.get("mod-card")||customElements.define("mod-card",Nt)})();const Ot=[customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")];Promise.race(Ot).then((()=>{window.setTimeout((async()=>{for(var e,o;!t();)await new Promise((t=>window.setTimeout(t,500)));t().connection.subscribeEvents((()=>{window.setTimeout(Pt,500)}),"themes_updated"),null===(e=document.querySelector("home-assistant"))||void 0===e||e.addEventListener("settheme",Pt),null===(o=document.querySelector("hc-main"))||void 0===o||o.addEventListener("settheme",Pt)}),1e3)}));const Ut=function(){var t,e,o;const s=document.querySelectorAll("script"),i=[];for(const n of s)if(null===(e=null===(t=null==n?void 0:n.innerText)||void 0===t?void 0:t.trim())||void 0===e?void 0:e.startsWith("import(")){const t=null===(o=n.innerText.split("\n"))||void 0===o?void 0:o.map((t=>t.trim()));for(const e of t)i.push(e.replace(/^import\(\"/,"").replace(/\"\);/,""))}return i}();Ut.some((t=>t.endsWith("card-mod.js")))||(!function(t,e,o=null){if((t=new Event(t,{bubbles:!0,cancelable:!1,composed:!0})).detail=e||{},o)o.dispatchEvent(t);else{var s=function(){var t=document.querySelector("hc-main");return t?(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("hc-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-view")||t.querySelector("hui-panel-view"):(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=document.querySelector("home-assistant"))&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root"))&&t.shadowRoot)&&t.querySelector("ha-app-layout"))&&t.querySelector("#view"))&&t.firstElementChild}();s&&s.dispatchEvent(t)}}("ll-rebuild",{}),console.info("You may not be getting optimal performance out of card-mod.\nSee https://github.com/thomasloven/lovelace-card-mod#performance-improvements")); + `}}e([st()],bt.prototype,"_rendered_styles",void 0),(async()=>{for(;void 0===customElements.get("home-assistant");)await new Promise((t=>window.setTimeout(t,100)));customElements.get("card-mod")||(customElements.define("card-mod",bt),console.info(`%cCARD-MOD ${pt} IS INSTALLED`,"color: green; font-weight: bold"))})(),customElements.whenDefined("ha-card").then((()=>{const t=customElements.get("ha-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=function(...t){var o,s;null==e||e.bind(this)(...t);const i=$t(this);(null===(o=null==i?void 0:i.card_mod)||void 0===o?void 0:o.class)&&this.classList.add(i.card_mod.class),(null==i?void 0:i.type)&&this.classList.add(`type-${i.type.replace(":","-")}`),yt(this,"card",(null===(s=null==i?void 0:i.card_mod)||void 0===s?void 0:s.style)||(null==i?void 0:i.style)||"",{config:i},null,!1).then((t=>{var e;const o=null===(e=this.parentNode)||void 0===e?void 0:e.host;if(o){if(o.setConfig&&!o.setConfig.cm_patched){const e=o.setConfig;o.setConfig=function(o,...s){var i;e.bind(this)(o,...s),t.variables={config:o},t.styles=(null===(i=o.card_mod)||void 0===i?void 0:i.style)||{}},o.setConfig.cm_patched=!0}if(o.update&&!o.update.cm_patched){const e=o.update;o.update=function(...o){e.bind(this)(...o),this.updateComplete?this.updateComplete.then((()=>{t.refresh()})):t.refresh()},o.update.cm_patched=!0}}}))}})),customElements.whenDefined("hui-entities-card").then((()=>{const t=customElements.get("hui-entities-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.renderEntity;t.prototype.renderEntity=function(t,...o){var s;const i=e.bind(this)(t,...o);if(!i||!i.values)return i;const n=i.values[0];if(!n)return i;if("custom:mod-card"===(null==t?void 0:t.type))return i;(null===(s=null==t?void 0:t.card_mod)||void 0===s?void 0:s.class)&&n.classList.add(t.card_mod.class),(null==t?void 0:t.type)&&n.classList.add(`type-${t.type.replace(":","-")}`);const r=async()=>{var e;return yt(n,"row",(null===(e=null==t?void 0:t.card_mod)||void 0===e?void 0:e.style)||(null==t?void 0:t.style)||"",{config:t})};return(async()=>{const t=await r();if(n.update&&!n.update.cm_patched){const e=n.update;n.update=function(...o){e.bind(this)(...o),this.updateComplete?this.updateComplete.then((()=>{t.refresh()})):t.refresh()}}})(),this.updateComplete.then((()=>r())),i.values[0]&&i.values[0].addEventListener("ll-rebuild",r),i}}));customElements.whenDefined("hui-glance-card").then((()=>{const t=customElements.get("hui-glance-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){var o,s;null==e||e.bind(this)(...t);for(const t of this.shadowRoot.querySelectorAll("ha-card div.entity")){if(!t.cardmod_patched){t.cardmod_patched=!0;const e=t.attachShadow({mode:"open"});for(;t.firstChild;)e.append(t.firstChild);const o=document.createElement("style");e.appendChild(o),o.innerHTML="\ndiv {\n width: 100%;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.name {\n min-height: var(--paper-font-body1_-_line-height, 20px);\n}\nstate-badge {\n margin: 8px 0;\n}\n"}const e=t.config||t.entityConf;(null===(o=null==e?void 0:e.card_mod)||void 0===o?void 0:o.class)&&t.classList.add(e.card_mod.class),yt(t,"glance",(null===(s=null==e?void 0:e.card_mod)||void 0===s?void 0:s.style)||(null==e?void 0:e.style)||"",{config:e})}}})),customElements.whenDefined("hui-state-label-badge").then((()=>{const t=customElements.get("hui-state-label-badge");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=function(...t){var o,s;null==e||e.bind(this)(...t);const i=this._config;(null===(o=null==i?void 0:i.card_mod)||void 0===o?void 0:o.class)&&this.classList.add(i.card_mod.class),yt(this,"badge",(null===(s=null==i?void 0:i.card_mod)||void 0===s?void 0:s.style)||(null==i?void 0:i.style)||"",{config:i})}})),customElements.whenDefined("hui-view").then((()=>{const t=customElements.get("hui-view");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){null==e||e.bind(this)(...t),yt(this,"view","",{},null,!1)}})),customElements.whenDefined("hui-root").then((()=>{const t=customElements.get("hui-root");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=async function(...t){null==e||e.bind(this)(...t),yt(this,"root")},ft(document,"home-assistant$home-assistant-main$mwc-drawer partial-panel-resolver ha-panel-lovelace$hui-root",!1).then((t=>{null==t||t.firstUpdated()}))})),customElements.whenDefined("ha-more-info-dialog").then((()=>{const t=customElements.get("ha-more-info-dialog");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.showDialog;t.prototype.showDialog=function(t,...o){null==e||e.bind(this)(t,...o),this.requestUpdate(),this.updateComplete.then((async()=>{const e=this.shadowRoot.querySelector("ha-dialog");e&&yt(e,"more-info","",{config:t},null,!1)}))},ft(document,"home-assistant$ha-more-info-dialog",!1).then((e=>{e&&(e.showDialog=t.prototype.showDialog.bind(e),e.showDialog({entityId:e.entityId}))}))})),customElements.whenDefined("ha-sidebar").then((()=>{const t=customElements.get("ha-sidebar");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.firstUpdated;t.prototype.firstUpdated=async function(...t){null==e||e.bind(this)(...t),yt(this,"sidebar")},ft(document,"home-assistant$home-assistant-main$mwc-drawer ha-sidebar",!1).then((t=>null==t?void 0:t.firstUpdated()))})),customElements.whenDefined("hui-card-element-editor").then((()=>{const t=customElements.get("hui-card-element-editor");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.getConfigElement;t.prototype.getConfigElement=async function(){const t=await e.bind(this)();if(t){const e=t.setConfig;t.setConfig=function(t,...o){var s,i;const n=JSON.parse(JSON.stringify(t));if(this._cardModData={card:n.card_mod,entities:[]},n.entities)for(const[t,e]of null===(s=n.entities)||void 0===s?void 0:s.entries())this._cardModData.entities[t]=e.card_mod,delete e.card_mod;if(delete n.card_mod,e.bind(this)(n,...o),n.entities)for(const[t,e]of null===(i=n.entities)||void 0===i?void 0:i.entries())this._cardModData.entities[t]&&(e.card_mod=this._cardModData.entities[t])}}return t};const o=t.prototype._handleUIConfigChanged;t.prototype._handleUIConfigChanged=function(t,...e){if(this._configElement&&this._configElement._cardModData){const e=this._configElement._cardModData;e.card&&(t.detail.config.card_mod=e.card)}o.bind(this)(t,...e)}})),customElements.whenDefined("hui-dialog-edit-card").then((()=>{const t=customElements.get("hui-dialog-edit-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){null==e||e.bind(this)(...t),this.updateComplete.then((async()=>{var t,e,o;this._cardModIcon||(this._cardModIcon=document.createElement("ha-icon"),this._cardModIcon.icon="mdi:brush");const s=this.shadowRoot.querySelector("mwc-button[slot=secondaryAction]");s&&(s.appendChild(this._cardModIcon),(null===(t=this._cardConfig)||void 0===t?void 0:t.card_mod)||(null===(o=null===(e=this._cardConfig)||void 0===e?void 0:e.entities)||void 0===o?void 0:o.some((t=>t.card_mod)))?this._cardModIcon.style.visibility="visible":this._cardModIcon.style.visibility="hidden")}))}})),customElements.whenDefined("hui-picture-elements-card").then((()=>{const t=customElements.get("hui-picture-elements-card");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.setConfig;t.prototype.setConfig=function(...t){var o,s;null==e||e.bind(this)(...t);for(const[t,e]of this._elements.entries()){const i=this._config.elements[t];(null===(o=null==i?void 0:i.card_mod)||void 0===o?void 0:o.class)&&e.classList.add(i.card_mod.class),(null==i?void 0:i.type)&&e.classList.add(`type-${i.type.replace(":","-")}`),yt(e,"element",null===(s=null==i?void 0:i.card_mod)||void 0===s?void 0:s.style,{config:i})}}}));const At=t=>{const e=window.getComputedStyle(t);"none"===e.getPropertyValue("--card-mod-icon-dim")&&(t.style.filter="none");const o=e.getPropertyValue("--card-mod-icon");o&&(t.icon=o.trim());const s=e.getPropertyValue("--card-mod-icon-color");s&&(t.style.color=s)},St=async t=>{if(t.cardmod_bound)return;t.cardmod_bound=!0;const e=async()=>{const e=await Et(t);for(const o of e)o.addEventListener("card-mod-update",(async()=>{await o.updateComplete,At(t)}));return At(t),e};0==(await e()).size&&window.setTimeout((()=>e()),1e3)};customElements.whenDefined("ha-state-icon").then((()=>{const t=customElements.get("ha-state-icon");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){e.bind(this)(...t),St(this),At(this)}})),customElements.whenDefined("ha-icon").then((()=>{const t=customElements.get("ha-icon");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){null==e||e.bind(this)(...t),St(this)}})),customElements.whenDefined("ha-svg-icon").then((()=>{const t=customElements.get("ha-svg-icon");if(t.prototype.cardmod_patched)return;t.prototype.cardmod_patched=!0;const e=t.prototype.updated;t.prototype.updated=function(...t){var o,s;null==e||e.bind(this)(...t),"ha-icon"!==(null===(s=null===(o=this.parentNode)||void 0===o?void 0:o.host)||void 0===s?void 0:s.localName)&&St(this)}}));const Ct="\nha-card {\n background: none;\n box-shadow: none;\n border: none;\n transition: none;\n}";class Nt extends tt{setConfig(t){var e;this._config=JSON.parse(JSON.stringify(t));let o=(null===(e=this._config.card_mod)||void 0===e?void 0:e.style)||this._config.style;void 0===o?o=Ct:"string"==typeof o?o=Ct+o:o["."]?o["."]=Ct+o["."]:o["."]=Ct,this._config.card_mod={style:o},this.build_card(t.card)}async build_card(t){void 0===this._hass&&await new Promise((t=>this._hassResolve=t)),this._hassResolve=void 0;const e=await window.loadCardHelpers();this.card=await e.createCardElement(t),this.card.hass=this._hass}firstUpdated(){window.setTimeout((()=>{var t,e;if(null===(e=null===(t=this.card)||void 0===t?void 0:t.shadowRoot)||void 0===e?void 0:e.querySelector("ha-card")){console.info("%cYou are doing it wrong!","color: red; font-weight: bold");let t=this.card.localName.replace(/hui-(.*)-card/,"$1");console.info(`mod-card should NEVER be used with a card that already has a ha-card element, such as ${t}`)}}),3e3)}set hass(t){this._hass=t,this.card&&(this.card.hass=t),this._hassResolve&&this._hassResolve()}render(){return T` ${this.card} `}getCardSize(){if(this._config.report_size)return this._config.report_size;let t=this.shadowRoot;return t&&(t=t.querySelector("ha-card card-maker")),t&&(t=t.getCardSize),t&&(t=t()),t||1}}function Pt(){document.dispatchEvent(new Event("cm_update"))}e([st()],Nt.prototype,"card",void 0),(async()=>{for(;void 0===customElements.get("home-assistant");)await new Promise((t=>window.setTimeout(t,100)));customElements.get("mod-card")||customElements.define("mod-card",Nt)})();const Ot=[customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")];Promise.race(Ot).then((()=>{window.setTimeout((async()=>{for(var e,o;!t();)await new Promise((t=>window.setTimeout(t,500)));t().connection.subscribeEvents((()=>{window.setTimeout(Pt,500)}),"themes_updated"),null===(e=document.querySelector("home-assistant"))||void 0===e||e.addEventListener("settheme",Pt),null===(o=document.querySelector("hc-main"))||void 0===o||o.addEventListener("settheme",Pt)}),1e3)}));const Rt=function(){var t,e,o;const s=document.querySelectorAll("script"),i=[];for(const n of s)if(null===(e=null===(t=null==n?void 0:n.innerText)||void 0===t?void 0:t.trim())||void 0===e?void 0:e.startsWith("import(")){const t=null===(o=n.innerText.split("\n"))||void 0===o?void 0:o.map((t=>t.trim()));for(const e of t)i.push(e.replace(/^import\(\"/,"").replace(/\"\);/,""))}return i}();Rt.some((t=>t.endsWith("card-mod.js")))||(!function(t,e,o=null){if((t=new Event(t,{bubbles:!0,cancelable:!1,composed:!0})).detail=e||{},o)o.dispatchEvent(t);else{var s=function(){var t=document.querySelector("hc-main");return t?(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("hc-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-view")||t.querySelector("hui-panel-view"):(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=document.querySelector("home-assistant"))&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root"))&&t.shadowRoot)&&t.querySelector("ha-app-layout"))&&t.querySelector("#view"))&&t.firstElementChild}();s&&s.dispatchEvent(t)}}("ll-rebuild",{}),console.info("You may not be getting optimal performance out of card-mod.\nSee https://github.com/thomasloven/lovelace-card-mod#performance-improvements")); diff --git a/www/community/lovelace-card-mod/card-mod.js.gz b/www/community/lovelace-card-mod/card-mod.js.gz index b3a1a150..dce30cfa 100644 Binary files a/www/community/lovelace-card-mod/card-mod.js.gz and b/www/community/lovelace-card-mod/card-mod.js.gz differ diff --git a/www/community/lovelace-mushroom/mushroom.js b/www/community/lovelace-mushroom/mushroom.js index 675bffa2..36f0c1da 100644 --- a/www/community/lovelace-mushroom/mushroom.js +++ b/www/community/lovelace-mushroom/mushroom.js @@ -3043,7 +3043,7 @@ Ts=Os,function(t,e,i,o){var n,r=["","webkit","Moz","MS","ms","o"],a=e.createElem mushroom-vacuum-commands-control { flex: 1; } - `]}};n([mt()],Bc.prototype,"_config",void 0),Bc=n([dt("mushroom-vacuum-card")],Bc),console.info("%c🍄 Mushroom 🍄 - 2.6.2","color: #ef5350; font-weight: 700;");const Uc=xe({tap_action:we(ti),hold_action:we(ti),double_tap_action:we(ti)}),Hc=t=>[{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}],Yc=xe({layout:we($e([be("horizontal"),be("vertical"),be("default")])),fill_container:we(_e()),primary_info:we(ve(Ya)),secondary_info:we(ve(Ya)),icon_type:we(ve(Xa))}),Xc=[{type:"grid",name:"",schema:[{name:"layout",selector:{"mush-layout":{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{"mush-info":{}}},{name:"secondary_info",selector:{"mush-info":{}}},{name:"icon_type",selector:{"mush-icon-type":{}}}]}],Wc=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],qc=()=>{var t,e;customElements.get("ha-form")||null===(t=customElements.get("hui-button-card"))||void 0===t||t.getConfigElement(),customElements.get("ha-entity-picker")||null===(e=customElements.get("hui-entities-card"))||void 0===e||e.getConfigElement()},Kc=xe({entity:we(ke()),name:we(ke()),icon:we(ke())}),Gc=xe({index:we(ye()),view_index:we(ye()),view_layout:fe(),type:ke()}),Zc=he(Gc,he(Kc,Yc,Uc),xe({states:we(ge()),show_keypad:we(_e())})),Jc=["more-info","navigate","url","call-service","none"],Qc=["armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass"],td=["show_keypad"],ed=xt(((t,e)=>[{name:"entity",selector:{entity:{domain:Ll}}},{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{placeholder:e}}},...Xc,{type:"multi_select",name:"states",options:Qc.map((e=>[e,t(`ui.card.alarm_control_panel.${e.replace("armed","arm")}`)]))},{name:"show_keypad",selector:{boolean:{}}},...Hc(Jc)]));let id=class extends wl{constructor(){super(...arguments),this._computeLabel=t=>{const e=ao(this.hass);return Wc.includes(t.name)?e(`editor.card.generic.${t.name}`):td.includes(t.name)?e(`editor.card.alarm_control_panel.${t.name}`):"states"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),qc()}setConfig(t){de(t,Zc),this._config=t}render(){if(!this.hass||!this._config)return B``;const t=this._config.entity?this.hass.states[this._config.entity]:void 0,e=t?Dl(t):void 0,i=this._config.icon||e,o=ed(this.hass.localize,i);return B` + `]}};n([mt()],Bc.prototype,"_config",void 0),Bc=n([dt("mushroom-vacuum-card")],Bc),console.info("%c🍄 Mushroom 🍄 - 2.6.3","color: #ef5350; font-weight: 700;");const Uc=xe({tap_action:we(ti),hold_action:we(ti),double_tap_action:we(ti)}),Hc=t=>[{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}],Yc=xe({layout:we($e([be("horizontal"),be("vertical"),be("default")])),fill_container:we(_e()),primary_info:we(ve(Ya)),secondary_info:we(ve(Ya)),icon_type:we(ve(Xa))}),Xc=[{type:"grid",name:"",schema:[{name:"layout",selector:{"mush-layout":{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{"mush-info":{}}},{name:"secondary_info",selector:{"mush-info":{}}},{name:"icon_type",selector:{"mush-icon-type":{}}}]}],Wc=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],qc=()=>{var t,e;customElements.get("ha-form")||null===(t=customElements.get("hui-button-card"))||void 0===t||t.getConfigElement(),customElements.get("ha-entity-picker")||null===(e=customElements.get("hui-entities-card"))||void 0===e||e.getConfigElement()},Kc=xe({entity:we(ke()),name:we(ke()),icon:we(ke())}),Gc=xe({index:we(ye()),view_index:we(ye()),view_layout:fe(),type:ke()}),Zc=he(Gc,he(Kc,Yc,Uc),xe({states:we(ge()),show_keypad:we(_e())})),Jc=["more-info","navigate","url","call-service","none"],Qc=["armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass"],td=["show_keypad"],ed=xt(((t,e)=>[{name:"entity",selector:{entity:{domain:Ll}}},{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{placeholder:e}}},...Xc,{type:"multi_select",name:"states",options:Qc.map((e=>[e,t(`ui.card.alarm_control_panel.${e.replace("armed","arm")}`)]))},{name:"show_keypad",selector:{boolean:{}}},...Hc(Jc)]));let id=class extends wl{constructor(){super(...arguments),this._computeLabel=t=>{const e=ao(this.hass);return Wc.includes(t.name)?e(`editor.card.generic.${t.name}`):td.includes(t.name)?e(`editor.card.alarm_control_panel.${t.name}`):"states"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),qc()}setConfig(t){de(t,Zc),this._config=t}render(){if(!this.hass||!this._config)return B``;const t=this._config.entity?this.hass.states[this._config.entity]:void 0,e=t?Dl(t):void 0,i=this._config.icon||e,o=ed(this.hass.localize,i);return B`