From b69aed0029ab72a05faad36dc836d1ae69c2b0e7 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Fri, 13 Jun 2025 21:04:38 -0400 Subject: [PATCH] Day/night function node for sleep switch --- climate/master-bedroom/day-night.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 climate/master-bedroom/day-night.js diff --git a/climate/master-bedroom/day-night.js b/climate/master-bedroom/day-night.js new file mode 100644 index 0000000..e6d27a9 --- /dev/null +++ b/climate/master-bedroom/day-night.js @@ -0,0 +1,15 @@ +const states = global.get('homeassistant.homeAssistant.states') +const earlyNight = states['binary_sensor.early_night_mode'].state +const payload = msg.payload + +if (payload === 'off') { + if (earlyNight === 'on') { + msg.mode = 'Night Mode' + } else { + msg.mode = 'Day Mode' + } +} else if (payload === 'on') { + msg.mode = 'Bedtime Mode' +} + +return msg \ No newline at end of file