diff --git a/README.md b/README.md
index 61af98a8..bb6958a9 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.2.3%20(Latest)-brightgreen)](https://github.com/home-assistant/home-assistant/releases/latest)
+[![HA Version](https://img.shields.io/badge/Running%20Home%20Assistant-2023.2.5%20(Latest)-brightgreen)](https://github.com/home-assistant/home-assistant/releases/latest)
@@ -58,7 +58,7 @@ Also using Grafana/Influx for graphing, both running in Docker containers on NUC
Description | value
-- | --
Lines of ESPHome YAML | 2342
-Lines of Home Assistant YAML | 6867
+Lines of Home Assistant YAML | 6872
[Integrations](https://www.home-assistant.io/integrations/) in use | 44
Zigbee devices in [`zha`](https://www.home-assistant.io/integrations/zha/) | 26
Z-Wave devices in [`zwave_js`](https://www.home-assistant.io/integrations/zwave_js/) | 37
@@ -74,7 +74,7 @@ Entities in the [`camera`](https://www.home-assistant.io/components/camera) doma
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 | 20
+Entities in the [`device_tracker`](https://www.home-assistant.io/components/device_tracker) domain | 21
Entities in the [`fan`](https://www.home-assistant.io/components/fan) domain | 3
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 | 23
@@ -92,7 +92,7 @@ Entities in the [`remote`](https://www.home-assistant.io/components/remote) doma
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 | 46
Entities in the [`select`](https://www.home-assistant.io/components/select) domain | 22
-Entities in the [`sensor`](https://www.home-assistant.io/components/sensor) domain | 354
+Entities in the [`sensor`](https://www.home-assistant.io/components/sensor) domain | 355
Entities in the [`setter`](https://www.home-assistant.io/components/setter) domain | 1
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
@@ -102,7 +102,7 @@ Entities in the [`update`](https://www.home-assistant.io/components/update) doma
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** | **1137**
+**Total state objects** | **1139**
## The HACS integrations/plugins that I use:
**Appdaemon**:
[aneisch/follow_me_appdaemon](https://github.com/aneisch/follow_me_appdaemon)
diff --git a/automations.yaml b/automations.yaml
index 3bad11fc..14baac3d 100644
--- a/automations.yaml
+++ b/automations.yaml
@@ -575,9 +575,6 @@
- condition: time
weekday:
- sun
- - mon
- - wed
- - fri
- "{{ states('person.andrew') == 'home'}}"
action:
# Watchtower runs once at container start then turns back off
diff --git a/custom_components/aarlo/__init__.py b/custom_components/aarlo/__init__.py
index 2b089f7d..d8864339 100644
--- a/custom_components/aarlo/__init__.py
+++ b/custom_components/aarlo/__init__.py
@@ -28,7 +28,7 @@
from .pyaarlo.constant import DEFAULT_AUTH_HOST, DEFAULT_HOST, SIREN_STATE_KEY
-__version__ = "0.7.4b4"
+__version__ = "0.7.4b8"
_LOGGER = logging.getLogger(__name__)
@@ -70,6 +70,8 @@
CONF_TFA_HOST = "tfa_host"
CONF_TFA_USERNAME = "tfa_username"
CONF_TFA_PASSWORD = "tfa_password"
+CONF_TFA_TIMEOUT = "tfa_timeout"
+CONF_TFA_TOTAL_TIMEOUT = "tfa_total_timeout"
CONF_LIBRARY_DAYS = "library_days"
CONF_AUTH_HOST = "auth_host"
CONF_SERIAL_IDS = "serial_ids"
@@ -113,6 +115,8 @@
DEFAULT_TFA_HOST = "unknown.imap.com"
DEFAULT_TFA_USERNAME = "unknown@unknown.com"
DEFAULT_TFA_PASSWORD = "unknown"
+DEFAULT_TFA_TIMEOUT = timedelta(seconds=3)
+DEFAULT_TFA_TOTAL_TIMEOUT = timedelta(seconds=60)
DEFAULT_LIBRARY_DAYS = 30
SERIAL_IDS = False
STREAM_SNAPSHOT = False
@@ -187,6 +191,8 @@
vol.Optional(
CONF_TFA_PASSWORD, default=DEFAULT_TFA_PASSWORD
): cv.string,
+ vol.Optional(CONF_TFA_TIMEOUT, default=DEFAULT_TFA_TIMEOUT): cv.time_period,
+ vol.Optional(CONF_TFA_TOTAL_TIMEOUT, default=DEFAULT_TFA_TOTAL_TIMEOUT): cv.time_period,
vol.Optional(
CONF_LIBRARY_DAYS, default=DEFAULT_LIBRARY_DAYS
): cv.positive_int,
@@ -375,6 +381,8 @@ def login(hass, conf):
tfa_host = conf.get(CONF_TFA_HOST)
tfa_username = conf.get(CONF_TFA_USERNAME)
tfa_password = conf.get(CONF_TFA_PASSWORD)
+ tfa_timeout = int(conf.get(CONF_TFA_TIMEOUT).total_seconds())
+ tfa_total_timeout = int(conf.get(CONF_TFA_TOTAL_TIMEOUT).total_seconds())
library_days = conf.get(CONF_LIBRARY_DAYS)
serial_ids = conf.get(CONF_SERIAL_IDS)
stream_snapshot = conf.get(CONF_STREAM_SNAPSHOT)
@@ -433,6 +441,8 @@ def login(hass, conf):
tfa_host=tfa_host,
tfa_username=tfa_username,
tfa_password=tfa_password,
+ tfa_timeout=tfa_timeout,
+ tfa_total_timeout=tfa_total_timeout,
library_days=library_days,
serial_ids=serial_ids,
stream_snapshot=stream_snapshot,
diff --git a/custom_components/aarlo/alarm_control_panel.py b/custom_components/aarlo/alarm_control_panel.py
index 47bb546f..5773b35f 100644
--- a/custom_components/aarlo/alarm_control_panel.py
+++ b/custom_components/aarlo/alarm_control_panel.py
@@ -151,10 +151,10 @@ async def async_setup_platform(hass, config, async_add_entities, _discovery_info
async_add_entities(base_stations)
- _LOGGER.error("Adding Locations")
+ _LOGGER.debug("Adding Locations")
locations = []
for location in arlo.locations:
- _LOGGER.error("Locations Iterator")
+ _LOGGER.debug("Locations Iterator")
locations.append(ArloLocation(location, config))
async_add_entities(locations)
diff --git a/custom_components/aarlo/manifest.json b/custom_components/aarlo/manifest.json
index 7fd78550..cee2a160 100644
--- a/custom_components/aarlo/manifest.json
+++ b/custom_components/aarlo/manifest.json
@@ -6,6 +6,6 @@
"dependencies": ["ffmpeg"],
"codeowners": ["@twrecked"],
"requirements": ["unidecode","cloudscraper>=1.2.64", "paho-mqtt"],
- "version": "0.7.4b4",
+ "version": "0.7.4b8",
"iot_class": "cloud_push"
}
diff --git a/custom_components/aarlo/pyaarlo/__init__.py b/custom_components/aarlo/pyaarlo/__init__.py
index b82e0b81..a0497d3f 100644
--- a/custom_components/aarlo/pyaarlo/__init__.py
+++ b/custom_components/aarlo/pyaarlo/__init__.py
@@ -44,7 +44,7 @@
_LOGGER = logging.getLogger("pyaarlo")
-__version__ = "0.7.4b4"
+__version__ = "0.7.4b8"
class PyArlo(object):
@@ -305,32 +305,30 @@ def _v3_modes(self):
return self.cfg.mode_api.lower() == "v3"
def _refresh_devices(self):
+ """Read in the devices list.
+ This returns all devices known to the Arlo system. The newer devices
+ include state information - battery levels etc - while the old devices
+ don't. We update what we can.
+ """
url = DEVICES_PATH + "?t={}".format(time_to_arlotime())
self._devices = self._be.get(url)
if not self._devices:
self.warning("No devices returned from " + url)
self._devices = []
- self.vdebug("devices={}".format(pprint.pformat(self._devices)))
+ self.vdebug(f"devices={pprint.pformat(self._devices)}")
# Newer devices include information in this response. Be sure to update it.
for device in self._devices:
device_id = device.get("deviceId", None)
props = device.get("properties", None)
- if device_id is None or props is None:
- continue
- self.debug(f"updating {device_id} from device refresh")
- base = self.lookup_base_station_by_id(device_id)
- if base is not None:
- base.update_resources(props)
- camera = self.lookup_camera_by_id(device_id)
- if camera is not None:
- camera.update_resources(props)
- doorbell = self.lookup_doorbell_by_id(device_id)
- if doorbell is not None:
- doorbell.update_resources(props)
- light = self.lookup_light_by_id(device_id)
- if light is not None:
- light.update_resources(props)
+ self.vdebug(f"device-id={device_id}")
+ if device_id is not None and props is not None:
+ device = self.lookup_device_by_id(device_id)
+ if device is not None:
+ self.vdebug(f"updating {device_id} from device refresh")
+ device.update_resources(props)
+ else:
+ self.vdebug(f"not updating {device_id} from device refresh")
def _refresh_locations(self):
"""Retrieve location list from the backend
@@ -384,36 +382,7 @@ def _ping_bases(self):
def _refresh_bases(self, initial):
for base in self._bases:
base.update_modes(initial)
- if base.has_capability(RESOURCE_CAPABILITY):
- self._be.notify(
- base=base,
- body={
- "action": "get",
- "resource": "cameras",
- "publishResponse": False,
- },
- wait_for="response",
- )
- self._be.notify(
- base=base,
- body={
- "action": "get",
- "resource": "doorbells",
- "publishResponse": False,
- },
- wait_for="response",
- )
- self._be.notify(
- base=base,
- body={
- "action": "get",
- "resource": "lights",
- "publishResponse": False,
- },
- wait_for="response",
- )
- else:
- self.vdebug(f"NO resource for {base.device_id}")
+ base.update_states()
def _refresh_modes(self):
self.vdebug("refresh modes")
@@ -584,6 +553,10 @@ def locations(self):
"""
return self._locations
+ @property
+ def all_devices(self):
+ return self.cameras + self.doorbells + self.lights + self.base_stations + self.locations
+
@property
def sensors(self):
return self._sensors
@@ -695,6 +668,16 @@ def lookup_base_station_by_name(self, name):
return base_station[0]
return None
+ def lookup_device_by_id(self, device_id):
+ device = self.lookup_base_station_by_id(device_id)
+ if device is None:
+ device = self.lookup_camera_by_id(device_id)
+ if device is None:
+ device = self.lookup_doorbell_by_id(device_id)
+ if device is None:
+ device = self.lookup_light_by_id(device_id)
+ return device
+
def inject_response(self, response):
"""Inject a test packet into the event stream.
diff --git a/custom_components/aarlo/pyaarlo/backend.py b/custom_components/aarlo/pyaarlo/backend.py
index 7a057a07..ed41420d 100644
--- a/custom_components/aarlo/pyaarlo/backend.py
+++ b/custom_components/aarlo/pyaarlo/backend.py
@@ -254,6 +254,13 @@ def _event_dispatcher(self, response):
device_id = resource.split("/")[1]
responses.append((device_id, resource, response))
+ # Device status...
+ elif resource == 'devices':
+ for device_id in response.get('devices', {}):
+ self._arlo.debug(f"DEVICES={device_id}")
+ props = response['devices'][device_id]
+ responses.append((device_id, resource, props))
+
# These are base station responses. Which can be about the base station
# or devices on it... Check if property is list.
# Packet number #3/#2
diff --git a/custom_components/aarlo/pyaarlo/base.py b/custom_components/aarlo/pyaarlo/base.py
index cb32dcbe..06328a85 100644
--- a/custom_components/aarlo/pyaarlo/base.py
+++ b/custom_components/aarlo/pyaarlo/base.py
@@ -430,6 +430,20 @@ def update_modes(self, initial=False):
if curr_location:
curr_location.update_mode()
+ def update_states(self):
+ # Only do work on 'old' style base stations
+ if self.device_type == 'basestation' or self.device_type == 'arlobridge':
+ self.debug("updating state")
+ self._arlo.be.notify(
+ base=self,
+ body={
+ "action": "get",
+ "resource": "devices",
+ "publishResponse": False,
+ },
+ wait_for="response",
+ )
+
@property
def schedule(self):
"""Returns current schedule name or `None` if no schedule active."""
diff --git a/custom_components/aarlo/pyaarlo/constant.py b/custom_components/aarlo/pyaarlo/constant.py
index a02e5cd6..aa3831ad 100644
--- a/custom_components/aarlo/pyaarlo/constant.py
+++ b/custom_components/aarlo/pyaarlo/constant.py
@@ -62,6 +62,10 @@
EVENT_STREAM_TIMEOUT = (FAST_REFRESH_INTERVAL * 2) + 5
MODE_UPDATE_INTERVAL = 2
+# Device capabilities
+PING_CAPABILITY = "pingCapability"
+RESOURCE_CAPABILITY = "resourceCapability"
+
# update keys
ACTIVITY_STATE_KEY = "activityState"
AIR_QUALITY_KEY = "airQuality"
@@ -86,8 +90,6 @@
MOTION_STATE_KEY = "motionState"
MOTION_ENABLED_KEY = "motionSetupModeEnabled"
MOTION_SENS_KEY = "motionSetupModeSensitivity"
-PING_CAPABILITY = "pingCapability"
-RESOURCE_CAPABILITY = "resourceCapability"
POWER_SAVE_KEY = "powerSaveMode"
PRIVACY_KEY = "privacyActive"
LIGHT_BRIGHTNESS_KEY = "lightBrightness"
diff --git a/custom_components/aarlo/pyaarlo/tfa.py b/custom_components/aarlo/pyaarlo/tfa.py
index d5871d6d..ad5772d5 100644
--- a/custom_components/aarlo/pyaarlo/tfa.py
+++ b/custom_components/aarlo/pyaarlo/tfa.py
@@ -81,7 +81,7 @@ def start(self):
return False
self._new_ids = self._old_ids
- self._arlo.debug("old-ids={}".format(self._old_ids))
+ self._arlo.debug("2fa-imap: old-ids={}".format(self._old_ids))
if res.lower() == "ok":
return True
@@ -92,6 +92,7 @@ def get(self):
# give tfa_total_timeout seconds for email to arrive
start = time.time()
+ self._arlo.debug(f"2fa-imap: retry-every={self._arlo.cfg.tfa_timeout},up-to={self._arlo.cfg.tfa_total_timeout}")
while True:
# wait a short while, stop after a total timeout
diff --git a/custom_components/localtuya/common.py b/custom_components/localtuya/common.py
index 85ed21c7..cd503c2a 100644
--- a/custom_components/localtuya/common.py
+++ b/custom_components/localtuya/common.py
@@ -1,5 +1,6 @@
"""Code shared between all platforms."""
import asyncio
+import json.decoder
import logging
import time
from datetime import timedelta
@@ -176,12 +177,13 @@ def connected(self):
def async_connect(self):
"""Connect to device if not already connected."""
+ # self.info("async_connect: %d %r %r", self._is_closing, self._connect_task, self._interface)
if not self._is_closing and self._connect_task is None and not self._interface:
self._connect_task = asyncio.create_task(self._make_connection())
async def _make_connection(self):
"""Subscribe localtuya entity events."""
- self.debug("Connecting to %s", self._dev_config_entry[CONF_HOST])
+ self.info("Trying to connect to %s...", self._dev_config_entry[CONF_HOST])
try:
self._interface = await pytuya.connect(
@@ -193,24 +195,26 @@ async def _make_connection(self):
self,
)
self._interface.add_dps_to_request(self.dps_to_request)
- except Exception: # pylint: disable=broad-except
- self.exception(f"Connect to {self._dev_config_entry[CONF_HOST]} failed")
+ except Exception as ex: # pylint: disable=broad-except
+ self.warning(
+ f"Failed to connect to {self._dev_config_entry[CONF_HOST]}: %s", ex
+ )
if self._interface is not None:
await self._interface.close()
self._interface = None
if self._interface is not None:
try:
- self.debug("Retrieving initial state")
- status = await self._interface.status()
- if status is None:
- raise Exception("Failed to retrieve status")
+ try:
+ self.debug("Retrieving initial state")
+ status = await self._interface.status()
+ if status is None:
+ raise Exception("Failed to retrieve status")
- self._interface.start_heartbeat()
- self.status_updated(status)
+ self._interface.start_heartbeat()
+ self.status_updated(status)
- except Exception as ex: # pylint: disable=broad-except
- try:
+ except Exception as ex:
if (self._default_reset_dpids is not None) and (
len(self._default_reset_dpids) > 0
):
@@ -228,26 +232,19 @@ async def _make_connection(self):
self._interface.start_heartbeat()
self.status_updated(status)
+ else:
+ self.error("Initial state update failed, giving up: %r", ex)
+ if self._interface is not None:
+ await self._interface.close()
+ self._interface = None
- except UnicodeDecodeError as e: # pylint: disable=broad-except
- self.exception(
- f"Connect to {self._dev_config_entry[CONF_HOST]} failed: %s",
- type(e),
- )
- if self._interface is not None:
- await self._interface.close()
- self._interface = None
-
- except Exception as e: # pylint: disable=broad-except
- self.exception(
- f"Connect to {self._dev_config_entry[CONF_HOST]} failed"
- )
- if "json.decode" in str(type(e)):
- await self.update_local_key()
+ except (UnicodeDecodeError, json.decoder.JSONDecodeError) as ex:
+ self.warning("Initial state update failed (%s), trying key update", ex)
+ await self.update_local_key()
- if self._interface is not None:
- await self._interface.close()
- self._interface = None
+ if self._interface is not None:
+ await self._interface.close()
+ self._interface = None
if self._interface is not None:
# Attempt to restore status for all entities that need to first set
@@ -270,14 +267,16 @@ def _new_entity_handler(entity_id):
if (
CONF_SCAN_INTERVAL in self._dev_config_entry
- and self._dev_config_entry[CONF_SCAN_INTERVAL] > 0
+ and int(self._dev_config_entry[CONF_SCAN_INTERVAL]) > 0
):
self._unsub_interval = async_track_time_interval(
self._hass,
self._async_refresh,
- timedelta(seconds=self._dev_config_entry[CONF_SCAN_INTERVAL]),
+ timedelta(seconds=int(self._dev_config_entry[CONF_SCAN_INTERVAL])),
)
+ self.info(f"Successfully connected to {self._dev_config_entry[CONF_HOST]}")
+
self._connect_task = None
async def update_local_key(self):
@@ -310,7 +309,7 @@ async def close(self):
await self._interface.close()
if self._disconnect_task is not None:
self._disconnect_task()
- self.debug(
+ self.info(
"Closed connection with device %s.",
self._dev_config_entry[CONF_FRIENDLY_NAME],
)
@@ -358,7 +357,11 @@ def disconnected(self):
self._unsub_interval()
self._unsub_interval = None
self._interface = None
- self.debug("Disconnected - waiting for discovery broadcast")
+
+ if self._connect_task is not None:
+ self._connect_task.cancel()
+ self._connect_task = None
+ self.warning("Disconnected - waiting for discovery broadcast")
class LocalTuyaEntity(RestoreEntity, pytuya.ContextualLogger):
diff --git a/custom_components/localtuya/config_flow.py b/custom_components/localtuya/config_flow.py
index 0099901e..d4272d41 100644
--- a/custom_components/localtuya/config_flow.py
+++ b/custom_components/localtuya/config_flow.py
@@ -140,7 +140,7 @@ def options_schema(entities):
["3.1", "3.2", "3.3", "3.4"]
),
vol.Required(CONF_ENABLE_DEBUG, default=False): bool,
- vol.Optional(CONF_SCAN_INTERVAL): cv.string,
+ vol.Optional(CONF_SCAN_INTERVAL): int,
vol.Optional(CONF_MANUAL_DPS): cv.string,
vol.Optional(CONF_RESET_DPIDS): cv.string,
vol.Required(
@@ -256,20 +256,21 @@ async def validate_input(hass: core.HomeAssistant, data):
)
try:
detected_dps = await interface.detect_available_dps()
- except Exception: # pylint: disable=broad-except
+ except Exception as ex:
try:
- _LOGGER.debug("Initial state update failed, trying reset command")
+ _LOGGER.debug(
+ "Initial state update failed (%s), trying reset command", ex
+ )
if len(reset_ids) > 0:
await interface.reset(reset_ids)
detected_dps = await interface.detect_available_dps()
- except Exception: # pylint: disable=broad-except
- _LOGGER.debug("No DPS able to be detected")
+ except Exception as ex:
+ _LOGGER.debug("No DPS able to be detected: %s", ex)
detected_dps = {}
# if manual DPs are set, merge these.
_LOGGER.debug("Detected DPS: %s", detected_dps)
if CONF_MANUAL_DPS in data:
-
manual_dps_list = [dps.strip() for dps in data[CONF_MANUAL_DPS].split(",")]
_LOGGER.debug(
"Manual DPS Setting: %s (%s)", data[CONF_MANUAL_DPS], manual_dps_list
@@ -493,8 +494,8 @@ async def async_step_add_device(self, user_input=None):
errors["base"] = "address_in_use"
else:
errors["base"] = "discovery_failed"
- except Exception: # pylint: disable= broad-except
- _LOGGER.exception("discovery failed")
+ except Exception as ex:
+ _LOGGER.exception("discovery failed: %s", ex)
errors["base"] = "discovery_failed"
devices = {
@@ -586,16 +587,28 @@ async def async_step_configure_device(self, user_input=None):
errors["base"] = "invalid_auth"
except EmptyDpsList:
errors["base"] = "empty_dps"
- except Exception: # pylint: disable=broad-except
- _LOGGER.exception("Unexpected exception")
+ except Exception as ex:
+ _LOGGER.exception("Unexpected exception: %s", ex)
errors["base"] = "unknown"
defaults = {}
if self.editing_device:
# If selected device exists as a config entry, load config from it
defaults = self.config_entry.data[CONF_DEVICES][dev_id].copy()
- schema = schema_defaults(options_schema(self.entities), **defaults)
+ cloud_devs = self.hass.data[DOMAIN][DATA_CLOUD].device_list
placeholders = {"for_device": f" for device `{dev_id}`"}
+ if dev_id in cloud_devs:
+ cloud_local_key = cloud_devs[dev_id].get(CONF_LOCAL_KEY)
+ if defaults[CONF_LOCAL_KEY] != cloud_local_key:
+ _LOGGER.info(
+ "New local_key detected: new %s vs old %s",
+ cloud_local_key,
+ defaults[CONF_LOCAL_KEY],
+ )
+ defaults[CONF_LOCAL_KEY] = cloud_devs[dev_id].get(CONF_LOCAL_KEY)
+ note = "\nNOTE: a new local_key has been retrieved using cloud API"
+ placeholders = {"for_device": f" for device `{dev_id}`.{note}"}
+ schema = schema_defaults(options_schema(self.entities), **defaults)
else:
defaults[CONF_PROTOCOL_VERSION] = "3.3"
defaults[CONF_HOST] = ""
diff --git a/custom_components/localtuya/cover.py b/custom_components/localtuya/cover.py
index 3b6b86de..b45669ca 100644
--- a/custom_components/localtuya/cover.py
+++ b/custom_components/localtuya/cover.py
@@ -108,13 +108,13 @@ def is_closing(self):
def is_closed(self):
"""Return if the cover is closed or not."""
if self._config[CONF_POSITIONING_MODE] == COVER_MODE_NONE:
- return None
+ return False
if self._current_cover_position == 0:
return True
if self._current_cover_position == 100:
return False
- return None
+ return False
async def async_set_cover_position(self, **kwargs):
"""Move the cover to a specific position."""
diff --git a/custom_components/localtuya/pytuya/__init__.py b/custom_components/localtuya/pytuya/__init__.py
index ad546c4c..472274ab 100644
--- a/custom_components/localtuya/pytuya/__init__.py
+++ b/custom_components/localtuya/pytuya/__init__.py
@@ -444,11 +444,14 @@ async def wait_for(self, seqno, cmd, timeout=5):
if seqno in self.listeners:
raise Exception(f"listener exists for {seqno}")
- self.debug("Command %d waiting for sequence number %d", cmd, seqno)
+ self.debug("Command %d waiting for seq. number %d", cmd, seqno)
self.listeners[seqno] = asyncio.Semaphore(0)
try:
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
except asyncio.TimeoutError:
+ self.warning(
+ "Command %d timed out waiting for sequence number %d", cmd, seqno
+ )
del self.listeners[seqno]
raise
@@ -478,8 +481,11 @@ def _dispatch(self, msg):
if msg.seqno in self.listeners:
# self.debug("Dispatching sequence number %d", msg.seqno)
sem = self.listeners[msg.seqno]
- self.listeners[msg.seqno] = msg
- sem.release()
+ if isinstance(sem, asyncio.Semaphore):
+ self.listeners[msg.seqno] = msg
+ sem.release()
+ else:
+ self.debug("Got additional message without request - skipping: %s", sem)
elif msg.cmd == HEART_BEAT:
self.debug("Got heartbeat response")
if self.HEARTBEAT_SEQNO in self.listeners:
@@ -511,7 +517,7 @@ def _dispatch(self, msg):
if msg.cmd == CONTROL_NEW:
self.debug("Got ACK message for command %d: will ignore it", msg.cmd)
else:
- self.error(
+ self.debug(
"Got message type %d for unknown listener %d: %s",
msg.cmd,
msg.seqno,
@@ -917,9 +923,11 @@ def _decode_payload(self, payload):
if not isinstance(payload, str):
try:
payload = payload.decode()
- except Exception:
+ except Exception as ex:
self.debug("payload was not string type and decoding failed")
- return self.error_json(ERR_JSON, payload)
+ raise DecodeError("payload was not a string: %s", ex)
+ # return self.error_json(ERR_JSON, payload)
+
if "data unvalid" in payload:
self.dev_type = "type_0d"
self.debug(
@@ -937,7 +945,8 @@ def _decode_payload(self, payload):
try:
json_payload = json.loads(payload)
except Exception:
- json_payload = self.error_json(ERR_JSON, payload)
+ raise DecodeError("could not decrypt data: wrong local_key?")
+ # json_payload = self.error_json(ERR_JSON, payload)
# v3.4 stuffs it into {"data":{"dps":{"1":true}}, ...}
if (
diff --git a/custom_components/mail_and_packages/const.py b/custom_components/mail_and_packages/const.py
index 0bca4fb9..ad0c38b1 100644
--- a/custom_components/mail_and_packages/const.py
+++ b/custom_components/mail_and_packages/const.py
@@ -12,7 +12,7 @@
DOMAIN = "mail_and_packages"
DOMAIN_DATA = f"{DOMAIN}_data"
-VERSION = "0.3.9"
+VERSION = "0.3.10"
ISSUE_URL = "http://github.com/moralmunky/Home-Assistant-Mail-And-Packages"
PLATFORM = "sensor"
PLATFORMS = ["binary_sensor", "camera", "sensor"]
@@ -431,6 +431,20 @@
},
"dhl_parcel_nl_packages": {},
"dhl_parcel_nl_tracking": {"pattern": ["[0-9A-Z]{12,24}"]},
+ # Bonshaw Distribution Network
+ "bonshaw_distribution_network_delivered": {
+ "email": ["parcel_tracking@bonshawdelivery.com"],
+ "subject": ["Parcel Delivered! Commande Livrée!"],
+ },
+ "bonshaw_distribution_network_delivering": {
+ "email": ["parcel_tracking@bonshawdelivery.com"],
+ "subject": ["Parcel Out for Delivery! En attente de livraison!"],
+ },
+ "bonshaw_distribution_network_packages": {
+ "email": ["parcel_tracking@bonshawdelivery.com"],
+ "subject": ["Your package has been received!"],
+ },
+ "bonshaw_distribution_network_tracking": {"pattern": ["BNI[0-9]{9}"]},
# Purolator
"purolator_delivered": {
"email": ["NotificationService@purolator.com"],
@@ -779,6 +793,25 @@
icon="mdi:package-variant-closed",
key="dhl_parcel_nl_packages",
),
+ # Bonshaw Distribution Network
+ "bonshaw_distribution_network_delivered": SensorEntityDescription(
+ name="Mail Bonshaw Distribution Network Delivered",
+ native_unit_of_measurement="package(s)",
+ icon="mdi:package-variant",
+ key="bonshaw_distribution_network_delivered",
+ ),
+ "bonshaw_distribution_network_delivering": SensorEntityDescription(
+ name="Mail Bonshaw Distribution Network Delivering",
+ native_unit_of_measurement="package(s)",
+ icon="mdi:truck-delivery",
+ key="bonshaw_distribution_network_delivering",
+ ),
+ "bonshaw_distribution_network_packages": SensorEntityDescription(
+ name="Mail Bonshaw Distribution Network Packages",
+ native_unit_of_measurement="package(s)",
+ icon="mdi:package-variant-closed",
+ key="bonshaw_distribution_network_packages",
+ ),
# Purolator
"purolator_delivered": SensorEntityDescription(
name="Mail Purolator Delivered",
@@ -888,6 +921,7 @@
"dpd_com_pl",
"gls",
"dhl_parcel_nl",
+ "bonshaw_distribution_network",
"purolator",
"intelcom",
]
diff --git a/custom_components/mail_and_packages/helpers.py b/custom_components/mail_and_packages/helpers.py
index 83045604..66f15c7e 100644
--- a/custom_components/mail_and_packages/helpers.py
+++ b/custom_components/mail_and_packages/helpers.py
@@ -309,7 +309,6 @@ def hash_file(filename: str) -> str:
# open file for reading in binary mode
with open(filename, "rb") as file:
-
# loop till the end of the file
chunk = 0
while chunk != b"":
@@ -918,7 +917,6 @@ def get_count(
subjects = SENSOR_DATA[sensor_type][ATTR_SUBJECT]
for subject in subjects:
-
_LOGGER.debug(
"Attempting to find mail from (%s) with subject (%s)",
SENSOR_DATA[sensor_type][ATTR_EMAIL],
diff --git a/custom_components/mail_and_packages/manifest.json b/custom_components/mail_and_packages/manifest.json
index 46ff13d8..e93263fb 100644
--- a/custom_components/mail_and_packages/manifest.json
+++ b/custom_components/mail_and_packages/manifest.json
@@ -12,5 +12,5 @@
"integration_type": "service",
"requirements": ["beautifulsoup4","Pillow>=9.0"],
"iot_class": "cloud_polling",
- "version": "0.3.9"
+ "version": "0.3.10"
}
\ No newline at end of file
diff --git a/extras/Node-RED/flows.json b/extras/Node-RED/flows.json
index dd524250..6e35e04d 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","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":250,"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,"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":310,"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":"Drip","info":"","x":150,"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":160,"y":760,"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":290,"y":1680,"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":300,"y":1620,"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":1160,"y":1620,"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":820,"y":1800,"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":480,"y":1740,"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":830,"y":1680,"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":550,"y":1680,"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":830,"y":1560,"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":530,"y":1560,"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":840,"y":1620,"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":790,"y":1740,"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":1070,"y":1760,"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":1270,"y":1720,"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":1050,"y":1720,"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":1010,"y":1620,"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":390,"y":760,"wires":[["8c060f00.cf577"],["7b12e66f.57d068"]]},{"id":"9f3dd0a4.22c76","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":230,"y":960,"wires":[["3b42f047.f6721"]]},{"id":"3b42f047.f6721","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":420,"y":960,"wires":[["dcdeabc7.780578"],["773941a7.152da"]]},{"id":"773941a7.152da","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{ \"state\": \"Rainfall\", \"attributes\": {\"friendly_name\":\"Sprinkler Reason\", \"icon\":\"mdi:weather-lightning-rainy\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":1000,"wires":[[]]},{"id":"7b12e66f.57d068","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{ \"state\": \"Automation Off\", \"attributes\": {\"friendly_name\":\"Sprinkler Reason\", \"icon\":\"mdi:cancel\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":800,"wires":[[]]},{"id":"8c060f00.cf577","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","576b66fa1bd202a3"],"x":575,"y":740,"wires":[]},{"id":"3290b2c2.62032e","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{ \"state\": \"Rain Chance\", \"attributes\": {\"friendly_name\":\"Sprinkler Reason\", \"icon\":\"mdi:weather-lightning-rainy\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":1120,"wires":[[]]},{"id":"4422f61c.847d88","type":"link in","z":"f602e6ba.609d28","name":"","links":["3ff9ce03ef7b554b"],"x":115,"y":960,"wires":[["9f3dd0a4.22c76"]]},{"id":"dcdeabc7.780578","type":"link out","z":"f602e6ba.609d28","name":"","links":["1eaa857e.b6b8db","c90fd5e6.c5c678"],"x":575,"y":940,"wires":[]},{"id":"722d03d6.2ff77c","type":"link in","z":"f602e6ba.609d28","name":"","links":["8d4bfe8e.ee805","d67106b42368e630"],"x":115,"y":1400,"wires":[["d40b6c7e.af78d"]]},{"id":"af4788fe.215ba8","type":"link out","z":"f602e6ba.609d28","name":"","links":["405789f7.0727a8"],"x":575,"y":1420,"wires":[]},{"id":"405789f7.0727a8","type":"link in","z":"f602e6ba.609d28","name":"","links":["db46e0c1.f9ab5","af4788fe.215ba8"],"x":75,"y":1560,"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":220,"y":1560,"wires":[["857c8b4f.d19808"]]},{"id":"5933da9a.d9f024","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Lawn Zones","info":"","x":300,"y":1520,"wires":[]},{"id":"c90fd5e6.c5c678","type":"link in","z":"f602e6ba.609d28","name":"","links":["dcdeabc7.780578"],"x":115,"y":1080,"wires":[["870d9d95.e93ce"]]},{"id":"862ad27a.d347d","type":"link out","z":"f602e6ba.609d28","name":"","links":["83edf648.3f9ed8"],"x":575,"y":1060,"wires":[]},{"id":"870d9d95.e93ce","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":220,"y":1080,"wires":[["21d9168d.46ef5a"]]},{"id":"21d9168d.46ef5a","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":410,"y":1080,"wires":[["862ad27a.d347d"],["3290b2c2.62032e"]]},{"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":"499b8bfb.3152a4","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{\"state\":\"Too Windy\",\"attributes\":{\"friendly_name\":\"Sprinkler Reason\",\"icon\":\"mdi:weather-windy\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":1320,"wires":[[]]},{"id":"83edf648.3f9ed8","type":"link in","z":"f602e6ba.609d28","name":"","links":["862ad27a.d347d"],"x":115,"y":1200,"wires":[["2720fe53.e6c2d2"]]},{"id":"8d4bfe8e.ee805","type":"link out","z":"f602e6ba.609d28","name":"","links":["722d03d6.2ff77c"],"x":575,"y":1180,"wires":[]},{"id":"2720fe53.e6c2d2","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.nws_wind_speed","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":250,"y":1200,"wires":[["8d4bfe8e.ee805"],["a3d75225807b70eb"]]},{"id":"70dfaa6a.be6a74","type":"inject","z":"f602e6ba.609d28","d":true,"name":"08:00","props":[{"p":"payload"}],"repeat":"","crontab":"00 05 * * 1,2,3,4,5","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":"5 Min","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":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":"10 Min","pauseType":"delay","timeout":"10","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":850,"y":580,"wires":[["b60d2f74.cc7f6"]]},{"id":"b76b5030.7d402","type":"comment","z":"f602e6ba.609d28","name":"Release Pressure","info":"","x":1000,"y":540,"wires":[]},{"id":"edc724f1.d2e458","type":"comment","z":"f602e6ba.609d28","name":"Lawn Attempt","info":"","x":170,"y":680,"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":820,"y":740,"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.lawn_irrigation_scheduling","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":1050,"y":740,"wires":[["c7e5552e.7f8a08"],[]]},{"id":"804ab203.434e4","type":"api-get-history","z":"f602e6ba.609d28","name":"Rainfall 24h","server":"e1dc0b88.463bb8","version":0,"startdate":"","enddate":"","entityid":"sensor.netatmo_home_rain_sum_rain_today_inches","entityidtype":"is","useRelativeTime":true,"relativeTime":"24h","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":890,"y":1080,"wires":[["c50a5938.e47538"]]},{"id":"c50a5938.e47538","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":1080,"y":1080,"wires":[["f587589f.d739e8"],[]]},{"id":"c7e5552e.7f8a08","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","f6881b4bf93c27c5"],"x":1235,"y":740,"wires":[]},{"id":"6bcf06fb.9ca748","type":"link in","z":"f602e6ba.609d28","name":"","links":["4f2902edc77f2d3b"],"x":775,"y":1080,"wires":[["804ab203.434e4"]]},{"id":"f587589f.d739e8","type":"link out","z":"f602e6ba.609d28","name":"","links":["1eaa857e.b6b8db","9d851699.6a8458"],"x":1235,"y":1080,"wires":[]},{"id":"d9d17e8f.590e6","type":"link in","z":"f602e6ba.609d28","name":"","links":["4fae5b92.a9cd44","fdcfa1521191fa40"],"x":775,"y":1440,"wires":[["418058c4.af3158"]]},{"id":"d9f893eb.834f3","type":"link out","z":"f602e6ba.609d28","name":"","links":["5ce1803b.06628"],"x":1235,"y":1440,"wires":[]},{"id":"9d851699.6a8458","type":"link in","z":"f602e6ba.609d28","name":"","links":["f587589f.d739e8"],"x":775,"y":1200,"wires":[["c3279051.91a85"]]},{"id":"760894e3.db2a9c","type":"link out","z":"f602e6ba.609d28","name":"","links":["ceef2a94.9378c8"],"x":1235,"y":1200,"wires":[]},{"id":"c3279051.91a85","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":880,"y":1200,"wires":[["20b5172c.13dd58"]]},{"id":"20b5172c.13dd58","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":1070,"y":1200,"wires":[["760894e3.db2a9c"],[]]},{"id":"ceef2a94.9378c8","type":"link in","z":"f602e6ba.609d28","name":"","links":["760894e3.db2a9c"],"x":775,"y":1320,"wires":[["2bf89956.475926"]]},{"id":"4fae5b92.a9cd44","type":"link out","z":"f602e6ba.609d28","name":"","links":["d9d17e8f.590e6"],"x":1235,"y":1320,"wires":[]},{"id":"2bf89956.475926","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.nws_wind_speed","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":910,"y":1320,"wires":[["4fae5b92.a9cd44"],[]]},{"id":"aaacee72.fc35a","type":"comment","z":"f602e6ba.609d28","name":"Front Beds Attempt","info":"","x":850,"y":680,"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":230,"y":1880,"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":540,"y":1880,"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":710,"y":1880,"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":860,"y":1880,"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":1070,"y":1880,"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":830,"y":1940,"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":880,"y":2020,"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":1110,"y":2000,"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":1030,"y":1940,"wires":[["d83b5ff7a2212931"]]},{"id":"5ce1803b.06628","type":"link in","z":"f602e6ba.609d28","name":"","links":["db46e0c1.f9ab5","d9f893eb.834f3"],"x":75,"y":1880,"wires":[["a2ab7368.923fb"]]},{"id":"2afa6b1a.8012b4","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Front Beds","info":"","x":290,"y":1840,"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":450,"y":1420,"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":890,"y":1440,"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":820,"y":840,"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":1030,"y":800,"wires":[[]]},{"id":"d40b6c7e.af78d","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{\"state\":\"None\",\"attributes\":{\"friendly_name\":\"Sprinkler Reason\",\"icon\":\"mdi:check\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":270,"y":1380,"wires":[["815fddc0.6604c"]]},{"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":230,"y":860,"wires":[["5420d0eed32223fb"],["3ff9ce03ef7b554b"]]},{"id":"5420d0eed32223fb","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","08e3098cf183e086"],"x":475,"y":840,"wires":[]},{"id":"3ff9ce03ef7b554b","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","4422f61c.847d88"],"x":475,"y":880,"wires":[]},{"id":"576b66fa1bd202a3","type":"link in","z":"f602e6ba.609d28","name":"","links":["8c060f00.cf577"],"x":115,"y":860,"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":890,"y":960,"wires":[["fdcfa1521191fa40"],["4f2902edc77f2d3b"]]},{"id":"fdcfa1521191fa40","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","d9d17e8f.590e6"],"x":1235,"y":920,"wires":[]},{"id":"4f2902edc77f2d3b","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","6bcf06fb.9ca748"],"x":1235,"y":980,"wires":[]},{"id":"f6881b4bf93c27c5","type":"link in","z":"f602e6ba.609d28","name":"","links":["c7e5552e.7f8a08"],"x":775,"y":960,"wires":[["7350c911a0b1a86d"]]},{"id":"9ebfc0893b208a38","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{\"state\":\"Force Run\",\"attributes\":{\"friendly_name\":\"Sprinkler Reason\",\"icon\":\"mdi:check\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":270,"y":1460,"wires":[["815fddc0.6604c"]]},{"id":"08e3098cf183e086","type":"link in","z":"f602e6ba.609d28","name":"","links":["5420d0eed32223fb"],"x":115,"y":1440,"wires":[["9ebfc0893b208a38"]]},{"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":1050,"y":860,"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":550,"y":1620,"wires":[["b7ac1681.a64af8"],["5eaebc41.9491c4"]]},{"id":"8f026440401a841f","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.nws_wind_speed","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":250,"y":1320,"wires":[["d67106b42368e630"],["499b8bfb.3152a4"]]},{"id":"a3d75225807b70eb","type":"delay","z":"f602e6ba.609d28","name":"1 Hour Delay","pauseType":"delay","timeout":"1","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":250,"y":1260,"wires":[["8f026440401a841f"]]},{"id":"d67106b42368e630","type":"link out","z":"f602e6ba.609d28","name":"","links":["722d03d6.2ff77c"],"x":575,"y":1260,"wires":[]},{"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 >= 23 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 >= 23*3600 %}1{% else %}0{% endif %}","output":"str","x":290,"y":1940,"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":230,"y":2000,"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":510,"y":2000,"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":1250,"y":1940,"wires":[[]]}]
\ 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","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":250,"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,"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":310,"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 25 min","info":"","x":300,"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":160,"y":760,"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":290,"y":1680,"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":300,"y":1620,"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":1160,"y":1620,"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":820,"y":1800,"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":480,"y":1740,"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":830,"y":1680,"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":550,"y":1680,"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":830,"y":1560,"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":530,"y":1560,"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":840,"y":1620,"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":790,"y":1740,"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":1070,"y":1760,"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":1270,"y":1720,"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":1050,"y":1720,"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":1010,"y":1620,"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":390,"y":760,"wires":[["8c060f00.cf577"],["7b12e66f.57d068"]]},{"id":"9f3dd0a4.22c76","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":230,"y":960,"wires":[["3b42f047.f6721"]]},{"id":"3b42f047.f6721","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":420,"y":960,"wires":[["dcdeabc7.780578"],["773941a7.152da"]]},{"id":"773941a7.152da","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{ \"state\": \"Rainfall\", \"attributes\": {\"friendly_name\":\"Sprinkler Reason\", \"icon\":\"mdi:weather-lightning-rainy\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":1000,"wires":[[]]},{"id":"7b12e66f.57d068","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{ \"state\": \"Automation Off\", \"attributes\": {\"friendly_name\":\"Sprinkler Reason\", \"icon\":\"mdi:cancel\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":800,"wires":[[]]},{"id":"8c060f00.cf577","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","576b66fa1bd202a3"],"x":575,"y":740,"wires":[]},{"id":"3290b2c2.62032e","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{ \"state\": \"Rain Chance\", \"attributes\": {\"friendly_name\":\"Sprinkler Reason\", \"icon\":\"mdi:weather-lightning-rainy\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":1120,"wires":[[]]},{"id":"4422f61c.847d88","type":"link in","z":"f602e6ba.609d28","name":"","links":["3ff9ce03ef7b554b"],"x":115,"y":960,"wires":[["9f3dd0a4.22c76"]]},{"id":"dcdeabc7.780578","type":"link out","z":"f602e6ba.609d28","name":"","links":["1eaa857e.b6b8db","c90fd5e6.c5c678"],"x":575,"y":940,"wires":[]},{"id":"722d03d6.2ff77c","type":"link in","z":"f602e6ba.609d28","name":"","links":["8d4bfe8e.ee805","d67106b42368e630"],"x":115,"y":1400,"wires":[["d40b6c7e.af78d"]]},{"id":"af4788fe.215ba8","type":"link out","z":"f602e6ba.609d28","name":"","links":["405789f7.0727a8"],"x":575,"y":1420,"wires":[]},{"id":"405789f7.0727a8","type":"link in","z":"f602e6ba.609d28","name":"","links":["db46e0c1.f9ab5","af4788fe.215ba8"],"x":75,"y":1560,"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":220,"y":1560,"wires":[["857c8b4f.d19808"]]},{"id":"5933da9a.d9f024","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Lawn Zones","info":"","x":300,"y":1520,"wires":[]},{"id":"c90fd5e6.c5c678","type":"link in","z":"f602e6ba.609d28","name":"","links":["dcdeabc7.780578"],"x":115,"y":1080,"wires":[["870d9d95.e93ce"]]},{"id":"862ad27a.d347d","type":"link out","z":"f602e6ba.609d28","name":"","links":["83edf648.3f9ed8"],"x":575,"y":1060,"wires":[]},{"id":"870d9d95.e93ce","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":220,"y":1080,"wires":[["21d9168d.46ef5a"]]},{"id":"21d9168d.46ef5a","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":410,"y":1080,"wires":[["862ad27a.d347d"],["3290b2c2.62032e"]]},{"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":"499b8bfb.3152a4","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{\"state\":\"Too Windy\",\"attributes\":{\"friendly_name\":\"Sprinkler Reason\",\"icon\":\"mdi:weather-windy\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":1320,"wires":[[]]},{"id":"83edf648.3f9ed8","type":"link in","z":"f602e6ba.609d28","name":"","links":["862ad27a.d347d"],"x":115,"y":1200,"wires":[["2720fe53.e6c2d2"]]},{"id":"8d4bfe8e.ee805","type":"link out","z":"f602e6ba.609d28","name":"","links":["722d03d6.2ff77c"],"x":575,"y":1180,"wires":[]},{"id":"2720fe53.e6c2d2","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.nws_wind_speed","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":250,"y":1200,"wires":[["8d4bfe8e.ee805"],["a3d75225807b70eb"]]},{"id":"70dfaa6a.be6a74","type":"inject","z":"f602e6ba.609d28","name":"08:00","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":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":"20 Min","pauseType":"delay","timeout":"20","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":"10 Min","pauseType":"delay","timeout":"10","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":680,"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":820,"y":740,"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.lawn_irrigation_scheduling","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","x":1050,"y":740,"wires":[["c7e5552e.7f8a08"],[]]},{"id":"804ab203.434e4","type":"api-get-history","z":"f602e6ba.609d28","name":"Rainfall 24h","server":"e1dc0b88.463bb8","version":0,"startdate":"","enddate":"","entityid":"sensor.netatmo_home_rain_sum_rain_today_inches","entityidtype":"is","useRelativeTime":true,"relativeTime":"24h","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":890,"y":1080,"wires":[["c50a5938.e47538"]]},{"id":"c50a5938.e47538","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":1080,"y":1080,"wires":[["f587589f.d739e8"],[]]},{"id":"c7e5552e.7f8a08","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","f6881b4bf93c27c5"],"x":1235,"y":740,"wires":[]},{"id":"6bcf06fb.9ca748","type":"link in","z":"f602e6ba.609d28","name":"","links":["4f2902edc77f2d3b"],"x":775,"y":1080,"wires":[["804ab203.434e4"]]},{"id":"f587589f.d739e8","type":"link out","z":"f602e6ba.609d28","name":"","links":["1eaa857e.b6b8db","9d851699.6a8458"],"x":1235,"y":1080,"wires":[]},{"id":"d9d17e8f.590e6","type":"link in","z":"f602e6ba.609d28","name":"","links":["4fae5b92.a9cd44","fdcfa1521191fa40"],"x":775,"y":1440,"wires":[["418058c4.af3158"]]},{"id":"d9f893eb.834f3","type":"link out","z":"f602e6ba.609d28","name":"","links":["5ce1803b.06628"],"x":1235,"y":1440,"wires":[]},{"id":"9d851699.6a8458","type":"link in","z":"f602e6ba.609d28","name":"","links":["f587589f.d739e8"],"x":775,"y":1200,"wires":[["c3279051.91a85"]]},{"id":"760894e3.db2a9c","type":"link out","z":"f602e6ba.609d28","name":"","links":["ceef2a94.9378c8"],"x":1235,"y":1200,"wires":[]},{"id":"c3279051.91a85","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":880,"y":1200,"wires":[["20b5172c.13dd58"]]},{"id":"20b5172c.13dd58","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":1070,"y":1200,"wires":[["760894e3.db2a9c"],[]]},{"id":"ceef2a94.9378c8","type":"link in","z":"f602e6ba.609d28","name":"","links":["760894e3.db2a9c"],"x":775,"y":1320,"wires":[["2bf89956.475926"]]},{"id":"4fae5b92.a9cd44","type":"link out","z":"f602e6ba.609d28","name":"","links":["d9d17e8f.590e6"],"x":1235,"y":1320,"wires":[]},{"id":"2bf89956.475926","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.nws_wind_speed","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":910,"y":1320,"wires":[["4fae5b92.a9cd44"],[]]},{"id":"aaacee72.fc35a","type":"comment","z":"f602e6ba.609d28","name":"Front Beds Attempt","info":"","x":850,"y":680,"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":230,"y":1880,"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":540,"y":1880,"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":710,"y":1880,"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":860,"y":1880,"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":1070,"y":1880,"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":830,"y":1940,"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":880,"y":2020,"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":1110,"y":2000,"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":1030,"y":1940,"wires":[["d83b5ff7a2212931"]]},{"id":"5ce1803b.06628","type":"link in","z":"f602e6ba.609d28","name":"","links":["db46e0c1.f9ab5","d9f893eb.834f3"],"x":75,"y":1880,"wires":[["a2ab7368.923fb"]]},{"id":"2afa6b1a.8012b4","type":"comment","z":"f602e6ba.609d28","name":"Scheduled Sprinklers -- Run Front Beds","info":"","x":290,"y":1840,"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":450,"y":1420,"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":890,"y":1440,"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":820,"y":840,"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":1030,"y":800,"wires":[[]]},{"id":"d40b6c7e.af78d","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{\"state\":\"None\",\"attributes\":{\"friendly_name\":\"Sprinkler Reason\",\"icon\":\"mdi:check\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":270,"y":1380,"wires":[["815fddc0.6604c"]]},{"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":230,"y":860,"wires":[["5420d0eed32223fb"],["3ff9ce03ef7b554b"]]},{"id":"5420d0eed32223fb","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","08e3098cf183e086"],"x":475,"y":840,"wires":[]},{"id":"3ff9ce03ef7b554b","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","4422f61c.847d88"],"x":475,"y":880,"wires":[]},{"id":"576b66fa1bd202a3","type":"link in","z":"f602e6ba.609d28","name":"","links":["8c060f00.cf577"],"x":115,"y":860,"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":890,"y":960,"wires":[["fdcfa1521191fa40"],["4f2902edc77f2d3b"]]},{"id":"fdcfa1521191fa40","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","d9d17e8f.590e6"],"x":1235,"y":920,"wires":[]},{"id":"4f2902edc77f2d3b","type":"link out","z":"f602e6ba.609d28","name":"","links":["f1cbfe0.7dfb4","6bcf06fb.9ca748"],"x":1235,"y":980,"wires":[]},{"id":"f6881b4bf93c27c5","type":"link in","z":"f602e6ba.609d28","name":"","links":["c7e5552e.7f8a08"],"x":775,"y":960,"wires":[["7350c911a0b1a86d"]]},{"id":"9ebfc0893b208a38","type":"api-call-service","z":"f602e6ba.609d28","name":"Set Reason","server":"e1dc0b88.463bb8","version":5,"debugenabled":false,"domain":"setter","service":"set","areaId":[],"deviceId":[],"entityId":["sensor.sprinker_interrupt_reason"],"data":"{\"state\":\"Force Run\",\"attributes\":{\"friendly_name\":\"Sprinkler Reason\",\"icon\":\"mdi:check\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":270,"y":1460,"wires":[["815fddc0.6604c"]]},{"id":"08e3098cf183e086","type":"link in","z":"f602e6ba.609d28","name":"","links":["5420d0eed32223fb"],"x":115,"y":1440,"wires":[["9ebfc0893b208a38"]]},{"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":1050,"y":860,"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":550,"y":1620,"wires":[["b7ac1681.a64af8"],["5eaebc41.9491c4"]]},{"id":"8f026440401a841f","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.nws_wind_speed","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":250,"y":1320,"wires":[["d67106b42368e630"],["499b8bfb.3152a4"]]},{"id":"a3d75225807b70eb","type":"delay","z":"f602e6ba.609d28","name":"1 Hour Delay","pauseType":"delay","timeout":"1","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":250,"y":1260,"wires":[["8f026440401a841f"]]},{"id":"d67106b42368e630","type":"link out","z":"f602e6ba.609d28","name":"","links":["722d03d6.2ff77c"],"x":575,"y":1260,"wires":[]},{"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 >= 23 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 >= 23*3600 %}1{% else %}0{% endif %}","output":"str","x":290,"y":1940,"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":230,"y":2000,"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":510,"y":2000,"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":1250,"y":1940,"wires":[[]]}]
\ No newline at end of file
diff --git a/images/nodered_1.png b/images/nodered_1.png
index 8cfe425b..9e68f0c8 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 d9fca00f..14d54e71 100644
Binary files a/images/nodered_2.png and b/images/nodered_2.png differ
diff --git a/images/nodered_3.png b/images/nodered_3.png
index 26177985..4edae359 100644
Binary files a/images/nodered_3.png and b/images/nodered_3.png differ
diff --git a/packages/irrigation.yaml b/packages/irrigation.yaml
index 479018a9..8d7c6af7 100644
--- a/packages/irrigation.yaml
+++ b/packages/irrigation.yaml
@@ -13,23 +13,23 @@ input_boolean:
name: Lawn Irrigation Auto Run
icon: mdi:clock-time-two-outline
- # drip_irrigation_scheduling:
- # name: Drip Irrigation Auto Run
- # icon: mdi:clock-time-two-outline
+ drip_irrigation_scheduling:
+ name: Drip Irrigation Auto Run
+ icon: mdi:clock-time-two-outline
irrigation_force_run:
name: "Force Scheduled Run"
icon: mdi:sprinkler-variant
input_datetime:
- # irrigation_drip_last_start:
- # name: Sprinkler Drip Last Start Time
- # has_date: true
- # has_time: true
- # irrigation_drip_last_stop:
- # name: Sprinkler Drip Last Stop Time
- # has_date: true
- # has_time: true
+ irrigation_drip_last_start:
+ name: Sprinkler Drip Last Start Time
+ has_date: true
+ has_time: true
+ irrigation_drip_last_stop:
+ name: Sprinkler Drip Last Stop Time
+ has_date: true
+ has_time: true
irrigation_front_beds_last_start:
name: Sprinkler Front Beds Last Start Time
@@ -155,7 +155,7 @@ automation:
trigger:
platform: state
entity_id:
- # - switch.irrigation_drip
+ - switch.irrigation_drip
- switch.irrigation_front_beds
- switch.irrigation_front_lawn
- switch.irrigation_left_and_main_rear_lawn
diff --git a/scripts.yaml b/scripts.yaml
index bbdcd128..08d4e5ab 100644
--- a/scripts.yaml
+++ b/scripts.yaml
@@ -27,23 +27,25 @@ home_occupied:
- service: homeassistant.turn_off
data:
entity_id: input_boolean.security_status
- - service: light.turn_on
- data:
- entity_id:
- - light.master_bedroom_lamps
- #- light.living_room_sconces
- # Not so bright if it's late..
- brightness: >
- {% if now().hour >= 20 %}
- 128
- {% else %}
- 254
- {% endif %}
- - service: homeassistant.turn_on
- data:
- entity_id:
- - group.under_cabinet_lights
- - group.christmas # dining, office, master tree follow 'on' via appdaemon
+ - if: "{{ now().hour >= 18 }}"
+ then:
+ - service: light.turn_on
+ data:
+ entity_id:
+ - light.master_bedroom_lamps
+ #- light.living_room_sconces
+ # Not so bright if it's late..
+ brightness: >
+ {% if now().hour >= 20 %}
+ 128
+ {% else %}
+ 254
+ {% endif %}
+ - service: homeassistant.turn_on
+ data:
+ entity_id:
+ - group.under_cabinet_lights
+ #- group.christmas # dining, office, master tree follow 'on' via appdaemon
############
# SECURITY #
@@ -58,8 +60,8 @@ security_disarm:
- service: ifttt.trigger
data:
event: disarm
- - service: alarm_control_panel.alarm_disarm
- entity_id: !secret alarm_panel_2
+ #- service: alarm_control_panel.alarm_disarm
+ # entity_id: !secret alarm_panel_2
- service: alarm_control_panel.alarm_arm_home
entity_id: alarm_control_panel.college_station_mode
- service: script.notify_wrapper
@@ -75,8 +77,8 @@ security_arm:
- service: ifttt.trigger
data:
event: arm
- - service: alarm_control_panel.alarm_arm_away
- entity_id: !secret alarm_panel_2
+ #- service: alarm_control_panel.alarm_arm_away
+ # entity_id: !secret alarm_panel_2
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.college_station_mode
- service: script.notify_wrapper
@@ -94,10 +96,13 @@ master_bedroom_wakeup:
# - service: script.turn_on
# entity_id:
# - script.christmas_wakeup
- - service: alarm_control_panel.alarm_disarm
- entity_id: !secret alarm_panel_2
+ #- service: alarm_control_panel.alarm_disarm
+ # entity_id: !secret alarm_panel_2
- service: alarm_control_panel.alarm_arm_home
entity_id: alarm_control_panel.college_station_mode
+ - service: ifttt.trigger
+ data:
+ event: disarm
- service: switch.turn_off
data:
entity_id: switch.master_bedroom_ceiling_fan
@@ -138,10 +143,13 @@ master_bedroom_bedtime:
- service: homeassistant.turn_off
data:
entity_id: group.off_at_bedtime
- - service: alarm_control_panel.alarm_arm_away
- entity_id: !secret alarm_panel_2
+ #- service: alarm_control_panel.alarm_arm_away
+ # entity_id: !secret alarm_panel_2
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.college_station_mode
+ - service: ifttt.trigger
+ data:
+ event: arm
- service: homeassistant.turn_on
entity_id: input_boolean.goodnight
- service: lock.lock
@@ -156,88 +164,88 @@ master_bedroom_bedtime:
- light.guest_bedroom_nightstand_lamp
- light.back_bedroom_nightstand_lamp
-christmas_goodnight:
- mode: 'restart'
- # Play Christmas music, say goodnight, fade music out, and turn off tree
- sequence:
- - service: switch.turn_on
- entity_id: switch.master_bedroom_christmas_tree
- - service: media_player.select_source
- data:
- entity_id: media_player.spotify
- source: "Master"
- - delay: '00:00:03'
- - service: media_player.volume_set
- data:
- entity_id: media_player.spotify
- volume_level: 0.50
- # - service: media_player.shuffle_set
- # data:
- # shuffle: true
- # entity_id: media_player.spotify
- - service: media_player.play_media
- data:
- media_content_id: spotify:track:3XsaSIPWvM61RIFfeb0BBR
- media_content_type: music
- entity_id: media_player.spotify
- - delay: "00:00:05"
- - service: media_player.volume_set
- data:
- entity_id: media_player.spotify
- volume_level: 0.50
- - delay: "00:01:35" # Don't play the whole song
- - service: notify.alexa_media_master
- data:
- data:
- type: tts
- method: speak
- message: "And to all a good night"
- - delay: '00:00:05'
- - service: switch.turn_off
- entity_id: switch.master_bedroom_christmas_tree
- # Fade music out
- - repeat:
- while: "{{ state_attr('media_player.spotify', 'volume_level') > 0 }}"
- sequence:
- - service: media_player.volume_set
- data_template:
- entity_id: media_player.spotify
- volume_level: >
- {{ state_attr('media_player.spotify', 'volume_level') - 0.02 }}
- - delay:
- seconds: 0.4
- - service: media_player.media_pause
- data_template:
- entity_id: media_player.spotify
+# christmas_goodnight:
+# mode: 'restart'
+# # Play Christmas music, say goodnight, fade music out, and turn off tree
+# sequence:
+# - service: switch.turn_on
+# entity_id: switch.master_bedroom_christmas_tree
+# - service: media_player.select_source
+# data:
+# entity_id: media_player.spotify
+# source: "Master"
+# - delay: '00:00:03'
+# - service: media_player.volume_set
+# data:
+# entity_id: media_player.spotify
+# volume_level: 0.50
+# # - service: media_player.shuffle_set
+# # data:
+# # shuffle: true
+# # entity_id: media_player.spotify
+# - service: media_player.play_media
+# data:
+# media_content_id: spotify:track:3XsaSIPWvM61RIFfeb0BBR
+# media_content_type: music
+# entity_id: media_player.spotify
+# - delay: "00:00:05"
+# - service: media_player.volume_set
+# data:
+# entity_id: media_player.spotify
+# volume_level: 0.50
+# - delay: "00:01:35" # Don't play the whole song
+# - service: notify.alexa_media_master
+# data:
+# data:
+# type: tts
+# method: speak
+# message: "And to all a good night"
+# - delay: '00:00:05'
+# - service: switch.turn_off
+# entity_id: switch.master_bedroom_christmas_tree
+# # Fade music out
+# - repeat:
+# while: "{{ state_attr('media_player.spotify', 'volume_level') > 0 }}"
+# sequence:
+# - service: media_player.volume_set
+# data_template:
+# entity_id: media_player.spotify
+# volume_level: >
+# {{ state_attr('media_player.spotify', 'volume_level') - 0.02 }}
+# - delay:
+# seconds: 0.4
+# - service: media_player.media_pause
+# data_template:
+# entity_id: media_player.spotify
-christmas_wakeup:
- mode: 'restart'
- sequence:
- - service: switch.turn_on
- entity_id: switch.master_bedroom_christmas_tree
- - service: media_player.select_source
- data:
- entity_id: media_player.spotify
- source: "Master"
- - delay: '00:00:03'
- - service: media_player.volume_set
- data:
- entity_id: media_player.spotify
- volume_level: 0.40
- - service: media_player.play_media
- data:
- media_content_id: spotify:track:6cgDUe244IMHFGLqg9A2hD
- media_content_type: music
- entity_id: media_player.spotify
- - delay: "00:00:05"
- - service: media_player.volume_set
- data:
- entity_id: media_player.spotify
- volume_level: 0.40
- - delay: '00:02:12'
- - service: media_player.media_pause
- data_template:
- entity_id: media_player.spotify
+# christmas_wakeup:
+# mode: 'restart'
+# sequence:
+# - service: switch.turn_on
+# entity_id: switch.master_bedroom_christmas_tree
+# - service: media_player.select_source
+# data:
+# entity_id: media_player.spotify
+# source: "Master"
+# - delay: '00:00:03'
+# - service: media_player.volume_set
+# data:
+# entity_id: media_player.spotify
+# volume_level: 0.40
+# - service: media_player.play_media
+# data:
+# media_content_id: spotify:track:6cgDUe244IMHFGLqg9A2hD
+# media_content_type: music
+# entity_id: media_player.spotify
+# - delay: "00:00:05"
+# - service: media_player.volume_set
+# data:
+# entity_id: media_player.spotify
+# volume_level: 0.40
+# - delay: '00:02:12'
+# - service: media_player.media_pause
+# data_template:
+# entity_id: media_player.spotify
#########
# OTHER #
diff --git a/ui-lovelace/11-irrigation.yaml b/ui-lovelace/11-irrigation.yaml
index 7c2a92a4..2a154f32 100644
--- a/ui-lovelace/11-irrigation.yaml
+++ b/ui-lovelace/11-irrigation.yaml
@@ -3,7 +3,7 @@ icon: mdi:sprinkler
cards:
- type: 'entities'
entities:
- # - input_boolean.drip_irrigation_scheduling
+ - input_boolean.drip_irrigation_scheduling
- input_boolean.lawn_irrigation_scheduling
- input_boolean.irrigation_force_run
- entity: sensor.sprinker_interrupt_reason
@@ -53,7 +53,7 @@ cards:
- type: markdown
content: |
- {% set irrigation = ["switch.irrigation_front_beds", "switch.irrigation_front_lawn", "switch.irrigation_left_and_main_rear_lawn", "switch.irrigation_front_and_right_rear_lawn", "switch.irrigation_side_lawn", "switch.irrigation_master_valve" ] %}
+ {% set irrigation = ["switch.irrigation_drip","switch.irrigation_front_beds", "switch.irrigation_front_lawn", "switch.irrigation_left_and_main_rear_lawn", "switch.irrigation_front_and_right_rear_lawn", "switch.irrigation_side_lawn", "switch.irrigation_master_valve" ] %}
{% for sprinkler_zone in irrigation -%}
{%- set entity_name = "input_datetime" + sprinkler_zone | regex_replace(find='switch', replace='', ignorecase=False) -%}
{% if states(sprinkler_zone) == "on" %}