[ { "id": "600f7a12.5ee66c", "type": "tab", "label": "Security", "disabled": false, "info": "" }, { "id": "75c53969.aa5438", "type": "tab", "label": "Wake up & mosquito", "disabled": false, "info": "" }, { "id": "f02b32ef07b4b378", "type": "tab", "label": "Home Audio", "disabled": false, "info": "", "env": [] }, { "id": "da896085.24c698", "type": "tab", "label": "Home Media", "disabled": true, "info": "" }, { "id": "1f4d4622.7490ca", "type": "tab", "label": "Temperature & climate" }, { "id": "a9edb9da.ccb6d", "type": "tab", "label": "Motion detection", "disabled": true, "info": "" }, { "id": "bbf25964.5edb38", "type": "tab", "label": "Coffee-mations", "disabled": false, "info": "", "env": [ { "name": "CC_SESSION", "value": ":AZ2NbsiaAAH_Q4PXQ8QC4IKaxnbA-REcTy6arZkkXGKZ6f4fi5SL2pWtSCFv0hS2ghCx6TVYDOeXS2v3y4lAiiWH0GtuwVegxq_JHBmRvCHbVZ0LOvoW9MuJ4nTKn5zLYX3gcCfyYMLYas0zeBq2DtGKbPKVzQFmCtYf3ux2iYvUOlRJubiCGliLHLmAU-_vVyQwoSbHLuAqKRYbSWP3dZWTi5XRVbvcLgL9zhjN7fqPOxPUvNka_2S5Dz25JvYoVfRdTbdzRmA0UcyJZoEFpCrrAfyBeheCzdIuLxZxV5DhCCChgkUsSFf0L5dAI3hhYd-UAgbDBc1FCRcXdYocv6byXn6w7U7hqT77o--lcGcsa2og5eXr95WJY5WQ9Ny3ynUFO2a6t7Mkse3ai4-66UPIrlOE0LJZuLWn32-KcoymGn41Oh1JrsUkig_KY0SCkIUoChJeWgw10UCZwgiTeTwCZdDfStuV83NThyjaTCdqv3Hde8L6zCMdjwQePmlqSXSnmMd6sEOux7ZRTjEZoalpE3D-7jC3QDfPBoiPGBO23QAqlQdLl96uFmwzpeWlulkl_ZUPETmLYahii91xRqojLxtpWzZrSvly0Dwc0ZOUsU5LPTtaj1ASOBqmQ6UWjGXyb3PaTyIzzlDeX2FDfcL6W5InpJkW7G34aXNMYEm-G50uSJbskyWbAjq5GwHcNfhuJOHik5XtfkIf0BmDUzR-rpxYAfbxJy6tHQiFCIQp6Ad9DEhLUIXCw3zMGRF2zkK_-dXU93J8Oq7dDOxjDMFM1ShTmU4j6454JKO06CupTZLsmU1N0Dz5YSM5rx2sy3bbg_3HFRz_aS5E1GwC3wY6r6gydldOCvk6hXFQy245q3wejuVdPFCFhH3HNzr_Ej5iNpuuV4QdPMtzjKCEzAsKrFx7JALuQtmj2ZviU6TMKHNOaojh561NvMk2xVC0dEuTtcHM3Gh_fOirB12g2fT8ZMBtnNQ-G5BaQvmXNNAXyHhURrNwxxonvdrzQGm2QKriFz38Bihp2IOmroJRyMEiFBb1Cq8GSNTdgu9yOy3gsTG2v9s5Z5ETOyWZTh_Wr9_CNJtsE0lrlAenmWwRlAxvKIG-xGWYCaCrgJh0XY6_QGV2AokbYzJAW7QPK6pqPY-VFWARSEibQ2zg8ilvSTdExQ8daZsNugchEr6etzM2oDVXf5M-PFFVKLVExACUFhHH2lY1wFoxTFf8PiFgd_Qm6NdFmaV08WK-e5_atBQPKtjaFc3HdR4gwgOAnE8sRYGt8yUNmywcMPrXYiAK4QPtxxnnK3k:", "type": "str" } ] }, { "id": "a320f821a7cb3f55", "type": "tab", "label": "Maintenance" }, { "id": "752771ce8fd82a19", "type": "tab", "label": "Claude Test" }, { "id": "97e0f1338e182d76", "type": "tab", "label": "Bedroom" }, { "id": "b70ee13eafa73823", "type": "tab", "label": "Living room" }, { "id": "5af82cd4c44df066", "type": "tab", "label": "Kitchen" }, { "id": "10cbea6aaac127cd", "type": "tab", "label": "Balcony", "disabled": false, "info": "", "env": [] }, { "id": "e52c44dc.71cb5", "type": "subflow", "name": "Is it Night?", "info": "Determines if the current time is between the _Night Time_ and the _Morning Time_ settings in Home Assistant.", "category": "", "in": [ { "x": 140, "y": 140, "wires": [ { "id": "dc7ddc2d53abc038" } ] } ], "out": [ { "x": 780, "y": 160, "wires": [ { "id": "dc7ddc2d53abc038", "port": 5 } ] }, { "x": 800, "y": 100, "wires": [ { "id": "dc7ddc2d53abc038", "port": 0 }, { "id": "dc7ddc2d53abc038", "port": 1 }, { "id": "dc7ddc2d53abc038", "port": 2 }, { "id": "dc7ddc2d53abc038", "port": 3 }, { "id": "dc7ddc2d53abc038", "port": 4 } ] } ], "env": [], "meta": {}, "color": "#DDAA99", "outputLabels": [ "After night time", "Before morning time " ] }, { "id": "091c97d9c8d81499", "type": "subflow", "name": "JSON Escape", "info": "", "category": "", "in": [ { "x": 120, "y": 140, "wires": [ { "id": "9e4fac23fd2c73ed" } ] } ], "out": [ { "x": 520, "y": 140, "wires": [ { "id": "9e4fac23fd2c73ed", "port": 0 } ] } ], "env": [], "meta": {}, "color": "#DDAA99" }, { "id": "52430f5e9f9ee267", "type": "subflow", "name": "Which timeslot are we in?", "info": "", "category": "", "in": [ { "x": 100, "y": 160, "wires": [ { "id": "f4da808dc4c218b6" }, { "id": "25fe3f965108a4f8" }, { "id": "910e431ab636c701" }, { "id": "1029462b97e1cc7c" }, { "id": "c263329e3207423d" }, { "id": "6a5d6248d66d5303" } ] } ], "out": [ { "x": 1760, "y": 440, "wires": [ { "id": "b884e557f9524784", "port": 0 } ] }, { "x": 1760, "y": 480, "wires": [ { "id": "06f7380c6f28bdd1", "port": 0 } ] }, { "x": 1780, "y": 520, "wires": [ { "id": "41de38d16e68d1d9", "port": 0 } ] }, { "x": 1760, "y": 560, "wires": [ { "id": "4d992d3713228542", "port": 0 } ] }, { "x": 1770, "y": 600, "wires": [ { "id": "25b5aff2dea58057", "port": 0 } ] }, { "x": 1750, "y": 640, "wires": [ { "id": "5f0e5f63552a97f2", "port": 0 } ] } ], "env": [], "meta": {}, "color": "#DDAA99", "inputLabels": [ "anything" ], "outputLabels": [ "morning", "midday", "late afternoon", "evening", "late evening", "night" ] }, { "id": "c0a0e0.ae6cbf2", "type": "subflow", "name": "Zigbee2MQTT dim & toggle", "info": "", "category": "", "in": [ { "x": 480, "y": 340, "wires": [ { "id": "821795d7.433b58" } ] } ], "out": [], "env": [ { "name": "topic", "type": "str", "value": "" } ], "color": "#DDAA99" }, { "id": "be8264a322721305", "type": "subflow", "name": "Timer based on hour config", "info": "", "category": "", "in": [ { "x": 120, "y": 100, "wires": [ { "id": "a93b68e3e83b1d25" } ] } ], "out": [ { "x": 860, "y": 100, "wires": [ { "id": "7a1e6b58aaf9559f", "port": 0 } ] } ], "env": [], "meta": {}, "color": "#DDAA99" }, { "id": "657c7463.48e1e4", "type": "server", "name": "Home Assistant Latest", "addon": false, "rejectUnauthorizedCerts": true, "ha_boolean": "y|yes|true|on|home|open", "connectionDelay": true, "cacheJson": false, "heartbeat": false, "heartbeatInterval": "", "statusSeparator": "", "enableGlobalContextStore": false }, { "id": "62ed34c9191cebca", "type": "ha-entity-config", "server": "657c7463.48e1e4", "deviceConfig": "", "name": "Kitchen Motion Sensor Flow", "version": "6", "entityType": "switch", "haConfig": [ { "property": "name", "value": "kitchen_motion_sensor_flow" }, { "property": "icon", "value": "" }, { "property": "entity_picture", "value": "" }, { "property": "entity_category", "value": "" }, { "property": "device_class", "value": "" } ], "resend": false, "debugEnabled": false }, { "id": "d51b5899.a2d5d8", "type": "mqtt-broker", "d": true, "name": "Mosquto Broker", "broker": "192.168.1.6", "port": "1883", "clientid": "", "autoConnect": true, "usetls": false, "compatmode": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" }, { "id": "cc000023", "type": "ha-entity-config", "z": "bbf25964.5edb38", "server": "657c7463.48e1e4", "deviceConfig": "", "name": "CC Delivery Date", "version": "6", "entityType": "sensor", "haConfig": [ { "property": "name", "value": "cc_next_delivery_date" }, { "property": "icon", "value": "mdi:calendar" }, { "property": "entity_picture", "value": "" }, { "property": "entity_category", "value": "" }, { "property": "device_class", "value": "" } ], "resend": false, "debugEnabled": false }, { "id": "cc000025", "type": "ha-entity-config", "z": "bbf25964.5edb38", "server": "657c7463.48e1e4", "deviceConfig": "", "name": "CC Delivery Total", "version": "6", "entityType": "sensor", "haConfig": [ { "property": "name", "value": "cc_next_delivery_total" }, { "property": "icon", "value": "mdi:currency-eur" }, { "property": "entity_picture", "value": "" }, { "property": "entity_category", "value": "" }, { "property": "device_class", "value": "" } ], "resend": false, "debugEnabled": false }, { "id": "cc000026", "type": "ha-entity-config", "z": "bbf25964.5edb38", "server": "657c7463.48e1e4", "deviceConfig": "", "name": "CC Send Now Button", "version": "6", "entityType": "button", "haConfig": [ { "property": "name", "value": "cc_send_now" }, { "property": "icon", "value": "mdi:send" }, { "property": "entity_picture", "value": "" }, { "property": "entity_category", "value": "" }, { "property": "device_class", "value": "" } ], "resend": false, "debugEnabled": false }, { "id": "cc000027", "type": "ha-entity-config", "z": "bbf25964.5edb38", "server": "657c7463.48e1e4", "deviceConfig": "", "name": "CC Postpone 1 Week", "version": "6", "entityType": "button", "haConfig": [ { "property": "name", "value": "cc_postpone_one_week" }, { "property": "icon", "value": "mdi:calendar-plus" }, { "property": "entity_picture", "value": "" }, { "property": "entity_category", "value": "" }, { "property": "device_class", "value": "" } ], "resend": false, "debugEnabled": false }, { "id": "cc000024", "type": "ha-entity-config", "z": "bbf25964.5edb38", "server": "657c7463.48e1e4", "deviceConfig": "", "name": "CC Delivery Product", "version": "6", "entityType": "sensor", "haConfig": [ { "property": "name", "value": "cc_next_delivery_product" }, { "property": "icon", "value": "mdi:coffee" }, { "property": "entity_picture", "value": "" }, { "property": "entity_category", "value": "" }, { "property": "device_class", "value": "" } ], "resend": false, "debugEnabled": false }, { "id": "dc7ddc2d53abc038", "type": "subflow:52430f5e9f9ee267", "z": "e52c44dc.71cb5", "name": "", "x": 390, "y": 140, "wires": [ [], [], [], [], [], [] ] }, { "id": "9e4fac23fd2c73ed", "type": "function", "z": "091c97d9c8d81499", "name": "Escape JSON string", "func": "msg.payload = JSON.stringify(msg.payload).replace(/\"/g, '\\\"');\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 320, "y": 140, "wires": [ [] ] }, { "id": "910e431ab636c701", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Night Time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.night_starts_ha", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "night", "valueType": "str" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 330, "y": 260, "wires": [ [ "b1106a1c85cc30f3" ] ] }, { "id": "f4da808dc4c218b6", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Morning Time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.morning_starts_ha", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "morning", "valueType": "str" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 340, "y": 60, "wires": [ [ "b1106a1c85cc30f3" ] ] }, { "id": "25fe3f965108a4f8", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Evening Time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.evening_starts_ha", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "evening", "valueType": "str" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 340, "y": 180, "wires": [ [ "b1106a1c85cc30f3" ] ] }, { "id": "b1106a1c85cc30f3", "type": "join", "z": "52430f5e9f9ee267", "name": "Collect all times", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "6", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 750, "y": 160, "wires": [ [ "4e491e57f35c4458", "ca40f18fea0361e5" ] ] }, { "id": "1029462b97e1cc7c", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Midday Time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.midday_starts_ha", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "midday", "valueType": "str" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 330, "y": 100, "wires": [ [ "b1106a1c85cc30f3" ] ] }, { "id": "6a5d6248d66d5303", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Late Evening Time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.late_evening_starts_ha", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "late_evening", "valueType": "str" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 350, "y": 220, "wires": [ [ "b1106a1c85cc30f3" ] ] }, { "id": "c263329e3207423d", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Late Afternoon Time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.late_afternoon_starts_ha", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "late_afternoon", "valueType": "str" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 360, "y": 140, "wires": [ [ "b1106a1c85cc30f3" ] ] }, { "id": "4e491e57f35c4458", "type": "split", "z": "52430f5e9f9ee267", "name": "For each configured time", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "topic", "x": 1070, "y": 160, "wires": [ [ "3cc1cd83a914fbed" ] ] }, { "id": "d88527a4c0207c0c", "type": "join", "z": "52430f5e9f9ee267", "name": "Merge elements into single array", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "8", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 1100, "y": 360, "wires": [ [ "00fdb1bc99d82683" ] ] }, { "id": "3cc1cd83a914fbed", "type": "moment", "z": "52430f5e9f9ee267", "name": "Convert time to date time", "topic": "", "input": "payload", "inputType": "msg", "inTz": "Europe/Berlin", "adjAmount": 0, "adjType": "days", "adjDir": "add", "format": "", "locale": "en-US", "output": "payload", "outputType": "msg", "outTz": "Europe/Berlin", "x": 1070, "y": 220, "wires": [ [ "558cbc9bafd7fda2" ] ] }, { "id": "558cbc9bafd7fda2", "type": "switch", "z": "52430f5e9f9ee267", "name": "Check additional date for night ", "property": "topic", "propertyType": "msg", "rules": [ { "t": "eq", "v": "night", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1090, "y": 280, "wires": [ [ "72abde726eb791b7", "d88527a4c0207c0c" ], [ "d88527a4c0207c0c" ] ] }, { "id": "72abde726eb791b7", "type": "moment", "z": "52430f5e9f9ee267", "name": "Create date time for night tomorrow", "topic": "night_tomorrow", "input": "payload", "inputType": "msg", "inTz": "Europe/Berlin", "adjAmount": "1", "adjType": "days", "adjDir": "add", "format": "", "locale": "en-US", "output": "payload", "outputType": "msg", "outTz": "Europe/Berlin", "x": 1460, "y": 280, "wires": [ [ "d88527a4c0207c0c" ] ] }, { "id": "035b7bb98d69b0a0", "type": "switch", "z": "52430f5e9f9ee267", "name": "Compare times", "property": "payload.now", "propertyType": "msg", "rules": [ { "t": "lt", "v": "payload.night", "vt": "msg" }, { "t": "btwn", "v": "payload.night", "vt": "msg", "v2": "payload.morning", "v2t": "msg" }, { "t": "btwn", "v": "payload.morning", "vt": "msg", "v2": "payload.midday", "v2t": "msg" }, { "t": "btwn", "v": "payload.midday", "vt": "msg", "v2": "payload.late_afternoon", "v2t": "msg" }, { "t": "btwn", "v": "payload.late_afternoon", "vt": "msg", "v2": "payload.evening", "v2t": "msg" }, { "t": "btwn", "v": "payload.evening", "vt": "msg", "v2": "payload.late_evening", "v2t": "msg" }, { "t": "btwn", "v": "payload.late_evening", "vt": "msg", "v2": "payload.night_tomorrow", "v2t": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 8, "x": 1080, "y": 520, "wires": [ [ "25b5aff2dea58057" ], [ "5f0e5f63552a97f2" ], [ "b884e557f9524784" ], [ "06f7380c6f28bdd1" ], [ "41de38d16e68d1d9" ], [ "4d992d3713228542" ], [ "25b5aff2dea58057" ], [ "5f0e5f63552a97f2" ] ] }, { "id": "b884e557f9524784", "type": "change", "z": "52430f5e9f9ee267", "name": "It's morning", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "morning", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1490, "y": 440, "wires": [ [] ] }, { "id": "06f7380c6f28bdd1", "type": "change", "z": "52430f5e9f9ee267", "name": "It's midday", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "midday", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1490, "y": 480, "wires": [ [] ] }, { "id": "41de38d16e68d1d9", "type": "change", "z": "52430f5e9f9ee267", "name": "It's late afternoon", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "late_afternoon", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1510, "y": 520, "wires": [ [] ] }, { "id": "4d992d3713228542", "type": "change", "z": "52430f5e9f9ee267", "name": "It's evening", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "evening", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1490, "y": 560, "wires": [ [] ] }, { "id": "25b5aff2dea58057", "type": "change", "z": "52430f5e9f9ee267", "name": "It's late evening", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "late_evening", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1500, "y": 600, "wires": [ [] ] }, { "id": "5f0e5f63552a97f2", "type": "change", "z": "52430f5e9f9ee267", "name": "It's night", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "night", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1480, "y": 640, "wires": [ [] ] }, { "id": "ca40f18fea0361e5", "type": "moment", "z": "52430f5e9f9ee267", "name": "Add current date time", "topic": "now", "input": "", "inputType": "date", "inTz": "Europe/Berlin", "adjAmount": "0", "adjType": "days", "adjDir": "add", "format": "", "locale": "en-US", "output": "payload", "outputType": "msg", "outTz": "Europe/Berlin", "x": 760, "y": 220, "wires": [ [ "d88527a4c0207c0c" ] ] }, { "id": "00fdb1bc99d82683", "type": "change", "z": "52430f5e9f9ee267", "name": "Clean up msg object", "rules": [ { "t": "delete", "p": "settings", "pt": "msg" }, { "t": "delete", "p": "topic", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1060, "y": 420, "wires": [ [ "035b7bb98d69b0a0" ] ] }, { "id": "94df66c8.23c748", "type": "switch", "z": "c0a0e0.ae6cbf2", "name": "Direction", "property": "direction", "propertyType": "flow", "rules": [ { "t": "eq", "v": "up", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 820, "y": 220, "wires": [ [ "488569b9.ed45a8" ], [ "be09eac4.e90d18" ] ] }, { "id": "488569b9.ed45a8", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "Set direction down", "rules": [ { "t": "set", "p": "direction", "pt": "flow", "to": "down", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1040, "y": 180, "wires": [ [ "de7aef74.e638b" ] ] }, { "id": "be09eac4.e90d18", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "Set direction up", "rules": [ { "t": "set", "p": "direction", "pt": "flow", "to": "up", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1030, "y": 260, "wires": [ [ "32ce8567.49120a" ] ] }, { "id": "da116e59.611b2", "type": "mqtt out", "z": "c0a0e0.ae6cbf2", "name": "", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "d51b5899.a2d5d8", "x": 1520, "y": 180, "wires": [] }, { "id": "de7aef74.e638b", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "MQTT message UP", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "topic", "tot": "env" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_move\": 70}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1280, "y": 180, "wires": [ [ "da116e59.611b2" ] ] }, { "id": "5f89dab8.652954", "type": "mqtt out", "z": "c0a0e0.ae6cbf2", "name": "", "topic": "", "qos": "", "retain": "", "broker": "d51b5899.a2d5d8", "x": 1520, "y": 260, "wires": [] }, { "id": "32ce8567.49120a", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "MQTT message DOWN", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "topic", "tot": "env" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_move\": -70}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1300, "y": 260, "wires": [ [ "5f89dab8.652954" ] ] }, { "id": "bad6cfaf.6876d", "type": "mqtt out", "z": "c0a0e0.ae6cbf2", "name": "", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "d51b5899.a2d5d8", "x": 1090, "y": 340, "wires": [] }, { "id": "370e7b7e.f5dca4", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "MQTT message STOP", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "topic", "tot": "env" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_move\": 0}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 860, "y": 340, "wires": [ [ "bad6cfaf.6876d" ] ] }, { "id": "96ea6236.ce35a", "type": "mqtt out", "z": "c0a0e0.ae6cbf2", "name": "", "topic": "", "qos": "", "retain": "", "broker": "d51b5899.a2d5d8", "x": 1090, "y": 460, "wires": [] }, { "id": "7e1107c0.6c8b38", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "MQTT message TOGGLE", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "topic", "tot": "env" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\"state\": \"TOGGLE\"}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 870, "y": 460, "wires": [ [ "96ea6236.ce35a" ] ] }, { "id": "821795d7.433b58", "type": "switch", "z": "c0a0e0.ae6cbf2", "name": "Action", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "dim", "vt": "str" }, { "t": "eq", "v": "stop", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 630, "y": 340, "wires": [ [ "94df66c8.23c748" ], [ "370e7b7e.f5dca4" ], [ "7e1107c0.6c8b38" ] ] }, { "id": "a93b68e3e83b1d25", "type": "moment", "z": "be8264a322721305", "name": "Format to HH:mm", "topic": "", "input": "payload", "inputType": "msg", "inTz": "Europe/Berlin", "adjAmount": "5", "adjType": "minutes", "adjDir": "add", "format": "HH:mm", "locale": "en-GB", "output": "payload", "outputType": "msg", "outTz": "Europe/Berlin", "x": 290, "y": 100, "wires": [ [ "0dc0142b97a1bdc7" ] ] }, { "id": "7a1e6b58aaf9559f", "type": "schedex", "z": "be8264a322721305", "name": "Timer", "passthroughunhandled": true, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": true, "tue": true, "wed": true, "thu": true, "fri": true, "sat": true, "sun": true, "x": 710, "y": 100, "wires": [ [] ] }, { "id": "0dc0142b97a1bdc7", "type": "string", "z": "be8264a322721305", "name": "Prepend ontime", "methods": [ { "name": "prepend", "params": [ { "type": "str", "value": "ontime " } ] } ], "prop": "payload", "propout": "payload", "object": "msg", "objectout": "msg", "x": 520, "y": 100, "wires": [ [ "7a1e6b58aaf9559f" ] ] }, { "id": "1319ea0f.4d86d6", "type": "api-call-service", "z": "600f7a12.5ee66c", "name": "Notify via HA", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "notify.gotify_ha", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{{{payload}}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "notify", "service": "gotify_ha", "output_location": "", "output_location_type": "none", "x": 1370, "y": 80, "wires": [ [] ] }, { "id": "96b02618.e84278", "type": "server-state-changed", "z": "600f7a12.5ee66c", "name": "Front door", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.front_door_state" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "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": 120, "y": 60, "wires": [ [ "63ef802b.259ca" ] ] }, { "id": "50b85b7a.092964", "type": "template", "z": "600f7a12.5ee66c", "name": "Door template", "field": "payload", "fieldType": "msg", "format": "json", "syntax": "mustache", "template": "{\n \"title\":\"Info\",\n \"message\":\"{{door_type}} door is {{payload}}.\"\n}\n\n", "output": "str", "x": 1160, "y": 100, "wires": [ [ "1319ea0f.4d86d6", "8ccf280b.4ba23" ] ] }, { "id": "6d21e8a.b9e5b18", "type": "server-state-changed", "z": "600f7a12.5ee66c", "name": "Storage door", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.storage_room_door_state" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "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": 110, "y": 140, "wires": [ [ "63ef802b.259ca" ] ] }, { "id": "63ef802b.259ca", "type": "switch", "z": "600f7a12.5ee66c", "name": "Which door?", "property": "topic", "propertyType": "msg", "rules": [ { "t": "eq", "v": "binary_sensor.front_door_state", "vt": "str" }, { "t": "eq", "v": "binary_sensor.storage_room_door_state", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 350, "y": 100, "wires": [ [ "80b797a8.a574a8" ], [ "a3bd4d81.d47768" ] ] }, { "id": "80b797a8.a574a8", "type": "change", "z": "600f7a12.5ee66c", "name": "Set Front door", "rules": [ { "t": "set", "p": "door_type", "pt": "msg", "to": "Front", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 580, "y": 60, "wires": [ [ "8d30f50.0a8dd88" ] ] }, { "id": "a3bd4d81.d47768", "type": "change", "z": "600f7a12.5ee66c", "name": "Set Storage door", "rules": [ { "t": "set", "p": "door_type", "pt": "msg", "to": "Storage", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 140, "wires": [ [ "8d30f50.0a8dd88" ] ] }, { "id": "8d30f50.0a8dd88", "type": "switch", "z": "600f7a12.5ee66c", "name": "open or closed?", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on", "vt": "str" }, { "t": "eq", "v": "off", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 800, "y": 100, "wires": [ [ "d5d051a2.1ad7a" ], [ "141cc3d2.c3ddf4" ] ] }, { "id": "d5d051a2.1ad7a", "type": "change", "z": "600f7a12.5ee66c", "name": "open", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "open", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 970, "y": 60, "wires": [ [ "50b85b7a.092964" ] ] }, { "id": "141cc3d2.c3ddf4", "type": "change", "z": "600f7a12.5ee66c", "name": "closed", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "closed", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 970, "y": 140, "wires": [ [ "50b85b7a.092964" ] ] }, { "id": "d75236f8.133cd8", "type": "inject", "z": "600f7a12.5ee66c", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "binary_sensor.front_door_state", "payload": "on", "payloadType": "str", "x": 190, "y": 260, "wires": [ [ "63ef802b.259ca" ] ] }, { "id": "8ccf280b.4ba23", "type": "debug", "z": "600f7a12.5ee66c", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1360, "y": 180, "wires": [] }, { "id": "ae332807.ef2fd8", "type": "schedex", "z": "75c53969.aa5438", "name": "Wake up timer", "passthroughunhandled": false, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": true, "tue": true, "wed": true, "thu": true, "fri": true, "sat": false, "sun": false, "x": 1100, "y": 200, "wires": [ [ "6c060df4.52243c" ] ] }, { "id": "93a80007.e0738", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Weekday wake up time", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.weekday_wakeup_time" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 180, "y": 100, "wires": [ [ "9bda506c.e72ec8" ] ] }, { "id": "694fe4c5.685bac", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Weekday fade in", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_number.weekday_fade_duration" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 180, "y": 300, "wires": [ [ "22ae3c69.00a1cc" ] ] }, { "id": "6c060df4.52243c", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Do Wake Up?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekday_wakeup", "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": 1360, "y": 200, "wires": [ [ "dbc82e9b.f57dc8" ], [] ] }, { "id": "e369f3d1.5a92e", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Get weekday wake up time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.weekday_wakeup_time", "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": 540, "y": 360, "wires": [ [ "2ec2fea2.c760e2" ] ] }, { "id": "e67fe3b4.3a7a28", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Get weekday fade in", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_number.weekday_fade_duration", "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": 540, "y": 160, "wires": [ [ "b000fa34.217b6" ] ] }, { "id": "9bda506c.e72ec8", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "weekday_wakeup_time", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 100, "wires": [ [ "e67fe3b4.3a7a28", "d8decadb.021668" ] ] }, { "id": "22ae3c69.00a1cc", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "weekday_wakeup_fade", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 300, "wires": [ [ "e369f3d1.5a92e" ] ] }, { "id": "b000fa34.217b6", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "weekday_wakeup_fade", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 220, "wires": [ [ "9cb89f73.575448", "f94ec42c.03a648", "18eb0644ca136b1c" ] ] }, { "id": "2ec2fea2.c760e2", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "weekday_wakeup_time", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 420, "wires": [ [ "9cb89f73.575448", "f94ec42c.03a648", "18eb0644ca136b1c" ] ] }, { "id": "9cb89f73.575448", "type": "function", "z": "75c53969.aa5438", "name": "actual start time", "func": "var wakeUpTime = flow.get('weekday_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekday_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = (wakeUpFade == 0) ? 0 : -Math.abs(wakeUpFade); \n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 880, "y": 200, "wires": [ [ "ae332807.ef2fd8" ] ] }, { "id": "5bfae0ef.66185", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Wake up lights", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.bedroom_sun" ], "labelId": [], "data": "payload.data", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "output_location": "", "output_location_type": "none", "x": 1660, "y": 220, "wires": [ [] ] }, { "id": "dbc82e9b.f57dc8", "type": "function", "z": "75c53969.aa5438", "name": "Prepare transition body", "func": "var tmpPayload = {};\ntmpPayload.brightness_pct = 100;\ntmpPayload.transition = parseInt(flow.get('weekday_wakeup_fade'))*60;\ntmpPayload.rgb_color = [255, 212, 178];\n\nvar newMsg = {};\n// newMsg.payload = tmpPayload;\nnewMsg.payload = {};\nnewMsg.payload.data = tmpPayload;\n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1390, "y": 260, "wires": [ [ "5bfae0ef.66185" ] ] }, { "id": "f21c4ec.c39bfb", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Turn on espresso", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "switch.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "switch.espresso_kitchen" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "switch", "service": "turn_on", "output_location": "", "output_location_type": "none", "x": 1670, "y": 320, "wires": [ [] ] }, { "id": "f94ec42c.03a648", "type": "function", "z": "75c53969.aa5438", "name": "espresso start time", "func": "var wakeUpTime = flow.get('weekday_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekday_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = -25; \n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 320, "wires": [ [ "fc05fffe.2de45" ] ] }, { "id": "fc05fffe.2de45", "type": "schedex", "z": "75c53969.aa5438", "name": "Espresso timer", "passthroughunhandled": false, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": true, "tue": true, "wed": true, "thu": true, "fri": true, "sat": false, "sun": false, "x": 1140, "y": 320, "wires": [ [ "77923b2d.4a22fc" ] ] }, { "id": "77923b2d.4a22fc", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Heat up espresso machine?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekday_wakeup_coffee", "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": 1400, "y": 320, "wires": [ [ "f21c4ec.c39bfb" ], [] ] }, { "id": "d8decadb.021668", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Do Wake Up?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekday_wakeup", "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": 100, "wires": [ [ "ef8a3c3f.d62bc8" ], [] ] }, { "id": "ef8a3c3f.d62bc8", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Heat up espresso machine?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekday_wakeup_coffee", "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": 1140, "y": 100, "wires": [ [ "9a69ecfb.d23d78" ], [ "9a69ecfb.d23d78" ] ] }, { "id": "9a69ecfb.d23d78", "type": "function", "z": "75c53969.aa5438", "name": "Wake up notification", "func": "var espressoMsg = '.';\n\nif (msg.payload == 'on') { \n espressoMsg = ' and warm up espresso machine.'\n}\n\nvar newMsg = {};\nnewMsg.payload = \n \"Weekday wake up at \"+\n flow.get('weekday_wakeup_time').substr(0,5)+\n espressoMsg\n ;\n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1420, "y": 100, "wires": [ [ "2cc3b77b.1bea68" ] ] }, { "id": "2cc3b77b.1bea68", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Notify via HA", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "notify.gotify_ha", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"title\":\"Info\",\"message\":\"{{{payload}}}\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "notify", "service": "gotify_ha", "output_location": "", "output_location_type": "none", "x": 1650, "y": 100, "wires": [ [] ] }, { "id": "4dc6da74.8356dc", "type": "schedex", "z": "75c53969.aa5438", "name": "Wake up timer", "passthroughunhandled": false, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": false, "tue": false, "wed": false, "thu": false, "fri": false, "sat": true, "sun": true, "x": 1140, "y": 840, "wires": [ [ "85381275.49e7d" ] ] }, { "id": "fc43b82c.213cb8", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Weekend wake up time", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.weekend_wakeup_time" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 740, "wires": [ [ "c521c0a0.379578" ] ] }, { "id": "76b3e57e.0f74f4", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Weekend fade in", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_number.weekend_fade_duration" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 160, "y": 940, "wires": [ [ "683d8f2e.895c48" ] ] }, { "id": "85381275.49e7d", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Do Wake Up?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekend_wakeup", "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": 1360, "y": 840, "wires": [ [ "9d13f9f6.43bf48" ], [] ] }, { "id": "4dddf54a.ae2404", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Get weekend wake up time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.weekend_wakeup_time", "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": 540, "y": 1000, "wires": [ [ "10ec127f.448cbe" ] ] }, { "id": "8ce67518.da9078", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Get weekend fade in", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_number.weekend_fade_duration", "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": 540, "y": 800, "wires": [ [ "12733a41.25d2a6" ] ] }, { "id": "c521c0a0.379578", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "weekend_wakeup_time", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 740, "wires": [ [ "8ce67518.da9078", "258551dc.78ecd6" ] ] }, { "id": "683d8f2e.895c48", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "weekend_wakeup_fade", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 940, "wires": [ [ "4dddf54a.ae2404" ] ] }, { "id": "12733a41.25d2a6", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "weekend_wakeup_fade", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 860, "wires": [ [ "df53b1da.f9fb38", "f0aedf49.47b5c", "11ee3e0ecc62415e" ] ] }, { "id": "10ec127f.448cbe", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "weekend_wakeup_time", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 570, "y": 1060, "wires": [ [ "df53b1da.f9fb38", "f0aedf49.47b5c", "11ee3e0ecc62415e" ] ] }, { "id": "df53b1da.f9fb38", "type": "function", "z": "75c53969.aa5438", "name": "actual start time", "func": "var wakeUpTime = flow.get('weekend_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekend_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = (wakeUpFade == 0) ? 0 : -Math.abs(wakeUpFade); \n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 880, "y": 840, "wires": [ [ "4dc6da74.8356dc" ] ] }, { "id": "d415030.858b68", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Wake up lights", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.bedroom_sun" ], "labelId": [], "data": "payload.data", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "output_location": "", "output_location_type": "none", "x": 1640, "y": 840, "wires": [ [] ] }, { "id": "9d13f9f6.43bf48", "type": "function", "z": "75c53969.aa5438", "name": "Prepare transition body", "func": "var tmpPayload = {};\ntmpPayload.brightness = 255;\ntmpPayload.transition = parseInt(flow.get('weekend_wakeup_fade'))*60;\ntmpPayload.rgb_color = [255, 207, 120];\n\nvar newMsg = {};\nnewMsg.payload = {};\nnewMsg.payload.data = tmpPayload;\n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1390, "y": 900, "wires": [ [ "d415030.858b68" ] ] }, { "id": "7722c177.c69d58", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Turn on espresso", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "switch.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "switch.espresso_kitchen" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "switch", "service": "turn_on", "output_location": "", "output_location_type": "none", "x": 1650, "y": 960, "wires": [ [] ] }, { "id": "f0aedf49.47b5c", "type": "function", "z": "75c53969.aa5438", "name": "espresso start time", "func": "var wakeUpTime = flow.get('weekend_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekend_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = -25; \n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 960, "wires": [ [ "e1e0b6cb.85b9b" ] ] }, { "id": "e1e0b6cb.85b9b", "type": "schedex", "z": "75c53969.aa5438", "name": "Espresso timer", "passthroughunhandled": false, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": false, "tue": false, "wed": false, "thu": false, "fri": false, "sat": true, "sun": true, "x": 1140, "y": 960, "wires": [ [ "8d66adb4.9f362" ] ] }, { "id": "8d66adb4.9f362", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Heat up espresso machine?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekend_wakeup_coffee", "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": 1400, "y": 960, "wires": [ [ "7722c177.c69d58" ], [] ] }, { "id": "258551dc.78ecd6", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Do Wake Up?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekend_wakeup", "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": 740, "wires": [ [ "762c79e3.920548" ], [] ] }, { "id": "762c79e3.920548", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Heat up espresso machine?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekend_wakeup_coffee", "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": 1120, "y": 740, "wires": [ [ "81837c2f.7493" ], [ "81837c2f.7493" ] ] }, { "id": "81837c2f.7493", "type": "function", "z": "75c53969.aa5438", "name": "Wake up notification", "func": "var espressoMsg = '.';\n\nif (msg.payload == 'on') { \n espressoMsg = ' and warm up espresso machine.'\n}\n\nvar newMsg = {};\nnewMsg.payload = \n \"Weekend wake up at \"+\n flow.get('weekend_wakeup_time').substr(0,5)+\n espressoMsg\n ;\n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1380, "y": 740, "wires": [ [ "19f56085.336bff" ] ] }, { "id": "19f56085.336bff", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Notify via HA", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "notify.gotify_ha", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"title\":\"Info\",\"message\":\"{{{payload}}}\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "notify", "service": "gotify_ha", "output_location": "", "output_location_type": "none", "x": 1650, "y": 740, "wires": [ [] ] }, { "id": "547e480223620899", "type": "comment", "z": "75c53969.aa5438", "name": "Wake up weekday", "info": "", "x": 170, "y": 60, "wires": [] }, { "id": "ed1e94f805a7cefc", "type": "comment", "z": "75c53969.aa5438", "name": "Wake up weekend", "info": "", "x": 170, "y": 700, "wires": [] }, { "id": "64e25c08b51a1c62", "type": "comment", "z": "75c53969.aa5438", "name": "Mosquito repellent", "info": "", "x": 170, "y": 1360, "wires": [] }, { "id": "22546de14d49ffe0", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Mosquito repellent start", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.mosquito_repellent_start" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 180, "y": 1480, "wires": [ [ "5ba4538297e14338" ] ] }, { "id": "9046160e1b2dcae8", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Enable Mosquito repellent?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.mosquito_device", "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": 680, "y": 1480, "wires": [ [ "fbabed1ad7a24ba0" ], [] ] }, { "id": "fbabed1ad7a24ba0", "type": "function", "z": "75c53969.aa5438", "name": "Mosquito repellent notification", "func": "var newMsg = {};\nnewMsg.payload = \n \"Mosquito repellent will turn on at \"+\n flow.get('mosquito_start_time').substr(0,5)\n ;\n\nreturn newMsg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 990, "y": 1480, "wires": [ [ "e9a1ce2e4ff7ec96" ] ] }, { "id": "e9a1ce2e4ff7ec96", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Notify via HA", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "notify.gotify_ha", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"title\":\"Info\",\"message\":\"{{{payload}}}\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "notify", "service": "gotify_ha", "output_location": "", "output_location_type": "none", "x": 1410, "y": 1440, "wires": [ [] ] }, { "id": "5ba4538297e14338", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "mosquito_start_time", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 200, "y": 1540, "wires": [ [ "9046160e1b2dcae8", "a2a01fc407a0436d" ] ] }, { "id": "59b8f49a70e4cd99", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Mosquito repellent start", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_boolean.mosquito_device" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 180, "y": 1400, "wires": [ [ "597bdcb50e6cb418" ] ] }, { "id": "597bdcb50e6cb418", "type": "function", "z": "75c53969.aa5438", "name": "Mosquito repellent notification", "func": "var newMsg = {};\nnewMsg.payload = \n \"Mosquito repellent turned \" + \n msg.payload + \n \".\"\n ;\n\nreturn newMsg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 690, "y": 1400, "wires": [ [ "e9a1ce2e4ff7ec96" ] ] }, { "id": "a2a01fc407a0436d", "type": "function", "z": "75c53969.aa5438", "name": "actual start time", "func": "var newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = flow.get('mosquito_start_time').substr(0, 5);\n\nreturn newMsg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 640, "y": 1540, "wires": [ [ "ced1a60d7a156f31", "03a4a0b9263bb6a5" ] ] }, { "id": "ced1a60d7a156f31", "type": "schedex", "z": "75c53969.aa5438", "name": "Mosquito repellent start timer", "passthroughunhandled": false, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": true, "tue": true, "wed": true, "thu": true, "fri": true, "sat": true, "sun": true, "x": 680, "y": 1600, "wires": [ [ "681c8277c5546141", "03a4a0b9263bb6a5" ] ] }, { "id": "6f4031ab571aeae0", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Turn on mosquito repellent", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "switch.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "switch.bedroom_mosquito_switch" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "switch", "service": "turn_on", "output_location": "", "output_location_type": "none", "x": 1460, "y": 1560, "wires": [ [] ] }, { "id": "681c8277c5546141", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Enable Mosquito repellent?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.mosquito_device", "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": 980, "y": 1540, "wires": [ [ "6f4031ab571aeae0", "03a4a0b9263bb6a5" ], [] ] }, { "id": "8c2dd2f5682080ac", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Mosquito repellent stop", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.mosquito_repellent_stop" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 180, "y": 1620, "wires": [ [ "392706767c38e18e" ] ] }, { "id": "392706767c38e18e", "type": "change", "z": "75c53969.aa5438", "name": "", "rules": [ { "t": "set", "p": "mosquito_stop_time", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 200, "y": 1680, "wires": [ [ "b79251d5e98f3863", "280a9497b4700592" ] ] }, { "id": "b79251d5e98f3863", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Enable Mosquito repellent?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.mosquito_device", "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": 680, "y": 1680, "wires": [ [ "4b8aaa94a2eb49c4" ], [] ] }, { "id": "4b8aaa94a2eb49c4", "type": "function", "z": "75c53969.aa5438", "name": "Mosquito repellent notification", "func": "var newMsg = {};\nnewMsg.payload = \n \"Mosquito repellent will turn off at \"+\n flow.get('mosquito_stop_time').substr(0,5)\n ;\n\nreturn newMsg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 990, "y": 1680, "wires": [ [ "e9a1ce2e4ff7ec96" ] ] }, { "id": "280a9497b4700592", "type": "function", "z": "75c53969.aa5438", "name": "actual stop time", "func": "var newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = flow.get('mosquito_stop_time').substr(0, 5);\n\nreturn newMsg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 640, "y": 1740, "wires": [ [ "8d3c194ede95021a", "03a4a0b9263bb6a5" ] ] }, { "id": "8d3c194ede95021a", "type": "schedex", "z": "75c53969.aa5438", "name": "Mosquito repellent stop timer", "passthroughunhandled": false, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": true, "tue": true, "wed": true, "thu": true, "fri": true, "sat": true, "sun": true, "x": 680, "y": 1800, "wires": [ [ "9ba1f8f1e3d43149", "03a4a0b9263bb6a5" ] ] }, { "id": "9ba1f8f1e3d43149", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Turn off mosquito repellent", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "switch.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "switch.bedroom_mosquito_switch" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "switch", "service": "turn_off", "output_location": "", "output_location_type": "none", "x": 1460, "y": 1700, "wires": [ [] ] }, { "id": "03a4a0b9263bb6a5", "type": "debug", "z": "75c53969.aa5438", "name": "debug mosquito", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1320, "y": 1800, "wires": [] }, { "id": "18eb0644ca136b1c", "type": "function", "z": "75c53969.aa5438", "name": "music start time", "func": "var wakeUpTime = flow.get('weekday_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekday_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = -15; \n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 880, "y": 420, "wires": [ [ "5fc7f988eeaa078a" ] ] }, { "id": "5fc7f988eeaa078a", "type": "schedex", "z": "75c53969.aa5438", "name": "Music timer", "passthroughunhandled": false, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": true, "tue": true, "wed": true, "thu": true, "fri": true, "sat": false, "sun": false, "x": 1130, "y": 420, "wires": [ [ "f217821d98198307" ] ] }, { "id": "f217821d98198307", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Wake up with music?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekday_music_wakeup", "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": 1680, "y": 420, "wires": [ [ "0f08977fb2d830db" ], [] ] }, { "id": "a5df6ad625909fe6", "type": "schedex", "z": "75c53969.aa5438", "name": "Music timer", "passthroughunhandled": false, "suspended": false, "lat": "", "lon": "", "ontime": "", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": false, "tue": false, "wed": false, "thu": false, "fri": false, "sat": true, "sun": true, "x": 1130, "y": 1060, "wires": [ [ "4b05a68f256549b9" ] ] }, { "id": "4b05a68f256549b9", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Wake up with music?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.weekend_music_wakeup", "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": 1660, "y": 1060, "wires": [ [ "0f08977fb2d830db" ], [] ] }, { "id": "0f08977fb2d830db", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Select Bedroom Only Audio", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_button.press", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_button.bedroom_only_audio" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "input_button", "service": "press", "x": 2040, "y": 640, "wires": [ [ "5502ac50650b12cb" ] ] }, { "id": "5502ac50650b12cb", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Mute bedroom speaker", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.volume_set", "floorId": [], "areaId": [ "7047cdd7d50e49f980eba16f832acb57" ], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"volume_level\":0}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_set", "x": 2030, "y": 720, "wires": [ [ "f463cbf3032fb2f2" ] ] }, { "id": "f463cbf3032fb2f2", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Connect Spotify to Speaker", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.select_source", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.spotify_m038" ], "labelId": [], "data": "{\"source\":\"All Speakers\"}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "select_source", "x": 2040, "y": 800, "wires": [ [ "28e6f5f6f6e710a8" ] ] }, { "id": "28e6f5f6f6e710a8", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Start Wakeup Playlist on speaker", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.play_media", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.spotify_m038" ], "labelId": [], "data": "{\"media_content_id\":\"https://open.spotify.com/playlist/5w2ieYTFUc7z6GS4V5ZjLl?si=585bd153dfb94614\", \"media_content_type\":\"playlist\"}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "play_media", "x": 2060, "y": 880, "wires": [ [ "231c5343ad084e80" ] ] }, { "id": "231c5343ad084e80", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Enable shuffle", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.shuffle_set", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.spotify_m038" ], "labelId": [], "data": "{\"shuffle\":true}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "shuffle_set", "x": 2380, "y": 640, "wires": [ [ "efc99a6dfef495c0" ] ] }, { "id": "efc99a6dfef495c0", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Jump to next song (trigger shuffle)", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.media_next_track", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.spotify_m038" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "media_next_track", "x": 2440, "y": 720, "wires": [ [ "868fbd6ef36820ae" ] ] }, { "id": "fb76d5441934b190", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Set volume", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.volume_set", "floorId": [], "areaId": [ "7047cdd7d50e49f980eba16f832acb57" ], "deviceId": [], "entityId": [ "input_button.bedroom_only_audio" ], "labelId": [], "data": "{ \"volume_level\" : {{ payload }} }", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_set", "x": 2370, "y": 1000, "wires": [ [] ] }, { "id": "63957f6f9c0a3608", "type": "easing", "z": "75c53969.aa5438", "name": "Calculate fade in volume", "easingType": "linear", "outputType": "overTime", "duration": "60000", "interval": "15000", "numberOfValues": 10, "x": 2410, "y": 860, "wires": [ [ "adaa9a5b2cc96879" ] ] }, { "id": "868fbd6ef36820ae", "type": "change", "z": "75c53969.aa5438", "name": "Set volume parameters", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{ \"from\" : 0, \"to\" : 0.2, \"size\": 0.01 }", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2410, "y": 800, "wires": [ [ "63957f6f9c0a3608" ] ] }, { "id": "adaa9a5b2cc96879", "type": "calculator", "z": "75c53969.aa5438", "name": "Round to max 2 decimals", "inputMsgField": "payload", "outputMsgField": "payload", "operation": "rdec", "constant": "2", "round": false, "truncate": false, "decimals": "0", "decimals2": 0, "x": 2410, "y": 920, "wires": [ [ "fb76d5441934b190" ] ] }, { "id": "11ee3e0ecc62415e", "type": "function", "z": "75c53969.aa5438", "name": "music start time", "func": "var wakeUpTime = flow.get('weekend_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekend_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = -15; \n\nreturn newMsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 880, "y": 1060, "wires": [ [ "a5df6ad625909fe6" ] ] }, { "id": "0d71ce9b2c0312fb", "type": "comment", "z": "75c53969.aa5438", "name": "Wake up music sequence", "info": " - Start muted to jump awake\n - Skip to next to song to trigger shuffle mechanism, Spotify by default starts with the first song\n - Incrementally increase volume to have a nice experience", "x": 2030, "y": 580, "wires": [] }, { "id": "bc24bd25f183a7ac", "type": "inject", "z": "f02b32ef07b4b378", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 1760, "wires": [ [ "3b572aa5a025838b" ] ] }, { "id": "3b572aa5a025838b", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Join media players", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.join", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.bathroom" ], "labelId": [], "data": "{\"group_members\":[\"media_player.kitchen\",\"media_player.bedroom\"]}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "join", "x": 370, "y": 1760, "wires": [ [ "ed251e315e4c2c9f" ] ] }, { "id": "ed251e315e4c2c9f", "type": "debug", "z": "f02b32ef07b4b378", "name": "debug 8", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 660, "y": 1760, "wires": [] }, { "id": "7ad8e1f3e2e0968a", "type": "inject", "z": "f02b32ef07b4b378", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 1840, "wires": [ [ "b298882274d1cdf3" ] ] }, { "id": "b298882274d1cdf3", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Unjoin media players", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.unjoin", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.bathroom", "media_player.bedroom", "media_player.kitchen" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "unjoin", "x": 380, "y": 1840, "wires": [ [ "bdd2b9572315b352" ] ] }, { "id": "bdd2b9572315b352", "type": "debug", "z": "f02b32ef07b4b378", "name": "debug 9", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 660, "y": 1840, "wires": [] }, { "id": "a17410f072874366", "type": "inject", "z": "f02b32ef07b4b378", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "true", "payloadType": "bool", "x": 130, "y": 1960, "wires": [ [ "d94c32c408534cea" ] ] }, { "id": "d94c32c408534cea", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Unmute/Mute media players", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.volume_mute", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.bathroom", "media_player.bedroom", "media_player.kitchen" ], "labelId": [], "data": "{\"is_volume_muted\": {{{payload}}} }", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_mute", "x": 400, "y": 1960, "wires": [ [ "c262b732d4b31093" ] ] }, { "id": "c262b732d4b31093", "type": "debug", "z": "f02b32ef07b4b378", "name": "debug 10", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 660, "y": 1960, "wires": [] }, { "id": "023b11d63a8f319c", "type": "inject", "z": "f02b32ef07b4b378", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "false", "payloadType": "bool", "x": 130, "y": 2020, "wires": [ [ "d94c32c408534cea" ] ] }, { "id": "947aef7d0b37c64e", "type": "inject", "z": "f02b32ef07b4b378", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "true", "payloadType": "bool", "x": 130, "y": 2100, "wires": [ [ "b14ca76bd3f6d739" ] ] }, { "id": "b14ca76bd3f6d739", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Set volume to 20", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.volume_set", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.bathroom", "media_player.bedroom", "media_player.kitchen" ], "labelId": [], "data": "{\"volume_level\": 0.2 }", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_set", "x": 370, "y": 2100, "wires": [ [ "7ff52464dc77aa88" ] ] }, { "id": "7ff52464dc77aa88", "type": "debug", "z": "f02b32ef07b4b378", "name": "debug 12", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 660, "y": 2100, "wires": [] }, { "id": "b35f9365319a9bd4", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Kitchen motion sensor", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "62ed34c9191cebca", "entities": { "entity": [ "binary_sensor.kitchen_motion_sensor_occupancy" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 140, "y": 560, "wires": [ [], [] ] }, { "id": "643f64eeb88d0dc2", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Bedroom motion sensor", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "62ed34c9191cebca", "entities": { "entity": [ "binary_sensor.bedroom_motion_sensor_occupancy" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 140, "y": 620, "wires": [ [], [] ] }, { "id": "b613959939f3fdb7", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Kitchen motion sensor", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "62ed34c9191cebca", "entities": { "entity": [ "binary_sensor.kitchen_motion_sensor_occupancy" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 140, "y": 680, "wires": [ [], [] ] }, { "id": "b57cf93b3481bb17", "type": "comment", "z": "f02b32ef07b4b378", "name": "Speaker config buttons", "info": "", "x": 140, "y": 80, "wires": [] }, { "id": "73bf252f2983ae0c", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Mute Speakers", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "media_player.volume_mute", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "{{ mute }}" ], "labelId": [], "data": "{\"is_volume_muted\":true}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_mute", "x": 800, "y": 200, "wires": [ [] ] }, { "id": "e8d4582f1a35b5fe", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Umute Speakers", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.volume_mute", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "{{ unmute }}" ], "labelId": [], "data": "{\"is_volume_muted\": false }", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_mute", "x": 810, "y": 240, "wires": [ [] ] }, { "id": "9c40d4014ed62a08", "type": "change", "z": "f02b32ef07b4b378", "name": "Kitchen audio config", "rules": [ { "t": "set", "p": "unmute", "pt": "msg", "to": "media_player.kitchen", "tot": "str" }, { "t": "set", "p": "mute", "pt": "msg", "to": "media_player.bedroom, media_player.bathroom, media_player.home_theater_universal", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 420, "y": 120, "wires": [ [ "73bf252f2983ae0c", "e8d4582f1a35b5fe" ] ] }, { "id": "4a3201a1c23eb1bd", "type": "change", "z": "f02b32ef07b4b378", "name": "Bedroom audio config", "rules": [ { "t": "set", "p": "unmute", "pt": "msg", "to": "media_player.bedroom", "tot": "str" }, { "t": "set", "p": "mute", "pt": "msg", "to": "media_player.bathroom, media_player.kitchen, media_player.home_theater_universal", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 420, "y": 180, "wires": [ [ "73bf252f2983ae0c", "e8d4582f1a35b5fe" ] ] }, { "id": "ab34bd65550a49eb", "type": "change", "z": "f02b32ef07b4b378", "name": "Bathroom audio config", "rules": [ { "t": "set", "p": "unmute", "pt": "msg", "to": "media_player.bathroom", "tot": "str" }, { "t": "set", "p": "mute", "pt": "msg", "to": "media_player.bedroom, media_player.kitchen, media_player.home_theater_universal", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 420, "y": 240, "wires": [ [ "73bf252f2983ae0c", "e8d4582f1a35b5fe" ] ] }, { "id": "1ce85c93fddec1ed", "type": "change", "z": "f02b32ef07b4b378", "name": "All speaker unmute config", "rules": [ { "t": "set", "p": "unmute", "pt": "msg", "to": "media_player.bathroom, media_player.bedroom, media_player.kitchen, media_player.home_theater_universal", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 430, "y": 380, "wires": [ [ "e8d4582f1a35b5fe" ] ] }, { "id": "ed546967f38f4321", "type": "change", "z": "f02b32ef07b4b378", "name": "All speaker mute config", "rules": [ { "t": "set", "p": "mute", "pt": "msg", "to": "media_player.bathroom, media_player.bedroom, media_player.kitchen, media_player.home_theater_universal", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 430, "y": 440, "wires": [ [ "73bf252f2983ae0c" ] ] }, { "id": "4e372d2ae02e476f", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Kitchen audio button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.kitchen_only_audio" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 130, "y": 120, "wires": [ [ "9c40d4014ed62a08" ] ] }, { "id": "7e30cae17b6f1147", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Bedroom audio button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.bedroom_only_audio" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 140, "y": 180, "wires": [ [ "4a3201a1c23eb1bd" ] ] }, { "id": "7087100e45352fd6", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Bathroom audio button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.bathroom_only_audio" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 140, "y": 240, "wires": [ [ "ab34bd65550a49eb" ] ] }, { "id": "1e1bbdf54bcc0e71", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "All speakers unmute button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.unmute_all_speakers" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 150, "y": 380, "wires": [ [ "1ce85c93fddec1ed" ] ] }, { "id": "0dada2e07914212e", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "All speakers mute button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.mute_all_speakers" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 150, "y": 440, "wires": [ [ "ed546967f38f4321" ] ] }, { "id": "83cfde5f5f29bfee", "type": "comment", "z": "f02b32ef07b4b378", "name": "Audio Follow system", "info": "", "x": 130, "y": 520, "wires": [] }, { "id": "d6a335eabf0309af", "type": "comment", "z": "f02b32ef07b4b378", "name": "Speaker time out", "info": "", "x": 120, "y": 820, "wires": [] }, { "id": "8d0c16fdcaa044c5", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Music fade out button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.music_fade_out" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 140, "y": 860, "wires": [ [ "5a53dda5700dcbd4" ] ] }, { "id": "487f7f9cb870301d", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Set bedroom volume", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.volume_set", "floorId": [], "areaId": [ "7047cdd7d50e49f980eba16f832acb57" ], "deviceId": [], "entityId": [], "labelId": [], "data": "{ \"volume_level\" : {{ payload }} }", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_set", "x": 1700, "y": 1020, "wires": [ [ "470f04a1f67ed2c5" ] ] }, { "id": "099e68b4526af252", "type": "easing", "z": "f02b32ef07b4b378", "name": "Calculate fade in volume", "easingType": "linear", "outputType": "overTime", "duration": "30000", "interval": "2000", "numberOfValues": 10, "x": 1710, "y": 880, "wires": [ [ "148bfd7bfd19a3f2" ] ] }, { "id": "465266c8ebc87190", "type": "change", "z": "f02b32ef07b4b378", "name": "Set volume parameters", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"from\": $number(payload), \"to\": 0, \"size\": 0.01}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1710, "y": 820, "wires": [ [ "099e68b4526af252" ] ] }, { "id": "148bfd7bfd19a3f2", "type": "calculator", "z": "f02b32ef07b4b378", "name": "Round to max 2 decimals", "inputMsgField": "payload", "outputMsgField": "payload", "operation": "rdec", "constant": "2", "round": false, "truncate": false, "decimals": "0", "decimals2": 0, "x": 1710, "y": 940, "wires": [ [ "487f7f9cb870301d" ] ] }, { "id": "5a53dda5700dcbd4", "type": "trigger", "z": "f02b32ef07b4b378", "name": "20min trigger to start fade out", "op1": "", "op2": "off", "op1type": "nul", "op2type": "str", "duration": "20", "extend": false, "overrideDelay": false, "units": "min", "reset": "on", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 480, "y": 860, "wires": [ [ "64d51f4ce06f71bb" ] ] }, { "id": "243eaae96c3615b7", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Music cancel fade out button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.music_cancel_fade_out" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "reset", "propertyType": "msg", "value": "true", "valueType": "bool" } ], "x": 160, "y": 920, "wires": [ [ "5a53dda5700dcbd4" ] ] }, { "id": "658612bb048cebd0", "type": "api-current-state", "z": "f02b32ef07b4b378", "name": "Get bedroom volume", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "playing", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "media_player.bedroom", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 740, "y": 860, "wires": [ [ "9df152f9e9ea7a00" ], [ "2c391596726d163a" ] ] }, { "id": "eee9cae5a34371af", "type": "change", "z": "f02b32ef07b4b378", "name": "Set default volume", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0.2", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1350, "y": 860, "wires": [ [ "465266c8ebc87190" ] ] }, { "id": "2c391596726d163a", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Stop media players", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.media_stop", "floorId": [], "areaId": [ "f7affcd2d1854f58b829a3d1f67684e9", "7047cdd7d50e49f980eba16f832acb57", "58b6232129db4aa396355dcff5edc036", "9fb80339d4ee49f098decfafad38ab78" ], "deviceId": [], "entityId": [], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "media_stop", "x": 1690, "y": 1180, "wires": [ [] ] }, { "id": "470f04a1f67ed2c5", "type": "switch", "z": "f02b32ef07b4b378", "name": "Volume all the way down?", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "0", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 1710, "y": 1100, "wires": [ [ "2c391596726d163a" ] ] }, { "id": "32128a2d9466c2a5", "type": "switch", "z": "f02b32ef07b4b378", "name": "Volume is numeric?", "property": "payload", "propertyType": "msg", "rules": [ { "t": "istype", "v": "number", "vt": "number" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1350, "y": 800, "wires": [ [ "465266c8ebc87190" ], [ "eee9cae5a34371af" ] ] }, { "id": "9df152f9e9ea7a00", "type": "change", "z": "f02b32ef07b4b378", "name": "Set volume from speaker", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "data.attributes.volume_level", "tot": "msg" }, { "t": "delete", "p": "data", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1030, "y": 860, "wires": [ [ "32128a2d9466c2a5" ] ] }, { "id": "64d51f4ce06f71bb", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Stop media players", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.media_stop", "floorId": [], "areaId": [ "f7affcd2d1854f58b829a3d1f67684e9", "7047cdd7d50e49f980eba16f832acb57", "58b6232129db4aa396355dcff5edc036", "9fb80339d4ee49f098decfafad38ab78" ], "deviceId": [], "entityId": [], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "media_stop", "x": 730, "y": 920, "wires": [ [] ] }, { "id": "7537b14f401fe338", "type": "comment", "z": "f02b32ef07b4b378", "name": "Disabled fade out flow (breaks HEOS + spotify)", "info": "", "x": 820, "y": 820, "wires": [] }, { "id": "691572bc73058f7b", "type": "change", "z": "f02b32ef07b4b378", "name": "Livingroom audio config", "rules": [ { "t": "set", "p": "unmute", "pt": "msg", "to": "media_player.home_theater_universal", "tot": "str" }, { "t": "set", "p": "mute", "pt": "msg", "to": "media_player.bedroom, media_player.kitchen, media_player.bathroom", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 430, "y": 300, "wires": [ [ "73bf252f2983ae0c", "e8d4582f1a35b5fe" ] ] }, { "id": "483ec65e18051a31", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Livingroom audio button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.livingroom_only_audio" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 140, "y": 300, "wires": [ [ "691572bc73058f7b" ] ] }, { "id": "aa6cfabebf9a872f", "type": "comment", "z": "f02b32ef07b4b378", "name": "Grouping and ungrouping", "info": "", "x": 150, "y": 1040, "wires": [] }, { "id": "0a5de0c3e1526c14", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Group all", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.heos_group_all" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 100, "y": 1080, "wires": [ [ "608262f04a2a221d" ] ] }, { "id": "756d563e795b953a", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Group all, excl. livingroom", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.heos_group_all_but_livingroom" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 150, "y": 1140, "wires": [ [ "80be5093f48e88fc" ] ] }, { "id": "a83c93f336d93f56", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Group all, excl bathroom", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.heos_group_all_but_bathroom" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 150, "y": 1200, "wires": [ [ "aaafe15411371f43" ] ] }, { "id": "0fe637de86520e51", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Group all, excl bedroom", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.heos_group_all_but_bedroom" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 140, "y": 1260, "wires": [ [ "980d8e52b0eceaff" ] ] }, { "id": "ccc51eb8edf2e33d", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Join all speakers", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.join", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\t \"entity_id\": leader, \t \"group_members\": followers\t}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": true, "domain": "media_player", "service": "join", "x": 1130, "y": 1180, "wires": [ [] ] }, { "id": "608262f04a2a221d", "type": "change", "z": "f02b32ef07b4b378", "name": "Set leader and followers", "rules": [ { "t": "set", "p": "leader", "pt": "msg", "to": "media_player.bedroom", "tot": "str" }, { "t": "set", "p": "followers", "pt": "msg", "to": "[\"media_player.denon_avr_x3600h\",\"media_player.kitchen\",\"media_player.bathroom\"]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 450, "y": 1080, "wires": [ [ "ccc51eb8edf2e33d" ] ] }, { "id": "80be5093f48e88fc", "type": "change", "z": "f02b32ef07b4b378", "name": "Set leader and followers", "rules": [ { "t": "set", "p": "leader", "pt": "msg", "to": "media_player.bedroom", "tot": "str" }, { "t": "set", "p": "followers", "pt": "msg", "to": "[\"media_player.kitchen\",\"media_player.bathroom\"]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 450, "y": 1140, "wires": [ [ "ccc51eb8edf2e33d" ] ] }, { "id": "aaafe15411371f43", "type": "change", "z": "f02b32ef07b4b378", "name": "Set leader and followers", "rules": [ { "t": "set", "p": "leader", "pt": "msg", "to": "media_player.bedroom", "tot": "str" }, { "t": "set", "p": "followers", "pt": "msg", "to": "[\"media_player.denon_avr_x3600h\",\"media_player.kitchen\"]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 450, "y": 1200, "wires": [ [ "ccc51eb8edf2e33d" ] ] }, { "id": "980d8e52b0eceaff", "type": "change", "z": "f02b32ef07b4b378", "name": "Set leader and followers", "rules": [ { "t": "set", "p": "leader", "pt": "msg", "to": "media_player.kitchen", "tot": "str" }, { "t": "set", "p": "followers", "pt": "msg", "to": "[\"media_player.denon_avr_x3600h\",\"media_player.bathroom\"]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 450, "y": 1260, "wires": [ [ "ccc51eb8edf2e33d" ] ] }, { "id": "1278b99a481e6dd1", "type": "comment", "z": "f02b32ef07b4b378", "name": "Home Theather volume control on heos start", "info": "", "x": 210, "y": 1360, "wires": [] }, { "id": "5f677939f2c09f28", "type": "trigger-state", "z": "f02b32ef07b4b378", "name": "Switching home theather to heos", "server": "657c7463.48e1e4", "version": 5, "inputs": 0, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "media_player.home_theater_universal" ], "substring": [], "regex": [] }, "debugEnabled": false, "constraints": [ { "targetType": "this_entity", "targetValue": "", "propertyType": "property", "propertyValue": "new_state.attributes.source", "comparatorType": "is", "comparatorValueDatatype": "str", "comparatorValue": "HEOS Music" }, { "targetType": "this_entity", "targetValue": "", "propertyType": "property", "propertyValue": "old_state.attributes.source", "comparatorType": "is_not", "comparatorValueDatatype": "str", "comparatorValue": "HEOS Music" } ], "customOutputs": [], "outputInitially": false, "stateType": "str", "enableInput": false, "x": 170, "y": 1400, "wires": [ [ "8c788d92123228cb" ], [] ] }, { "id": "8c788d92123228cb", "type": "delay", "z": "f02b32ef07b4b378", "name": "", "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 430, "y": 1400, "wires": [ [ "f1ddda7676ab9bbc" ] ] }, { "id": "f1ddda7676ab9bbc", "type": "api-current-state", "z": "f02b32ef07b4b378", "name": "Fetch bedroom volume", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "media_player.bedroom", "state_type": "str", "blockInputOverrides": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 630, "y": 1400, "wires": [ [ "087e6e0c92150113" ] ] }, { "id": "087e6e0c92150113", "type": "change", "z": "f02b32ef07b4b378", "name": "Calculate volume", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "(\t $leader_volume := data.attributes.is_volume_muted ? 0 : $number(data.attributes.volume_level ? data.attributes.volume_level : 0);\t $base_volume := $leader_volume = 0 ? 0.15 : $leader_volume;\t $added_volume := $base_volume + 0.18;\t $clamped_volume := $added_volume > 0.5 ? 0.5 : $added_volume;\t $target_volume := $round($clamped_volume, 2);\t { \"entity_id\": \"media_player.home_theater_universal\", \"volume_level\": $target_volume }\t)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 880, "y": 1400, "wires": [ [ "8a59f44f4fc0c8d0" ] ] }, { "id": "8a59f44f4fc0c8d0", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Set home theather volume", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.volume_set", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "payload", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": true, "domain": "media_player", "service": "volume_set", "x": 1160, "y": 1400, "wires": [ [] ] }, { "id": "c8d37a58.56051", "type": "server-state-changed", "z": "da896085.24c698", "name": "Remote is on", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "remote.living_room" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 130, "y": 80, "wires": [ [ "73d6c796.13d8f8" ], [] ] }, { "id": "275763d9.2d137c", "type": "debug", "z": "da896085.24c698", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "x": 590, "y": 260, "wires": [] }, { "id": "73d6c796.13d8f8", "type": "switch", "z": "da896085.24c698", "name": "", "property": "data.new_state.attributes.current_activity", "propertyType": "msg", "rules": [ { "t": "eq", "v": "Entertainment", "vt": "str" }, { "t": "eq", "v": "Playstation", "vt": "str" }, { "t": "eq", "v": "Play Record", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 3, "x": 390, "y": 80, "wires": [ [ "275763d9.2d137c" ], [], [] ] }, { "id": "f337ae51.b639e", "type": "api-call-service", "z": "da896085.24c698", "name": "Switch to TV Scene", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "script.scene_watch_tv", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "script", "service": "scene_watch_tv", "output_location": "", "output_location_type": "none", "x": 890, "y": 60, "wires": [ [] ] }, { "id": "eb217ba8.833d48", "type": "server-state-changed", "z": "1f4d4622.7490ca", "d": true, "name": "Outside temperature", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.openweathermap_temperature" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "num", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "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": 110, "y": 120, "wires": [ [ "c8bf7086.b32ab8", "be230668.4e6718", "1de4cd6b31838517" ] ] }, { "id": "c8bf7086.b32ab8", "type": "api-current-state", "z": "1f4d4622.7490ca", "name": "Inside temperature", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "sensor.livingroom_temperature_avg", "state_type": "num", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 470, "y": 120, "wires": [ [ "13a9b38f.3ab9d4", "1de4cd6b31838517" ] ] }, { "id": "68aa8fe5.4cd4f", "type": "function", "z": "1f4d4622.7490ca", "name": "Determine cooler or warmer", "func": "var outsideTemp = parseFloat(msg.payload.outside);\nvar insideTemp = parseFloat(msg.payload.inside);\nvar notification = '';\n\nif (outsideTemp < insideTemp) {\n notification = 'Outside is cooler than inside';\n} else {\n notification = 'Outside is warmer than inside';\n}\n\nmsg.payload = notification;\n\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 880, "y": 180, "wires": [ [ "e27e4896.4eefa", "1de4cd6b31838517" ] ] }, { "id": "e27e4896.4eefa", "type": "api-call-service", "z": "1f4d4622.7490ca", "name": "Notify via HA", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "notify.gotify_ha", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"title\":\"Info\",\"message\":\"{{{payload}}}\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "notify", "service": "gotify_ha", "output_location": "", "output_location_type": "none", "x": 1130, "y": 180, "wires": [ [] ] }, { "id": "be230668.4e6718", "type": "change", "z": "1f4d4622.7490ca", "name": "Clear data", "rules": [ { "t": "delete", "p": "data", "pt": "msg" }, { "t": "set", "p": "topic", "pt": "msg", "to": "outside", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 470, "y": 260, "wires": [ [ "2119da07.2ad496" ] ] }, { "id": "13a9b38f.3ab9d4", "type": "change", "z": "1f4d4622.7490ca", "name": "Clear data", "rules": [ { "t": "delete", "p": "data", "pt": "msg" }, { "t": "set", "p": "topic", "pt": "msg", "to": "inside", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 470, "y": 200, "wires": [ [ "2119da07.2ad496" ] ] }, { "id": "2119da07.2ad496", "type": "join", "z": "1f4d4622.7490ca", "name": "", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "2", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 670, "y": 180, "wires": [ [ "68aa8fe5.4cd4f" ] ] }, { "id": "1de4cd6b31838517", "type": "debug", "z": "1f4d4622.7490ca", "name": "Temperature alert", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 830, "y": 60, "wires": [] }, { "id": "9a99a3d8e416b026", "type": "comment", "z": "1f4d4622.7490ca", "name": "Temperature alert", "info": "", "x": 100, "y": 80, "wires": [] }, { "id": "a676209fc00d4d6c", "type": "comment", "z": "1f4d4622.7490ca", "name": "Climate control", "info": "", "x": 100, "y": 360, "wires": [] }, { "id": "6156c5585680e99e", "type": "server-state-changed", "z": "1f4d4622.7490ca", "d": true, "name": "Livingroom window open", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.window_handle_bedroom_state" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "closed", "ifStateType": "str", "ifStateOperator": "is_not", "outputOnlyOnStateChange": 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": 130, "y": 420, "wires": [ [ "ea05134bce8525ef" ], [ "e2f354b6c7b22e8d" ] ] }, { "id": "ea05134bce8525ef", "type": "api-call-service", "z": "1f4d4622.7490ca", "d": true, "name": "Activate window open mode", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "scene.turn_on", "floorId": [], "areaId": [ "7047cdd7d50e49f980eba16f832acb57" ], "deviceId": [], "entityId": [ "scene.bedroom_climate_window_open" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "scene", "service": "turn_on", "output_location": "", "output_location_type": "none", "x": 520, "y": 420, "wires": [ [] ] }, { "id": "e2f354b6c7b22e8d", "type": "api-call-service", "z": "1f4d4622.7490ca", "d": true, "name": "Activate window open mode", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "scene.apply", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "scene", "service": "apply", "output_location": "", "output_location_type": "none", "x": 520, "y": 500, "wires": [ [] ] }, { "id": "ap_hdr_001", "type": "comment", "z": "1f4d4622.7490ca", "name": "Air Purifier - Preset Mode Sync", "info": "", "x": 150, "y": 580, "wires": [] }, { "id": "ap_cmt_a_001", "type": "comment", "z": "1f4d4622.7490ca", "name": "Flow A: Dashboard → Fan", "info": "", "x": 130, "y": 620, "wires": [] }, { "id": "ap_ssc_is_001", "type": "server-state-changed", "z": "1f4d4622.7490ca", "name": "Air Purifier Mode (input_select)", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_select.air_purifier_mode" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" } ], "x": 150, "y": 660, "wires": [ [ "ap_func_a_001" ] ] }, { "id": "ap_func_a_001", "type": "function", "z": "1f4d4622.7490ca", "name": "Check/set flag", "func": "if (flow.get('purifier_updating') === true) {\n return [null, null];\n}\nflow.set('purifier_updating', true);\nif (msg.payload === 'Off') {\n return [null, msg];\n}\nreturn [msg, null];", "outputs": 2, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 660, "wires": [ [ "ap_slug_001" ], [ "ap_acs_off_001" ] ] }, { "id": "ap_slug_001", "type": "string", "z": "1f4d4622.7490ca", "name": "Slugify to preset ID", "methods": [ { "name": "slugify", "params": [] }, { "name": "replaceAll", "params": [ { "type": "str", "value": "-" }, { "type": "str", "value": "_" } ] } ], "prop": "payload", "propout": "payload", "object": "msg", "objectout": "msg", "x": 610, "y": 660, "wires": [ [ "ap_acs_fan_001" ] ] }, { "id": "ap_acs_fan_001", "type": "api-call-service", "z": "1f4d4622.7490ca", "name": "Set fan preset mode", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "fan.set_preset_mode", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "fan.bedroom" ], "labelId": [], "data": "{\"preset_mode\": msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "fan", "service": "set_preset_mode", "x": 850, "y": 660, "wires": [ [ "ap_dly_a_001" ] ] }, { "id": "ap_dly_a_001", "type": "delay", "z": "1f4d4622.7490ca", "name": "Wait 1s", "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1070, "y": 660, "wires": [ [ "ap_rst_a_001" ] ] }, { "id": "ap_rst_a_001", "type": "change", "z": "1f4d4622.7490ca", "name": "Reset flag", "rules": [ { "t": "set", "p": "purifier_updating", "pt": "flow", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1220, "y": 660, "wires": [ [] ] }, { "id": "ap_cmt_b_001", "type": "comment", "z": "1f4d4622.7490ca", "name": "Flow B: Fan → Dashboard", "info": "", "x": 130, "y": 780, "wires": [] }, { "id": "ap_ssc_fan_001", "type": "server-state-changed", "z": "1f4d4622.7490ca", "name": "Air Purifier (fan)", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "fan.bedroom" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": false, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" } ], "x": 100, "y": 820, "wires": [ [ "ap_func_b_001" ] ] }, { "id": "ap_func_b_001", "type": "function", "z": "1f4d4622.7490ca", "name": "Check flag + transform", "func": "const newState = msg.payload;\nconst newPreset = msg.data.new_state.attributes.preset_mode;\nconst oldPreset = msg.data.old_state ? msg.data.old_state.attributes.preset_mode : null;\nconst oldState = msg.data.old_state ? msg.data.old_state.state : null;\n\nif (flow.get('purifier_updating') === true) return null;\n\nif (newState === 'off') {\n if (oldState === 'off') return null;\n flow.set('purifier_updating', true);\n msg.payload = 'Off';\n return msg;\n}\n\nif (newPreset === oldPreset) return null;\nflow.set('purifier_updating', true);\nmsg.payload = newPreset.split('_').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ');\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 820, "wires": [ [ "ap_acs_is_001" ] ] }, { "id": "ap_acs_is_001", "type": "api-call-service", "z": "1f4d4622.7490ca", "name": "Update input_select", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.air_purifier_mode" ], "labelId": [], "data": "{\"option\": msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "x": 630, "y": 820, "wires": [ [ "ap_dly_b_001" ] ] }, { "id": "ap_dly_b_001", "type": "delay", "z": "1f4d4622.7490ca", "name": "Wait 1s", "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 850, "y": 820, "wires": [ [ "ap_rst_b_001" ] ] }, { "id": "ap_rst_b_001", "type": "change", "z": "1f4d4622.7490ca", "name": "Reset flag", "rules": [ { "t": "set", "p": "purifier_updating", "pt": "flow", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1070, "y": 820, "wires": [ [] ] }, { "id": "ap_acs_off_001", "type": "api-call-service", "z": "1f4d4622.7490ca", "name": "Turn off purifier", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "fan.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "fan.bedroom" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "fan", "service": "turn_off", "x": 850, "y": 720, "wires": [ [ "ap_dly_a_001" ] ] }, { "id": "f3a37054.39c5e", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Bathroom Motion", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.bathroom_motion" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 160, "y": 180, "wires": [ [ "a621255c.9f3f68" ] ] }, { "id": "a621255c.9f3f68", "type": "switch", "z": "a9edb9da.ccb6d", "name": "On or Off", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on", "vt": "str" }, { "t": "eq", "v": "off", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 340, "y": 180, "wires": [ [ "3d6da756.4dd7d8", "2a6b709d.d09008" ], [ "2a6b709d.d09008" ] ] }, { "id": "a4c3349e.8a322", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Turn on", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "script.{{payload}}", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "script", "service": "{{payload}}", "output_location": "", "output_location_type": "none", "x": 1140, "y": 160, "wires": [ [] ] }, { "id": "53fec2fd.96730c", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Turn off", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.bathroom" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_off", "output_location": "", "output_location_type": "none", "x": 1020, "y": 300, "wires": [ [] ] }, { "id": "3d6da756.4dd7d8", "type": "api-current-state", "z": "a9edb9da.ccb6d", "name": "Bathroom light status", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "off", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.bathroom", "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": 620, "y": 60, "wires": [ [ "251c7437.a18554" ], [] ] }, { "id": "2a6b709d.d09008", "type": "stoptimer-varidelay", "z": "a9edb9da.ccb6d", "duration": "120", "durationType": "num", "units": "Second", "payloadtype": "num", "payloadval": "0", "name": "", "x": 710, "y": 240, "wires": [ [ "d550e021.fe23a" ], [], [] ] }, { "id": "b2bc4296.7de718", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Hallway Motion", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.hallway_motion" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 460, "wires": [ [ "a15cb282.9b59a8" ] ] }, { "id": "a15cb282.9b59a8", "type": "switch", "z": "a9edb9da.ccb6d", "name": "On or Off", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on", "vt": "str" }, { "t": "eq", "v": "off", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 380, "y": 460, "wires": [ [ "e13f2dd9.12937", "8d847d6b.3e76c8" ], [ "8d847d6b.3e76c8" ] ] }, { "id": "8a2e7e1b.11471", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Turn off", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.hallway" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_off", "output_location": "", "output_location_type": "none", "x": 1160, "y": 600, "wires": [ [] ] }, { "id": "e13f2dd9.12937", "type": "api-current-state", "z": "a9edb9da.ccb6d", "name": "Hallway light status", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "off", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.hallway", "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": 610, "y": 420, "wires": [ [ "74e4cae8.021cc4" ], [] ] }, { "id": "8d847d6b.3e76c8", "type": "stoptimer-varidelay", "z": "a9edb9da.ccb6d", "duration": "120", "durationType": "num", "units": "Second", "payloadtype": "num", "payloadval": "0", "name": "", "persist": false, "x": 670, "y": 560, "wires": [ [ "84dd47fc.401908" ], [], [] ] }, { "id": "2a492dfb.c1d1aa", "type": "subflow:e52c44dc.71cb5", "z": "a9edb9da.ccb6d", "name": "", "env": [], "x": 630, "y": 160, "wires": [ [ "2046a794.95dbf8" ], [ "2046a794.95dbf8" ] ] }, { "id": "251c7437.a18554", "type": "change", "z": "a9edb9da.ccb6d", "name": "Day Mode", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "lights_bathroom_default", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 870, "y": 180, "wires": [ [ "a4c3349e.8a322" ] ] }, { "id": "2046a794.95dbf8", "type": "change", "z": "a9edb9da.ccb6d", "name": "NIght Mode", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "lights_bathroom_night", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 870, "y": 140, "wires": [ [ "a4c3349e.8a322" ] ] }, { "id": "f75b8e7d.5a41", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Turn on", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "script.{{payload}}", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "script", "service": "{{payload}}", "output_location": "", "output_location_type": "none", "x": 1160, "y": 500, "wires": [ [] ] }, { "id": "2ec0419c.2b47de", "type": "subflow:e52c44dc.71cb5", "z": "a9edb9da.ccb6d", "name": "", "env": [], "x": 650, "y": 500, "wires": [ [ "75d95034.3eedb8" ], [ "75d95034.3eedb8" ] ] }, { "id": "74e4cae8.021cc4", "type": "change", "z": "a9edb9da.ccb6d", "name": "Day Mode", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "lights_hallway_default", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 890, "y": 520, "wires": [ [ "f75b8e7d.5a41" ] ] }, { "id": "75d95034.3eedb8", "type": "change", "z": "a9edb9da.ccb6d", "name": "NIght Mode", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "lights_hallway_night", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 890, "y": 480, "wires": [ [ "f75b8e7d.5a41" ] ] }, { "id": "d81ec1ce.a79708", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Bathroom Motion", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.bathroom_motion" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "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": 180, "y": 740, "wires": [ [ "871cbf67.15da1" ], [] ] }, { "id": "4f7b5988.be4f98", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Hallway Motion", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.hallway_motion" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "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": 180, "y": 800, "wires": [ [ "968bedf.e30a31" ], [] ] }, { "id": "b0a84917.d9a89", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Livingroom Motion", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.livingroom_motion" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "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": 860, "wires": [ [ "d614641a.552438" ], [] ] }, { "id": "871cbf67.15da1", "type": "change", "z": "a9edb9da.ccb6d", "name": "Set Bathroom", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "bathroom", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 400, "y": 740, "wires": [ [ "7d3df8ac.4610c", "bce32dc1.85221" ] ] }, { "id": "968bedf.e30a31", "type": "change", "z": "a9edb9da.ccb6d", "name": "Set Hallway", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "hallway", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 390, "y": 800, "wires": [ [ "7d3df8ac.4610c", "bce32dc1.85221" ] ] }, { "id": "d614641a.552438", "type": "change", "z": "a9edb9da.ccb6d", "name": "Set Livingroom", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "livingroom", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 400, "y": 860, "wires": [ [ "7d3df8ac.4610c", "bce32dc1.85221" ] ] }, { "id": "7d3df8ac.4610c", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Update last motion to value", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.last_motion" ], "labelId": [], "data": "{\"option\":\"{{payload}}\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "output_location": "", "output_location_type": "none", "x": 770, "y": 820, "wires": [ [] ] }, { "id": "c59f167c.f20e", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Notify via HA", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "notify.gotify_ha", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"title\":\"Info\",\"message\":\"{{{payload}}}\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "notify", "service": "gotify_ha", "output_location": "", "output_location_type": "none", "x": 1010, "y": 940, "wires": [ [] ] }, { "id": "bce32dc1.85221", "type": "template", "z": "a9edb9da.ccb6d", "name": "Motion detected in...", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "Motion detected in {{payload}}.", "output": "str", "x": 720, "y": 940, "wires": [ [] ] }, { "id": "7529dee.0a6322", "type": "comment", "z": "a9edb9da.ccb6d", "name": "Enable notifications when we have out of home detection", "info": "", "x": 830, "y": 900, "wires": [] }, { "id": "7b42fe61.f5b758", "type": "comment", "z": "a9edb9da.ccb6d", "name": "Set last motion entity", "info": "", "x": 190, "y": 700, "wires": [] }, { "id": "d550e021.fe23a", "type": "api-current-state", "z": "a9edb9da.ccb6d", "name": "Still in bathroom?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "bathroom", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_select.last_motion", "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": 710, "y": 320, "wires": [ [ "2a6b709d.d09008" ], [ "53fec2fd.96730c" ] ] }, { "id": "3efd032.0055a7c", "type": "subflow:e52c44dc.71cb5", "z": "a9edb9da.ccb6d", "name": "", "env": [], "x": 550, "y": 1100, "wires": [ [ "7c0d40bf.1ee4c" ], [ "7c0d40bf.1ee4c" ] ] }, { "id": "a3eba9b6.df5ca8", "type": "inject", "z": "a9edb9da.ccb6d", "name": "", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 320, "y": 1080, "wires": [ [ "3efd032.0055a7c" ] ] }, { "id": "7c0d40bf.1ee4c", "type": "debug", "z": "a9edb9da.ccb6d", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 860, "y": 1100, "wires": [] }, { "id": "fc251c5a.cc6918", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Last motion room updated", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_select.last_motion" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "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": 210, "y": 1000, "wires": [ [ "e3ecc53a.1c89e8" ] ] }, { "id": "e3ecc53a.1c89e8", "type": "template", "z": "a9edb9da.ccb6d", "name": "Last motion variable set to...", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "Last motion variable set to: {{payload}}.", "output": "str", "x": 520, "y": 1000, "wires": [ [ "c59f167c.f20e" ] ] }, { "id": "84dd47fc.401908", "type": "api-current-state", "z": "a9edb9da.ccb6d", "name": "Still in Hallway?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "hallway", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_select.last_motion", "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": 640, "wires": [ [ "8d847d6b.3e76c8" ], [ "8a2e7e1b.11471" ] ] }, { "id": "6240870c.31fd5", "type": "server-state-changed", "z": "bbf25964.5edb38", "name": "Coffee warump time", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.coffee_warmup_time" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 200, "wires": [ [ "2192f59f.22ce22" ] ] }, { "id": "2192f59f.22ce22", "type": "function", "z": "bbf25964.5edb38", "name": "actual start time", "outputs": 1, "x": 400, "y": 200, "wires": [ [ "beb09931.b70f28", "a8e14f78.138b18" ] ] }, { "id": "beb09931.b70f28", "type": "schedex", "z": "bbf25964.5edb38", "name": "Wake up timer", "x": 660, "y": 200, "wires": [ [ "1c291b99.49c854" ] ] }, { "id": "1c291b99.49c854", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Warmup enabled?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.coffee_warmup_enable", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 230, "y": 280, "wires": [ [ "d05c6bb6.89189", "96ec81ec.b8b198" ], [] ] }, { "id": "6cb3a102.ddf1", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Turn on espresso", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "areaId": [], "deviceId": [], "entityId": [ "switch.espresso_machine" ], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "domain": "switch", "service": "turn_on", "x": 890, "y": 280, "wires": [ [] ] }, { "id": "d05c6bb6.89189", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Turn off warmup", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "areaId": [], "deviceId": [], "entityId": [ "input_boolean.coffee_warmup_enable" ], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "domain": "input_boolean", "service": "turn_off", "x": 560, "y": 360, "wires": [ [] ] }, { "id": "81386d51.ea72e8", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Notify via HA", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "areaId": [], "deviceId": [], "entityId": [], "data": "{{{payload}}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "domain": "notify", "service": "gotify_ha", "x": 1190, "y": 160, "wires": [ [] ] }, { "id": "96ec81ec.b8b198", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Espresso machine already on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "off", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "switch.espresso_machine", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 610, "y": 280, "wires": [ [ "6cb3a102.ddf1" ], [] ] }, { "id": "2d4463ba.d359dc", "type": "function", "z": "bbf25964.5edb38", "name": "Espresso ready at...", "outputs": 1, "x": 1180, "y": 80, "wires": [ [ "81386d51.ea72e8" ] ] }, { "id": "a8e14f78.138b18", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Warmup enabled?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.coffee_warmup_enable", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 390, "y": 120, "wires": [ [ "b837b0d4.49bfe" ], [] ] }, { "id": "b837b0d4.49bfe", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Espresso machine already on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "off", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "switch.espresso_machine", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 870, "y": 120, "wires": [ [ "2d4463ba.d359dc" ], [] ] }, { "id": "9baaac50.5dc4d8", "type": "server-state-changed", "z": "bbf25964.5edb38", "name": "Coffee one time switch is on", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_boolean.coffee_one_time_warmup" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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": 40, "wires": [ [ "cc2ab74b.72878" ], [] ] }, { "id": "cc2ab74b.72878", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Get warm up time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_datetime.coffee_warmup_time", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 410, "y": 40, "wires": [ [ "4cf72b61.3d5e4c" ] ] }, { "id": "4cf72b61.3d5e4c", "type": "function", "z": "bbf25964.5edb38", "name": "actual start time", "outputs": 1, "x": 600, "y": 40, "wires": [ [ "b837b0d4.49bfe" ] ] }, { "id": "5009c878.847b08", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Get auto standby time", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_number.espresso_auto_standby", "state_type": "num", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": 0, "forType": "num", "forUnits": "minutes", "x": 480, "y": 500, "wires": [ [ "d76881ab.11ea4" ] ] }, { "id": "c1260337.f1478", "type": "server-state-changed", "z": "bbf25964.5edb38", "name": "Espresso machine is on", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "switch.espresso_machine" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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": 500, "wires": [ [ "5009c878.847b08" ], [] ] }, { "id": "e3a24a7e.c7952", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Turn off espresso", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "areaId": [], "deviceId": [], "entityId": [ "switch.espresso_machine" ], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "domain": "switch", "service": "turn_off", "x": 1070, "y": 560, "wires": [ [] ] }, { "id": "d76881ab.11ea4", "type": "stoptimer-varidelay", "z": "bbf25964.5edb38", "name": "Off timer (default 60 mins)", "x": 790, "y": 560, "wires": [ [ "e3a24a7e.c7952" ], [], [] ] }, { "id": "3bdeab05.91997c", "type": "server-state-changed", "z": "bbf25964.5edb38", "name": "Espresso machine is off", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "switch.espresso_machine" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "off", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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": 580, "wires": [ [ "d96cad4e.4fd068" ], [] ] }, { "id": "d96cad4e.4fd068", "type": "change", "z": "bbf25964.5edb38", "name": "Send STOP", "x": 450, "y": 580, "wires": [ [ "d76881ab.11ea4" ] ] }, { "id": "cc000001", "type": "comment", "z": "bbf25964.5edb38", "name": "Coffee Circle Subscription — fetches next delivery data every 6h", "info": "", "x": 310, "y": 660, "wires": [] }, { "id": "cc000002", "type": "inject", "z": "bbf25964.5edb38", "name": "Every 6h + on deploy", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "21600", "crontab": "", "once": true, "onceDelay": "5", "topic": "", "payload": "", "payloadType": "date", "x": 200, "y": 720, "wires": [ [ "cc000004" ] ] }, { "id": "cc000003", "type": "link in", "z": "bbf25964.5edb38", "name": "CC Fetch Trigger", "links": [], "x": 195, "y": 780, "wires": [ [ "cc000004" ] ] }, { "id": "cc000004", "type": "function", "z": "bbf25964.5edb38", "name": "Read session cookie", "func": "msg.payload = env.get(\"CC_SESSION\");\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 420, "y": 720, "wires": [ [ "cc000005" ] ] }, { "id": "cc000005", "type": "function", "z": "bbf25964.5edb38", "name": "Build auth request", "func": "const sessionCookie = msg.payload;\nif (!sessionCookie || sessionCookie === '') {\n node.error('CC_SESSION env var is empty — set it in Node-RED Coffee-mations tab settings');\n return null;\n}\nmsg.url = 'https://account.coffeecircle.com/oauth/token';\nmsg.method = 'GET';\nmsg.headers = { 'Cookie': '_shopify_essential=' + sessionCookie };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 640, "y": 720, "wires": [ [ "cc000006" ] ] }, { "id": "cc000006", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /oauth/token", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 880, "y": 720, "wires": [ [ "cc000007", "cc00000f" ] ] }, { "id": "cc000007", "type": "function", "z": "bbf25964.5edb38", "name": "Extract token + charges URL", "func": "const resp = msg.payload;\nconst token = resp?.access_token || resp?.token || resp?.bearer_token || resp?.accessToken || resp?.id_token;\nif (!token) {\n node.error('/oauth/token response: ' + JSON.stringify(resp));\n return null;\n}\nflow.set('cc_token', token);\nconst today = new Date().toISOString().split('T')[0];\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges?status=queued,error,skipped&scheduledAtMin=' + today;\nmsg.method = 'GET';\nmsg.headers = { 'Authorization': 'Bearer ' + token };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1140, "y": 720, "wires": [ [ "cc000008" ] ] }, { "id": "cc000008", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /charges", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1360, "y": 720, "wires": [ [ "cc000009", "cc000010" ] ] }, { "id": "cc000009", "type": "function", "z": "bbf25964.5edb38", "name": "Parse charges → charge_id", "func": "const resp = msg.payload;\nconst charges = resp?.charges || resp?.data || resp?.items || resp?.results || (Array.isArray(resp) ? resp : null);\nif (!charges || charges.length === 0) {\n node.error('No queued charges. Response: ' + JSON.stringify(resp).substring(0, 300));\n return null;\n}\nconst charge = charges[0];\nconst chargeId = charge?.id || charge?.charge_id;\nconst deliveryDate = charge?.scheduledAt || charge?.scheduled_at || charge?.next_billing_date || charge?.billing_date || charge?.ship_date;\nif (!chargeId) {\n node.error('Cannot extract charge ID. Keys: ' + Object.keys(charge || {}).join(', '));\n return null;\n}\nflow.set('cc_charge_id', String(chargeId));\nflow.set('cc_delivery_date', deliveryDate || 'unknown');\nconst token = flow.get('cc_token');\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges/' + chargeId;\nmsg.method = 'GET';\nmsg.headers = { 'Authorization': 'Bearer ' + token };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1600, "y": 720, "wires": [ [ "cc00000a" ] ] }, { "id": "cc00000a", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /charges/", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1840, "y": 720, "wires": [ [ "cc00000b", "cc000011" ] ] }, { "id": "cc00000b", "type": "function", "z": "bbf25964.5edb38", "name": "Parse detail → 3 sensors", "func": "const resp = msg.payload;\nconst charge = resp?.charge || resp?.data || resp;\nconst lineItems = charge?.lineItems || charge?.line_items || charge?.items || [];\nconst firstItem = lineItems[0] || {};\nconst product = firstItem.title || firstItem.product_title || firstItem.name || charge?.product_title || 'Coffee subscription';\nconst totalObj = charge?.totalAmount || {};\nconst totalVal = totalObj?.amount || charge?.total_price || charge?.total || '?';\nconst currency = totalObj?.currencyCode || 'EUR';\nconst currencySymbol = { EUR: '€', USD: '$', GBP: '£' }[currency] || currency + ' ';\nconst total = currencySymbol + totalVal;\nconst deliveryDate = flow.get('cc_delivery_date') || charge?.scheduledAt || charge?.scheduled_at || 'unknown';\nconst mkMsg = p => ({ _msgid: msg._msgid, payload: p });\nreturn [mkMsg(deliveryDate), mkMsg(product), mkMsg(total)];", "outputs": 3, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2080, "y": 720, "wires": [ [ "cc00000c" ], [ "cc00000d" ], [ "cc00000e" ] ] }, { "id": "cc00000c", "type": "ha-sensor", "z": "bbf25964.5edb38", "name": "cc_next_delivery_date", "entityConfig": "cc000023", "version": 1, "state": "payload", "stateType": "msg", "attributes": [], "inputOverride": "allow", "outputProperties": [], "x": 2340, "y": 680, "wires": [ [] ] }, { "id": "cc00000e", "type": "ha-sensor", "z": "bbf25964.5edb38", "name": "cc_next_delivery_total", "entityConfig": "cc000025", "version": 1, "state": "payload", "stateType": "msg", "attributes": [], "inputOverride": "allow", "outputProperties": [], "x": 2340, "y": 760, "wires": [ [] ] }, { "id": "cc00000f", "type": "debug", "z": "bbf25964.5edb38", "name": "Token response", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 880, "y": 800, "wires": [] }, { "id": "cc000010", "type": "debug", "z": "bbf25964.5edb38", "name": "Charges response", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1360, "y": 800, "wires": [] }, { "id": "cc000011", "type": "debug", "z": "bbf25964.5edb38", "name": "Detail response", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1840, "y": 800, "wires": [] }, { "id": "cc000012", "type": "catch", "z": "bbf25964.5edb38", "name": "CC Errors", "scope": [ "cc000004", "cc000005", "cc000006", "cc000007", "cc000008", "cc000009", "cc00000a", "cc00000b", "cc000017", "cc000018", "cc000019", "cc00001a", "cc00001b", "cc00001c", "cc00001d" ], "uncaught": false, "x": 160, "y": 880, "wires": [ [ "cc000013" ] ] }, { "id": "cc000013", "type": "function", "z": "bbf25964.5edb38", "name": "Format error", "func": "const errMsg = (msg.error && msg.error.message) ? msg.error.message : String(msg.payload || 'Unknown error');\nmsg.payload = JSON.stringify({\n title: 'Coffee Circle Error',\n message: errMsg + '\\n\\nIf auth error: update CC_SESSION env var in Node-RED tab settings.',\n notification_id: 'cc_integration_error'\n});\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 380, "y": 880, "wires": [ [ "cc000014" ] ] }, { "id": "cc000014", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Notify error", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "areaId": [], "deviceId": [], "entityId": [], "data": "{{{payload}}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "domain": "persistent_notification", "service": "create", "x": 600, "y": 880, "wires": [ [] ] }, { "id": "cc000015", "type": "comment", "z": "bbf25964.5edb38", "name": "CC Send Now — triggers immediate delivery on button press", "info": "", "x": 290, "y": 960, "wires": [] }, { "id": "cc000016", "type": "ha-button", "z": "bbf25964.5edb38", "name": "CC Send Now button", "version": 1, "outputs": 1, "entityConfig": "cc000026", "outputProperties": [], "x": 180, "y": 1020, "wires": [ [ "cc000017" ] ] }, { "id": "cc000017", "type": "function", "z": "bbf25964.5edb38", "name": "Read session cookie", "func": "msg.payload = env.get(\"CC_SESSION\");\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 400, "y": 1020, "wires": [ [ "cc000018" ] ] }, { "id": "cc000018", "type": "function", "z": "bbf25964.5edb38", "name": "Build auth request", "func": "const sessionCookie = msg.payload;\nif (!sessionCookie || sessionCookie === '') {\n node.error('CC_SESSION env var is empty — set it in Node-RED Coffee-mations tab settings');\n return null;\n}\nmsg.url = 'https://account.coffeecircle.com/oauth/token';\nmsg.method = 'GET';\nmsg.headers = { 'Cookie': '_shopify_essential=' + sessionCookie };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 640, "y": 1020, "wires": [ [ "cc000019" ] ] }, { "id": "cc000019", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /oauth/token", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 880, "y": 1020, "wires": [ [ "cc00001a" ] ] }, { "id": "cc00001a", "type": "function", "z": "bbf25964.5edb38", "name": "Extract token + charges URL", "func": "const resp = msg.payload;\nconst token = resp?.access_token || resp?.token || resp?.bearer_token || resp?.accessToken || resp?.id_token;\nif (!token) {\n node.error('/oauth/token response: ' + JSON.stringify(resp));\n return null;\n}\nflow.set('cc_token', token);\nconst today = new Date().toISOString().split('T')[0];\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges?status=queued,error,skipped&scheduledAtMin=' + today;\nmsg.method = 'GET';\nmsg.headers = { 'Authorization': 'Bearer ' + token };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1140, "y": 1020, "wires": [ [ "cc00001b" ] ] }, { "id": "cc00001b", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /charges", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1360, "y": 1020, "wires": [ [ "cc00001c" ] ] }, { "id": "cc00001c", "type": "function", "z": "bbf25964.5edb38", "name": "Extract charge_id + build process URL", "func": "const resp = msg.payload;\nconst charges = resp?.charges || resp?.data || resp?.items || resp?.results || (Array.isArray(resp) ? resp : null);\nif (!charges || charges.length === 0) {\n node.error('No queued charges for Send Now');\n return null;\n}\nconst charge = charges[0];\nconst chargeId = charge?.id || charge?.charge_id;\nif (!chargeId) {\n node.error('Cannot extract charge ID. Keys: ' + Object.keys(charge || {}).join(', '));\n return null;\n}\nconst token = flow.get('cc_token');\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges/' + chargeId + '/process';\nmsg.method = 'POST';\nmsg.headers = { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' };\nmsg.payload = {};\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1620, "y": 1020, "wires": [ [ "cc00001d" ] ] }, { "id": "cc00001d", "type": "http request", "z": "bbf25964.5edb38", "name": "POST /charges//process", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1880, "y": 1020, "wires": [ [ "cc00001e" ] ] }, { "id": "cc00001e", "type": "function", "z": "bbf25964.5edb38", "name": "Check result", "func": "const statusCode = msg.statusCode;\nif (statusCode >= 200 && statusCode < 300) {\n return [msg, null];\n}\nconst detail = JSON.stringify(msg.payload).substring(0, 200);\nmsg.payload = JSON.stringify({\n title: 'Coffee Circle Send Now Failed',\n message: 'HTTP ' + statusCode + ': ' + detail,\n notification_id: 'cc_send_now_error'\n});\nreturn [null, msg];", "outputs": 2, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2100, "y": 1020, "wires": [ [ "cc00001f" ], [ "cc000020" ] ] }, { "id": "cc00001f", "type": "link out", "z": "bbf25964.5edb38", "name": "Trigger CC Fetch", "mode": "link", "links": [ "cc000003" ], "x": 2320, "y": 1000, "wires": [] }, { "id": "cc000020", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Notify Send Now error", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "areaId": [], "deviceId": [], "entityId": [], "data": "{{{payload}}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "domain": "persistent_notification", "service": "create", "x": 2340, "y": 1060, "wires": [ [] ] }, { "id": "cc000028", "type": "comment", "z": "bbf25964.5edb38", "name": "CC Postpone by 1 Week — postpones delivery by 7 days on button press", "info": "", "x": 280, "y": 1260, "wires": [] }, { "id": "cc000029", "type": "ha-button", "z": "bbf25964.5edb38", "name": "CC Postpone 1 week", "version": 1, "outputs": 1, "entityConfig": "cc000027", "outputProperties": [], "x": 180, "y": 1320, "wires": [ [ "cc00002a" ] ] }, { "id": "cc00002a", "type": "function", "z": "bbf25964.5edb38", "name": "Read session cookie", "func": "msg.payload = env.get('CC_SESSION');\nflow.set('cc_session_cookie', msg.payload);\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 400, "y": 1320, "wires": [ [ "cc00002b" ] ] }, { "id": "cc00002b", "type": "function", "z": "bbf25964.5edb38", "name": "Build auth request", "func": "const sessionCookie = msg.payload;\nif (!sessionCookie || sessionCookie === '') {\n node.error('CC_SESSION env var is empty — set it in Node-RED Coffee-mations tab settings');\n return null;\n}\nmsg.url = 'https://account.coffeecircle.com/oauth/token';\nmsg.method = 'GET';\nmsg.headers = { 'Cookie': '_shopify_essential=' + sessionCookie };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 640, "y": 1320, "wires": [ [ "cc00002c" ] ] }, { "id": "cc00002c", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /oauth/token", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 880, "y": 1320, "wires": [ [ "cc00002d" ] ] }, { "id": "cc00002d", "type": "function", "z": "bbf25964.5edb38", "name": "Extract token + charges URL", "func": "const resp = msg.payload;\nconst token = resp?.access_token || resp?.token || resp?.bearer_token || resp?.accessToken || resp?.id_token;\nif (!token) {\n node.error('/oauth/token response: ' + JSON.stringify(resp));\n return null;\n}\nflow.set('cc_token', token);\nconst today = new Date().toISOString().split('T')[0];\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges?status=queued,error,skipped&scheduledAtMin=' + today;\nmsg.method = 'GET';\nmsg.headers = { 'Authorization': 'Bearer ' + token };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1140, "y": 1320, "wires": [ [ "cc00002e" ] ] }, { "id": "cc00002e", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /charges", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1360, "y": 1320, "wires": [ [ "cc00002f" ] ] }, { "id": "cc00002f", "type": "function", "z": "bbf25964.5edb38", "name": "Extract charge_id + build reschedule", "func": "const resp = msg.payload;\nconst charges = resp?.charges || resp?.data || resp?.items || resp?.results || (Array.isArray(resp) ? resp : null);\nif (!charges || charges.length === 0) {\n node.error('No queued charges for Postpone');\n return null;\n}\nconst charge = charges[0];\nconst chargeId = charge?.id || charge?.charge_id;\nif (!chargeId) {\n node.error('Cannot extract charge ID. Keys: ' + Object.keys(charge || {}).join(', '));\n return null;\n}\nflow.set('cc_charge_id', String(chargeId));\n// Read delivery date from HA state cache\nconst states = global.get('homeassistant')?.homeAssistantLatest?.states;\nconst dateStr = states?.['sensor.cc_next_delivery_date']?.state || flow.get('cc_delivery_date');\nif (!dateStr || dateStr === 'unknown' || dateStr === 'unavailable') {\n node.error('Cannot read current delivery date from HA state: ' + dateStr);\n return null;\n}\nconst d = new Date(dateStr);\nd.setDate(d.getDate() + 7);\nconst newDate = d.toISOString().split('T')[0];\nconst token = flow.get('cc_token');\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges/' + chargeId + '/reschedule';\nmsg.method = 'PUT';\nmsg.headers = { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' };\nmsg.payload = { scheduledAt: newDate };\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1620, "y": 1320, "wires": [ [ "cc000030" ] ] }, { "id": "cc000030", "type": "http request", "z": "bbf25964.5edb38", "name": "PUT /reschedule", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1880, "y": 1320, "wires": [ [ "cc000031" ] ] }, { "id": "cc000031", "type": "function", "z": "bbf25964.5edb38", "name": "Check reschedule result", "func": "const statusCode = msg.statusCode;\nif (statusCode >= 200 && statusCode < 300) {\n return [msg, null, null];\n}\nif (statusCode === 401 && !msg._retried) {\n msg._retried = true;\n msg.payload = flow.get('cc_session_cookie');\n return [null, msg, null];\n}\nconst detail = JSON.stringify(msg.payload).substring(0, 200);\nmsg.payload = JSON.stringify({\n title: 'Coffee Circle Postpone Failed',\n message: 'HTTP ' + statusCode + ': ' + detail,\n notification_id: 'cc_postpone_error'\n});\nreturn [null, null, msg];", "outputs": 3, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2100, "y": 1320, "wires": [ [ "cc000032" ], [ "cc00002b" ], [ "cc000033" ] ] }, { "id": "cc000032", "type": "link out", "z": "bbf25964.5edb38", "name": "Trigger CC Fetch", "mode": "link", "links": [ "cc000003" ], "x": 2320, "y": 1300, "wires": [] }, { "id": "cc000033", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Notify postpone error", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "areaId": [], "deviceId": [], "entityId": [], "data": "{{{payload}}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "domain": "persistent_notification", "service": "create", "x": 2340, "y": 1360, "wires": [ [] ] }, { "id": "cc00000d", "type": "ha-sensor", "z": "bbf25964.5edb38", "name": "cc_next_delivery_product", "entityConfig": "cc000024", "version": 1, "state": "payload", "stateType": "msg", "attributes": [], "inputOverride": "allow", "outputProperties": [], "x": 2340, "y": 720, "wires": [ [] ] }, { "id": "ecee1bee9953f98a", "type": "ha-get-entities", "z": "a320f821a7cb3f55", "name": "Low Bat Sensors", "server": "657c7463.48e1e4", "version": 1, "rules": [ { "property": "entity_id", "logic": "is", "value": ".*low_bat.*", "valueType": "re" }, { "property": "attributes.battery", "logic": "is_not", "value": "High", "valueType": "str" } ], "outputType": "array", "outputEmptyResults": false, "outputLocationType": "msg", "outputLocation": "payload", "outputResultsCount": 1, "x": 550, "y": 180, "wires": [ [ "5f8552a4635072aa" ] ] }, { "id": "1b30535ba22c4655", "type": "inject", "z": "a320f821a7cb3f55", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 160, "y": 240, "wires": [ [ "293113adda48f9d0" ] ] }, { "id": "b9891a936c8fb9d0", "type": "debug", "z": "a320f821a7cb3f55", "name": "debug 3", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1040, "y": 540, "wires": [] }, { "id": "556cc66d606c190e", "type": "ha-get-entities", "z": "a320f821a7cb3f55", "name": "Battery Sensors - Low", "server": "657c7463.48e1e4", "version": 1, "rules": [ { "property": "entity_id", "logic": "is", "value": ".*battery.*", "valueType": "re" }, { "property": "attributes.state_class", "logic": "is", "value": "measurement", "valueType": "str" }, { "property": "state", "logic": "lt", "value": "10", "valueType": "num" } ], "outputType": "array", "outputEmptyResults": false, "outputLocationType": "msg", "outputLocation": "payload", "outputResultsCount": 1, "x": 560, "y": 300, "wires": [ [ "5f8552a4635072aa" ] ] }, { "id": "1e34ff50a693e724", "type": "ha-get-entities", "z": "a320f821a7cb3f55", "name": "Battery Sensors", "server": "657c7463.48e1e4", "version": 1, "rules": [ { "property": "entity_id", "logic": "is", "value": ".*battery.*", "valueType": "re" } ], "outputType": "array", "outputEmptyResults": false, "outputLocationType": "msg", "outputLocation": "payload", "outputResultsCount": 1, "x": 540, "y": 540, "wires": [ [ "b9891a936c8fb9d0" ] ] }, { "id": "89a7c77a676b858b", "type": "ha-get-entities", "z": "a320f821a7cb3f55", "name": "Battery Sensors - Unavailable", "server": "657c7463.48e1e4", "version": 1, "rules": [ { "property": "entity_id", "logic": "is", "value": ".*battery.*", "valueType": "re" }, { "property": "attributes.state_class", "logic": "is", "value": "measurement", "valueType": "str" }, { "property": "state", "logic": "is", "value": "unavailable", "valueType": "str" } ], "outputType": "array", "outputEmptyResults": false, "outputLocationType": "msg", "outputLocation": "payload", "outputResultsCount": 1, "x": 590, "y": 420, "wires": [ [] ] }, { "id": "91f002d04003ce84", "type": "comment", "z": "a320f821a7cb3f55", "name": "Filter for all *battery* entities", "info": "", "x": 580, "y": 500, "wires": [] }, { "id": "ac0b28356c7eb45a", "type": "comment", "z": "a320f821a7cb3f55", "name": "HomeMatic Devices", "info": "", "x": 550, "y": 140, "wires": [] }, { "id": "a8192e1fcbdc41aa", "type": "comment", "z": "a320f821a7cb3f55", "name": "Hue devices", "info": "", "x": 530, "y": 260, "wires": [] }, { "id": "6beef06f4f0b788d", "type": "comment", "z": "a320f821a7cb3f55", "name": "Any unavailable device", "info": "", "x": 560, "y": 380, "wires": [] }, { "id": "5f8552a4635072aa", "type": "split", "z": "a320f821a7cb3f55", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 850, "y": 300, "wires": [ [ "9dcd82782246d4e9" ] ] }, { "id": "cc33a58286775199", "type": "api-call-service", "z": "a320f821a7cb3f55", "name": "Notify via HA", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "notify.gotify_ha", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"title\":\"warning\",\"message\":\"{{{payload}}}\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "notify", "service": "gotify_ha", "output_location": "", "output_location_type": "none", "x": 1270, "y": 300, "wires": [ [] ] }, { "id": "9dcd82782246d4e9", "type": "template", "z": "a320f821a7cb3f55", "name": "", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "Battery level low for {{payload.attributes.friendly_name}} ({{payload.state}}%)", "output": "str", "x": 1060, "y": 300, "wires": [ [ "cc33a58286775199" ] ] }, { "id": "293113adda48f9d0", "type": "schedex", "z": "a320f821a7cb3f55", "name": "Saturday at 11:00", "passthroughunhandled": true, "suspended": false, "lat": "", "lon": "", "ontime": "11:00", "ontopic": "", "onpayload": "", "onoffset": 0, "onrandomoffset": 0, "offtime": "", "offtopic": "", "offpayload": "", "offoffset": 0, "offrandomoffset": 0, "mon": false, "tue": false, "wed": false, "thu": false, "fri": true, "sat": true, "sun": false, "x": 190, "y": 300, "wires": [ [ "ecee1bee9953f98a", "556cc66d606c190e", "89a7c77a676b858b" ] ] }, { "id": "edaf40fcc105703a", "type": "comment", "z": "a320f821a7cb3f55", "name": "Battery state alerts for all devices", "info": "", "x": 170, "y": 140, "wires": [] }, { "id": "e4eda627074a2cf3", "type": "comment", "z": "a320f821a7cb3f55", "name": "Unavailable devices alert", "info": "Any devices that becomes unavailable in Home Assistant will be reported. This might indicate zigbee connecticity issues.", "x": 150, "y": 620, "wires": [] }, { "id": "a2a4917908eed983", "type": "trigger-state", "z": "a320f821a7cb3f55", "d": true, "name": "", "server": "657c7463.48e1e4", "version": 5, "inputs": 0, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [], "substring": [], "regex": [ ".*" ] }, "debugEnabled": false, "constraints": [ { "targetType": "this_entity", "targetValue": "", "propertyType": "current_state", "propertyValue": "new_state.state", "comparatorType": "is", "comparatorValueDatatype": "str", "comparatorValue": "unavailable" } ], "customOutputs": [], "outputInitially": false, "stateType": "str", "enableInput": false, "x": 120, "y": 680, "wires": [ [ "deb32f94b6f9aad7" ], [] ] }, { "id": "deb32f94b6f9aad7", "type": "debug", "z": "a320f821a7cb3f55", "name": "State changed debug", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 500, "y": 680, "wires": [] }, { "id": "comment-heos-individual", "type": "comment", "z": "a320f821a7cb3f55", "name": "HEOS individual speaker reset via TCP", "info": "", "x": 200, "y": 760, "wires": [] }, { "id": "comment-heos-all", "type": "comment", "z": "a320f821a7cb3f55", "name": "HEOS reset all speakers sequentially", "info": "", "x": 200, "y": 1120, "wires": [] }, { "id": "heos-trigger-bedroom", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset Speaker Bedroom", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.reset_speaker_bedroom" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" }, { "property": "speaker", "propertyType": "msg", "value": "Bedroom", "valueType": "str" }, { "property": "ip", "propertyType": "msg", "value": "192.168.1.XXX", "valueType": "str" } ], "x": 160, "y": 800, "wires": [ [ "heos-change-target" ] ] }, { "id": "heos-trigger-kitchen", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset Speaker Kitchen", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.reset_speaker_kitchen" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" }, { "property": "speaker", "propertyType": "msg", "value": "Kitchen", "valueType": "str" }, { "property": "ip", "propertyType": "msg", "value": "192.168.1.XXX", "valueType": "str" } ], "x": 160, "y": 880, "wires": [ [ "heos-change-target" ] ] }, { "id": "heos-trigger-bathroom", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset Speaker Bathroom", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.reset_speaker_bathroom" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" }, { "property": "speaker", "propertyType": "msg", "value": "Bathroom", "valueType": "str" }, { "property": "ip", "propertyType": "msg", "value": "192.168.1.XXX", "valueType": "str" } ], "x": 160, "y": 960, "wires": [ [ "heos-change-target" ] ] }, { "id": "heos-trigger-hometheater", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset Speaker Home Theater", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.reset_speaker_home_theater" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" }, { "property": "speaker", "propertyType": "msg", "value": "Home Theater", "valueType": "str" }, { "property": "ip", "propertyType": "msg", "value": "192.168.1.XXX", "valueType": "str" } ], "x": 160, "y": 1040, "wires": [ [ "heos-change-target" ] ] }, { "id": "heos-change-target", "type": "change", "z": "a320f821a7cb3f55", "name": "Set speaker target", "rules": [ { "t": "set", "p": "host", "pt": "msg", "to": "ip", "tot": "msg" }, { "t": "set", "p": "port", "pt": "msg", "to": "1255", "tot": "num" }, { "t": "set", "p": "payload", "pt": "msg", "to": "heos://system/reboot\r\n", "tot": "str" }, { "t": "set", "p": "topic", "pt": "msg", "to": "\"Reboot \" & msg.speaker & \" @ \" & msg.ip & \":1255\"", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 410, "y": 920, "wires": [ [ "heos-tcp", "heos-debug" ] ] }, { "id": "heos-tcp", "type": "tcp request", "z": "a320f821a7cb3f55", "name": "Telnet HEOS", "server": "", "port": "", "out": "immed", "ret": "string", "splitc": "0", "newline": "", "trim": false, "tls": "", "x": 620, "y": 880, "wires": [ [] ] }, { "id": "heos-debug", "type": "debug", "z": "a320f821a7cb3f55", "name": "HEOS command (debug)", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 620, "y": 960, "wires": [] }, { "id": "heos-trigger-all", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset All Speakers", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.reset_all_speakers" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 160, "y": 1160, "wires": [ [ "heos-emit-all" ] ] }, { "id": "heos-emit-all", "type": "function", "z": "a320f821a7cb3f55", "name": "Emit 4 button presses", "func": "const buttons = [\n \"input_button.reset_speaker_bedroom\",\n \"input_button.reset_speaker_kitchen\",\n \"input_button.reset_speaker_bathroom\",\n \"input_button.reset_speaker_home_theater\"\n];\nreturn [buttons.map(b => ({ ...msg, payload: b }))];", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 380, "y": 1160, "wires": [ [ "heos-delay-all" ] ] }, { "id": "heos-delay-all", "type": "delay", "z": "a320f821a7cb3f55", "name": "5s between resets", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 580, "y": 1160, "wires": [ [ "heos-service-press" ] ] }, { "id": "heos-service-press", "type": "api-call-service", "z": "a320f821a7cb3f55", "name": "Press speaker reset button", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_button.press", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"entity_id\": payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "input_button", "service": "press", "x": 780, "y": 1160, "wires": [ [] ] }, { "id": "tst0000000000001", "type": "comment", "z": "752771ce8fd82a19", "name": "Livingroom tapdial - proportional dimming (Option B)", "info": "Triggers on brightness_step_up/down (legacy action) which carries action_step_size in the same MQTT publish. Scales brightness by step_size/3 for proportional feel.", "x": 200, "y": 40, "wires": [] }, { "id": "tst0000000000002", "type": "server-state-changed", "z": "752771ce8fd82a19", "name": "Hue - Living room tapdial", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.livingroom_tapdial_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "dial_motion", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "dial_step_size", "propertyType": "msg", "value": "string", "valueType": "entityState" } ], "x": 160, "y": 100, "wires": [ [ "tst0000000000003" ] ] }, { "id": "tst0000000000003", "type": "switch", "z": "752771ce8fd82a19", "name": "Filter: brightness step", "property": "dial_motion", "propertyType": "msg", "rules": [ { "t": "eq", "v": "brightness_step_up", "vt": "str" }, { "t": "eq", "v": "brightness_step_down", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 420, "y": 100, "wires": [ [ "tst0000000000004" ], [ "tst0000000000004" ] ] }, { "id": "tst0000000000004", "type": "api-current-state", "z": "752771ce8fd82a19", "name": "Music control on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.livingroom_music_control", "state_type": "str", "blockInputOverrides": true, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 680, "y": 100, "wires": [ [ "tst0000000000005" ], [ "tst0000000000009" ] ] }, { "id": "tst0000000000005", "type": "api-current-state", "z": "752771ce8fd82a19", "name": "Get current volume", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "playing", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "media_player.home_theater_universal", "state_type": "str", "blockInputOverrides": true, "outputProperties": [ { "property": "entity", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 940, "y": 60, "wires": [ [ "tst0000000000006" ], [] ] }, { "id": "tst0000000000006", "type": "change", "z": "752771ce8fd82a19", "name": "Store current volume", "rules": [ { "t": "set", "p": "current_volume", "pt": "msg", "to": "entity.attributes.volume_level", "tot": "msg" }, { "t": "delete", "p": "entity", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1200, "y": 60, "wires": [ [ "tst0000000000007" ] ] }, { "id": "tst0000000000007", "type": "function", "z": "752771ce8fd82a19", "name": "Calculate new volume", "func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst stepSize = Number(msg.dial_step_size) || 30;\nconst modifier = Math.round(stepSize / 3) / 255 * 0.2;\nconst raw = (msg.current_volume || 0) + direction * modifier;\nmsg.payload = Math.round(Math.max(0, Math.min(1, raw)) * 100) / 100;\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1460, "y": 60, "wires": [ [ "tst0000000000008" ] ] }, { "id": "tst0000000000008", "type": "api-call-service", "z": "752771ce8fd82a19", "name": "Set Volume", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "media_player.volume_set", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.home_theater_universal" ], "labelId": [], "data": "{\"volume_level\": {{{ payload }}} }", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_set", "x": 1710, "y": 60, "wires": [ [] ] }, { "id": "tst0000000000009", "type": "function", "z": "752771ce8fd82a19", "name": "Calculate brightness step", "func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst stepSize = Number(msg.dial_step_size) || 30;\nmsg.service_payload = {\n brightness_step: direction * Math.round(stepSize / 3),\n transition: 0.1\n};\nflow.set('latestServicePayload', msg.service_payload);\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 940, "y": 160, "wires": [ [ "tst000000000000e", "tst000000000000a" ] ] }, { "id": "tst000000000000e", "type": "debug", "z": "752771ce8fd82a19", "name": "Step debug", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 940, "y": 240, "wires": [] }, { "id": "tst000000000000a", "type": "function", "z": "752771ce8fd82a19", "name": "Compute & fan out brightness", "func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst rawStep = Number(msg.dial_step_size) || 30;\nconst step = direction * rawStep;\n\nconst lights = [\n 'light.living_room_bookshelf',\n 'light.living_room_main',\n 'light.living_room_top_of_bar',\n 'light.living_room_dining_table'\n];\n\nconst haStates = global.get('homeassistant')?.homeAssistantLatest?.states || {};\n\nconst now = Date.now();\nif (now - (flow.get('lastDial') || 0) > 10 * 60 * 1000) {\n lights.forEach(id => flow.set('brt_' + id.replace(/[^a-z0-9]/g, '_'), null));\n}\nflow.set('lastDial', now);\n\nreturn lights.map(id => {\n if (haStates[id]?.state !== 'on') return null;\n const key = 'brt_' + id.replace(/[^a-z0-9]/g, '_');\n let brt = flow.get(key);\n if (brt == null) brt = haStates[id]?.attributes?.brightness || 128;\n brt = Math.max(1, Math.min(255, brt + step));\n flow.set(key, brt);\n return { brightness: Math.round(brt) };\n});", "outputs": 4, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1230, "y": 160, "wires": [ [ "tst000000000000d" ], [ "dim_main_001" ], [ "dim_bar_001" ], [ "dim_dining_001" ] ] }, { "id": "tst000000000000d", "type": "api-call-service", "z": "752771ce8fd82a19", "name": "Dim bookshelf", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_bookshelf" ], "labelId": [], "data": "{\"brightness\": {{{brightness}}}, \"transition\": 0.3}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": true, "domain": "light", "service": "turn_on", "x": 2240, "y": 160, "wires": [ [] ] }, { "id": "dim_main_001", "type": "api-call-service", "z": "752771ce8fd82a19", "name": "Dim ceiling (main)", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_main" ], "labelId": [], "data": "{\"brightness\": {{{brightness}}}, \"transition\": 0.3}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": true, "domain": "light", "service": "turn_on", "x": 2240, "y": 220, "wires": [ [] ] }, { "id": "dim_bar_001", "type": "api-call-service", "z": "752771ce8fd82a19", "name": "Dim top of bar", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_top_of_bar" ], "labelId": [], "data": "{\"brightness\": {{{brightness}}}, \"transition\": 0.3}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": true, "domain": "light", "service": "turn_on", "x": 2240, "y": 280, "wires": [ [] ] }, { "id": "dim_dining_001", "type": "api-call-service", "z": "752771ce8fd82a19", "name": "Dim dining table", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_dining_table" ], "labelId": [], "data": "{\"brightness\": {{{brightness}}}, \"transition\": 0.3}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": true, "domain": "light", "service": "turn_on", "x": 2240, "y": 340, "wires": [ [] ] }, { "id": "d46b0ef0ec904159", "type": "server-state-changed", "z": "97e0f1338e182d76", "d": true, "name": "Bedroom Radiator Boost", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.bedroom_radiator_boost" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 140, "wires": [ [ "c89bd8a3d1ef10f3" ] ] }, { "id": "2c98b3b74558eb20", "type": "comment", "z": "97e0f1338e182d76", "name": "Radiator boost functionality", "info": "", "x": 150, "y": 100, "wires": [] }, { "id": "c89bd8a3d1ef10f3", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Turn on boost mode", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "climate.set_preset_mode", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "climate.radiator_bedroom" ], "labelId": [], "data": "{\"preset_mode\":\"boost\"}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "climate", "service": "set_preset_mode", "x": 520, "y": 140, "wires": [ [] ] }, { "id": "38a218bd9af588e7", "type": "comment", "z": "97e0f1338e182d76", "name": "UI Scene Selector", "info": "", "x": 130, "y": 320, "wires": [] }, { "id": "1a65eaabb03a7bf9", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Bedroom Scene Selector", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_select.bedroom_scene_selector" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 360, "wires": [ [ "8b4608485751c75e" ] ] }, { "id": "f58c59e082e101ed", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Turn on Scene", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "scene.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "{{ entity_id }}" ], "labelId": [], "data": "{\"transition\":0.5}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "scene", "service": "turn_on", "x": 940, "y": 360, "wires": [ [] ] }, { "id": "e11131ed218f47ab", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Bedroom Shift Scene Button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.bedroom_shift_scene" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 160, "y": 580, "wires": [ [ "77ec438ec87c0861" ] ] }, { "id": "4fcc252c63d82516", "type": "comment", "z": "97e0f1338e182d76", "name": "Scene Shifter, updates UI Scene Selector", "info": "", "x": 200, "y": 440, "wires": [] }, { "id": "77ec438ec87c0861", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Trigger next scene in shifter", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_next", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.bedroom_scene_shifter" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_next", "x": 520, "y": 580, "wires": [ [] ] }, { "id": "35e1934d67c2f753", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Bedroom Scene Shifter", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_select.bedroom_scene_shifter" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 140, "y": 480, "wires": [ [ "e2137d25f8265819" ] ] }, { "id": "e2137d25f8265819", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Update scene in selector", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.bedroom_scene_selector" ], "labelId": [], "data": "{\"option\": msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "x": 510, "y": 480, "wires": [ [] ] }, { "id": "709ee4ecb3d9d6e5", "type": "subflow:52430f5e9f9ee267", "z": "97e0f1338e182d76", "name": "", "x": 870, "y": 940, "wires": [ [ "f279d0b1fbbf9cb4" ], [ "3c152ba239c25d77" ], [ "89faa874997406a2" ], [ "4538f8e1ad5c1e46" ], [ "0b63dda19923a6c5" ], [ "7e5573df8317e57f" ] ] }, { "id": "bca2e47c3d26e6a1", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Bedroom time-based turn on", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.bedroom_time_based_turn_on" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "milliseconds", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 160, "y": 760, "wires": [ [ "4f74cdc66a002911" ] ] }, { "id": "f279d0b1fbbf9cb4", "type": "change", "z": "97e0f1338e182d76", "name": "morning - Energize", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Energize", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1190, "y": 860, "wires": [ [ "d84b127597627c5f" ] ] }, { "id": "3c152ba239c25d77", "type": "change", "z": "97e0f1338e182d76", "name": "midday - Concentrate", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Concentrate", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1200, "y": 900, "wires": [ [ "d84b127597627c5f" ] ] }, { "id": "89faa874997406a2", "type": "change", "z": "97e0f1338e182d76", "name": "late afternoon - Read", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Read", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1200, "y": 940, "wires": [ [ "d84b127597627c5f" ] ] }, { "id": "4538f8e1ad5c1e46", "type": "change", "z": "97e0f1338e182d76", "name": "evening - Relax", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Relax", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1180, "y": 980, "wires": [ [ "d84b127597627c5f" ] ] }, { "id": "0b63dda19923a6c5", "type": "change", "z": "97e0f1338e182d76", "name": "late evening - Rest", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Rest", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1190, "y": 1020, "wires": [ [ "d84b127597627c5f" ] ] }, { "id": "7e5573df8317e57f", "type": "change", "z": "97e0f1338e182d76", "name": "night - Nightlight", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Nightlight", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1180, "y": 1060, "wires": [ [ "d84b127597627c5f" ] ] }, { "id": "4f74cdc66a002911", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Bedroom lights on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.bedroom", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 490, "y": 760, "wires": [ [ "362048030b8dff62", "c1af1a7dd6935bf8" ], [ "709ee4ecb3d9d6e5" ] ] }, { "id": "176597d96d6e3645", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Trigger specific scene in shifter", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.bedroom_scene_shifter" ], "labelId": [], "data": "{\"option\":msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [ { "property": "results", "propertyType": "msg", "value": "", "valueType": "results" } ], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "x": 2050, "y": 940, "wires": [ [] ] }, { "id": "4b1045ce3c6e6ab6", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Trigger next scene in shifter", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_next", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.bedroom_scene_shifter" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_next", "x": 1680, "y": 680, "wires": [ [] ] }, { "id": "362048030b8dff62", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Get UI scene selector state", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_select.bedroom_scene_selector", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "bedroom_scene", "valueType": "str" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 800, "y": 660, "wires": [ [ "432318d906637048" ] ] }, { "id": "c1af1a7dd6935bf8", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Get scene shifter state", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_select.bedroom_scene_shifter", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "bedroom_scene_shifter", "valueType": "str" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 780, "y": 700, "wires": [ [ "432318d906637048" ] ] }, { "id": "432318d906637048", "type": "join", "z": "97e0f1338e182d76", "name": "Collect all items", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "2", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 1090, "y": 660, "wires": [ [ "cd8ac9cbde46bf84" ] ] }, { "id": "cd8ac9cbde46bf84", "type": "switch", "z": "97e0f1338e182d76", "name": "Do the UI and internal scene selector (shifter) have an identical value?", "property": "payload.bedroom_scene", "propertyType": "msg", "rules": [ { "t": "eq", "v": "payload.bedroom_scene_shifter", "vt": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1250, "y": 720, "wires": [ [ "4b1045ce3c6e6ab6" ], [ "8f837b53f9ae9e07" ] ] }, { "id": "8f837b53f9ae9e07", "type": "change", "z": "97e0f1338e182d76", "name": "clear payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1630, "y": 740, "wires": [ [ "709ee4ecb3d9d6e5" ] ] }, { "id": "d84b127597627c5f", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Scene shifter already on time-based scene?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "msg.payload", "halt_if_type": "jsonata", "halt_if_compare": "is_not", "entity_id": "input_select.bedroom_scene_shifter", "state_type": "str", "blockInputOverrides": false, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 1550, "y": 940, "wires": [ [ "176597d96d6e3645" ], [ "d2de5c2d59b4614b" ] ] }, { "id": "2e7b78de395dc593", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Trigger specific scene in selector", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.bedroom_scene_selector" ], "labelId": [], "data": "{\"option\":msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [ { "property": "results", "propertyType": "msg", "value": "", "valueType": "results" } ], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "x": 2050, "y": 1000, "wires": [ [] ] }, { "id": "083380396eab878c", "type": "comment", "z": "97e0f1338e182d76", "name": "Check setting of scene shifter and call according function, as shift will update selector, but not if it already has the correct state", "info": "", "x": 1800, "y": 900, "wires": [] }, { "id": "d389eb4a4df1d94d", "type": "comment", "z": "97e0f1338e182d76", "name": "Only shift if value is identical between selects", "info": "In case the UI elements are already the same, then i want to trigger the next scene.\nIn case the UI elements are not the same, they should be synchonized.", "x": 1170, "y": 760, "wires": [] }, { "id": "8b4608485751c75e", "type": "string", "z": "97e0f1338e182d76", "name": "Parse user readable text and convert to scene entity ID", "methods": [ { "name": "slugify", "params": [] }, { "name": "replaceAll", "params": [ { "type": "str", "value": "-" }, { "type": "str", "value": "_" } ] }, { "name": "prepend", "params": [ { "type": "str", "value": "scene.bedroom_" } ] } ], "prop": "payload", "propout": "entity_id", "object": "msg", "objectout": "msg", "x": 600, "y": 360, "wires": [ [ "f58c59e082e101ed" ] ] }, { "id": "1b3e31f4b885dc8d", "type": "comment", "z": "97e0f1338e182d76", "name": "Time-based Light", "info": "", "x": 120, "y": 720, "wires": [] }, { "id": "42199407f205b1a9", "type": "comment", "z": "97e0f1338e182d76", "name": "Hidden Scene Shifter button - only for Dev UI", "info": "", "x": 210, "y": 540, "wires": [] }, { "id": "31da3053abfcc308", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Turn on/off lights bedroom", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.{{ service }}", "floorId": [], "areaId": [ "7047cdd7d50e49f980eba16f832acb57" ], "deviceId": [], "entityId": [], "labelId": [], "data": "msg.payload", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "{{ service }}", "x": 1330, "y": 1460, "wires": [ [] ] }, { "id": "7013e43814f349ad", "type": "switch", "z": "97e0f1338e182d76", "name": "On/Off check", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on_press_release", "vt": "str" }, { "t": "eq", "v": "off_press_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 410, "y": 1380, "wires": [ [ "4f74cdc66a002911" ], [ "6164ec7d06a81fe4" ] ] }, { "id": "36feb055644891c5", "type": "switch", "z": "97e0f1338e182d76", "name": "Brightness check - Up press/hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "up_press", "vt": "str" }, { "t": "eq", "v": "up_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 480, "y": 1500, "wires": [ [ "cb02468ec4dfa41b" ], [ "cb02468ec4dfa41b" ] ] }, { "id": "cb02468ec4dfa41b", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness increase (smooth)", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step\":20,\"transition\":0.8}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 830, "y": 1500, "wires": [ [ "31da3053abfcc308" ] ] }, { "id": "406db761620bc517", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness decrease (smooth)", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step\":-20,\"transition\":0.8}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 840, "y": 1540, "wires": [ [ "31da3053abfcc308" ] ] }, { "id": "6164ec7d06a81fe4", "type": "change", "z": "97e0f1338e182d76", "name": "Service: turn off", "rules": [ { "t": "set", "p": "service", "pt": "msg", "to": "turn_off", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\"transition\":0.5}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 800, "y": 1400, "wires": [ [ "31da3053abfcc308" ] ] }, { "id": "241ddf98acba2579", "type": "comment", "z": "97e0f1338e182d76", "name": "Dimmer functionality - HUE", "info": "", "x": 450, "y": 1460, "wires": [] }, { "id": "79a86fa5f578af3e", "type": "switch", "z": "97e0f1338e182d76", "name": "Brightness check - Down press/hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "down_press", "vt": "str" }, { "t": "eq", "v": "down_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 480, "y": 1540, "wires": [ [ "406db761620bc517" ], [ "406db761620bc517" ] ] }, { "id": "c28fac638bf817b4", "type": "switch", "z": "97e0f1338e182d76", "name": "On hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on_hold", "vt": "str" }, { "t": "eq", "v": "off_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 780, "y": 1260, "wires": [ [ "f279d0b1fbbf9cb4" ], [ "4538f8e1ad5c1e46" ] ] }, { "id": "c83798ac3a3167eb", "type": "comment", "z": "97e0f1338e182d76", "name": "Allow two default modes via switch", "info": "", "x": 860, "y": 1300, "wires": [] }, { "id": "a04124baa07fa11c", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Hue - Bedroom switch", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.bedroom_switch_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 160, "y": 1380, "wires": [ [ "7013e43814f349ad", "c28fac638bf817b4", "36feb055644891c5", "79a86fa5f578af3e", "b7747d69d24690b6" ] ] }, { "id": "60beffc9468624cd", "type": "comment", "z": "97e0f1338e182d76", "name": "Bedroom Lights on/off switch", "info": "", "x": 180, "y": 1340, "wires": [] }, { "id": "d2de5c2d59b4614b", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Scene selector already on time-based scene?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "msg.payload", "halt_if_type": "jsonata", "halt_if_compare": "is_not", "entity_id": "input_select.bedroom_scene_selector", "state_type": "str", "blockInputOverrides": false, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 1560, "y": 1020, "wires": [ [ "2e7b78de395dc593" ], [ "8b4608485751c75e" ] ] }, { "id": "01e9aa8d6c3c719e", "type": "server-state-changed", "z": "97e0f1338e182d76", "d": true, "name": "Hue - Bedroom switch", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.bedroom_switch_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 160, "y": 1760, "wires": [ [ "0d9343f34a28176f", "2439bd84c7eea05e", "62dbd855fe3a4b5e" ] ] }, { "id": "324a5a3309201c2a", "type": "debug", "z": "97e0f1338e182d76", "name": "debug 4", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 580, "y": 1660, "wires": [] }, { "id": "2439bd84c7eea05e", "type": "switch", "z": "97e0f1338e182d76", "name": "Brightness check - Up press/hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "up_press", "vt": "str" }, { "t": "eq", "v": "up_press_release", "vt": "str" }, { "t": "eq", "v": "up_hold", "vt": "str" }, { "t": "eq", "v": "up_hold_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 4, "x": 480, "y": 1760, "wires": [ [ "c6d79d2f6eb1b78d" ], [], [ "7b5740dd51a70762" ], [] ] }, { "id": "62dbd855fe3a4b5e", "type": "switch", "z": "97e0f1338e182d76", "name": "Brightness check - Down press/hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "down_press", "vt": "str" }, { "t": "eq", "v": "down_press_release", "vt": "str" }, { "t": "eq", "v": "down_hold", "vt": "str" }, { "t": "eq", "v": "down_hold_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 4, "x": 480, "y": 1960, "wires": [ [ "f37a1bde2003fc2c" ], [], [ "af38a9711eabea2e" ], [] ] }, { "id": "c6d79d2f6eb1b78d", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness increase by 15", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step_pct\":5}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 930, "y": 1720, "wires": [ [] ] }, { "id": "f37a1bde2003fc2c", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness decrease by 15", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step_pct\":-5}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 940, "y": 1940, "wires": [ [] ] }, { "id": "0d9343f34a28176f", "type": "switch", "z": "97e0f1338e182d76", "name": "remove empty", "property": "payload", "propertyType": "msg", "rules": [ { "t": "nempty" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 420, "y": 1660, "wires": [ [ "324a5a3309201c2a" ], [] ] }, { "id": "af38a9711eabea2e", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness decrease by 15", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step_pct\":-5}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 940, "y": 2040, "wires": [ [] ] }, { "id": "7b5740dd51a70762", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness increase by 15", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step_pct\":5}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 930, "y": 1800, "wires": [ [] ] }, { "id": "7db0a2f13624e217", "type": "change", "z": "97e0f1338e182d76", "name": "STOP", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step_pct\":5}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 870, "y": 1840, "wires": [ [] ] }, { "id": "c7d84a01ee9ccf1c", "type": "change", "z": "97e0f1338e182d76", "name": "STOP", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step_pct\":5}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 870, "y": 2080, "wires": [ [] ] }, { "id": "b7747d69d24690b6", "type": "debug", "z": "97e0f1338e182d76", "name": "debug 1", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 220, "y": 1500, "wires": [] }, { "id": "ecb0c97ae392b159", "type": "comment", "z": "b70ee13eafa73823", "name": "UI Scene Selector", "info": "", "x": 130, "y": 60, "wires": [] }, { "id": "d3a49892623d0c67", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom Scene Selector", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_select.livingroom_scene_selector" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 100, "wires": [ [ "e3ad58f3e13ded81" ] ] }, { "id": "f07c5e952b2f368b", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on Scene", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "scene.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "{{ entity_id }}" ], "labelId": [], "data": "{\"transition\":0.5}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "scene", "service": "turn_on", "x": 1640, "y": 220, "wires": [ [ "13bf72e70e9bbd73" ] ] }, { "id": "766d258dc65a274f", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom Shift Scene Button", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.livingroom_shift_scene" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 160, "y": 320, "wires": [ [ "bfaccee76249a213" ] ] }, { "id": "b0f2fedd2347176d", "type": "comment", "z": "b70ee13eafa73823", "name": "Scene Shifter, updates UI Scene Selector", "info": "", "x": 200, "y": 180, "wires": [] }, { "id": "bfaccee76249a213", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Trigger next scene in shifter", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_next", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.livingroom_scene_shifter" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_next", "x": 520, "y": 320, "wires": [ [] ] }, { "id": "38801dbb193aaf6a", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom Scene Shifter", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_select.livingroom_scene_shifter" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 220, "wires": [ [ "be4016ddfc38da17" ] ] }, { "id": "be4016ddfc38da17", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Update scene in selector", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.livingroom_scene_selector" ], "labelId": [], "data": "{\"option\": msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "x": 510, "y": 220, "wires": [ [] ] }, { "id": "ec6ae14bf7d95e92", "type": "subflow:52430f5e9f9ee267", "z": "b70ee13eafa73823", "name": "", "x": 850, "y": 600, "wires": [ [ "ecf9fefeac6dc853" ], [ "19360a877415c87d" ], [ "1efe8dde3508e5c1" ], [ "21f09eeec20cb3f6" ], [ "b4b48cde6a2830f3" ], [ "8b046197cef5a597" ] ] }, { "id": "fdd0994437d3eb49", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom time-based turn on", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.livingroom_time_based_turn_on" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "milliseconds", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 160, "y": 500, "wires": [ [ "2db649c0455c7a49" ] ] }, { "id": "ecf9fefeac6dc853", "type": "change", "z": "b70ee13eafa73823", "name": "morning - Energize", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Energize", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1150, "y": 600, "wires": [ [ "fccf425d1d70a288" ] ] }, { "id": "19360a877415c87d", "type": "change", "z": "b70ee13eafa73823", "name": "midday - Concentrate", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Concentrate", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1160, "y": 640, "wires": [ [ "fccf425d1d70a288" ] ] }, { "id": "1efe8dde3508e5c1", "type": "change", "z": "b70ee13eafa73823", "name": "late afternoon - Read", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Read", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1160, "y": 680, "wires": [ [ "fccf425d1d70a288" ] ] }, { "id": "21f09eeec20cb3f6", "type": "change", "z": "b70ee13eafa73823", "name": "evening - Relax", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Relax", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1140, "y": 720, "wires": [ [ "fccf425d1d70a288" ] ] }, { "id": "b4b48cde6a2830f3", "type": "change", "z": "b70ee13eafa73823", "name": "late evening - Rest", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Rest", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1150, "y": 760, "wires": [ [ "fccf425d1d70a288" ] ] }, { "id": "8b046197cef5a597", "type": "change", "z": "b70ee13eafa73823", "name": "night - Nightlight", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Nightlight", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1140, "y": 800, "wires": [ [ "fccf425d1d70a288" ] ] }, { "id": "2db649c0455c7a49", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Livingroom lights on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.living_room", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 500, "y": 480, "wires": [ [ "ce7a6033db2e3ffa", "0836295ca0bc0df3" ], [ "ec6ae14bf7d95e92" ] ] }, { "id": "7016650e62edb33e", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Trigger specific scene in shifter", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.livingroom_scene_shifter" ], "labelId": [], "data": "{\"option\":msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [ { "property": "results", "propertyType": "msg", "value": "", "valueType": "results" } ], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "x": 2050, "y": 680, "wires": [ [] ] }, { "id": "7ddf806038a9a543", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Trigger next scene in shifter", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_next", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.livingroom_scene_shifter" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_next", "x": 1680, "y": 420, "wires": [ [] ] }, { "id": "ce7a6033db2e3ffa", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get UI scene selector state", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_select.livingroom_scene_selector", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "selector_scene", "valueType": "str" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 800, "y": 400, "wires": [ [ "544bbcfca2ae8966" ] ] }, { "id": "0836295ca0bc0df3", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get scene shifter state", "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_select.livingroom_scene_shifter", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "topic", "propertyType": "msg", "value": "shifter_scene", "valueType": "str" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 780, "y": 440, "wires": [ [ "544bbcfca2ae8966" ] ] }, { "id": "544bbcfca2ae8966", "type": "join", "z": "b70ee13eafa73823", "name": "Collect all items", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "2", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 1090, "y": 400, "wires": [ [ "52a8d21f9e1670bc" ] ] }, { "id": "52a8d21f9e1670bc", "type": "switch", "z": "b70ee13eafa73823", "name": "Do the UI and internal scene selector (shifter) have an identical value?", "property": "payload.selector_scene", "propertyType": "msg", "rules": [ { "t": "eq", "v": "payload.shifter_scene", "vt": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1250, "y": 460, "wires": [ [ "7ddf806038a9a543" ], [ "882484a2b843b11f" ] ] }, { "id": "882484a2b843b11f", "type": "change", "z": "b70ee13eafa73823", "name": "clear payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1630, "y": 480, "wires": [ [ "ec6ae14bf7d95e92" ] ] }, { "id": "fccf425d1d70a288", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Scene shifter already on time-based scene?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "msg.payload", "halt_if_type": "jsonata", "halt_if_compare": "is_not", "entity_id": "input_select.livingroom_scene_shifter", "state_type": "str", "blockInputOverrides": false, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 1550, "y": 680, "wires": [ [ "7016650e62edb33e" ], [ "efc95cdb439dfb7f" ] ] }, { "id": "7399514dde3e0bfe", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Trigger specific scene in selector", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.livingroom_scene_selector" ], "labelId": [], "data": "{\"option\":msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [ { "property": "results", "propertyType": "msg", "value": "", "valueType": "results" } ], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "x": 2050, "y": 740, "wires": [ [] ] }, { "id": "447435b97ace1c77", "type": "comment", "z": "b70ee13eafa73823", "name": "Check setting of scene shifter and call according function, as shift will update selector, but not if it already has the correct state", "info": "", "x": 1800, "y": 640, "wires": [] }, { "id": "1f9f81e7a7920976", "type": "comment", "z": "b70ee13eafa73823", "name": "Only shift if value is identical between selects", "info": "In case the UI elements are already the same, then i want to trigger the next scene.\nIn case the UI elements are not the same, they should be synchonized.", "x": 1170, "y": 500, "wires": [] }, { "id": "e3ad58f3e13ded81", "type": "string", "z": "b70ee13eafa73823", "name": "Parse user readable text and convert to scene entity ID", "methods": [ { "name": "slugify", "params": [] }, { "name": "replaceAll", "params": [ { "type": "str", "value": "-" }, { "type": "str", "value": "_" } ] }, { "name": "prepend", "params": [ { "type": "str", "value": "scene.livingroom_" } ] }, { "name": "append", "params": [ { "type": "str", "value": "_ha" } ] } ], "prop": "payload", "propout": "entity_id", "object": "msg", "objectout": "msg", "x": 1520, "y": 100, "wires": [ [ "dining_route_001", "13bf72e70e9bbd73" ] ] }, { "id": "6a4eb8cc515c46ea", "type": "comment", "z": "b70ee13eafa73823", "name": "Time-based light scenes", "info": "", "x": 150, "y": 460, "wires": [] }, { "id": "38ce67093edaca48", "type": "comment", "z": "b70ee13eafa73823", "name": "Hidden Scene Shifter button - only for Dev UI", "info": "", "x": 210, "y": 280, "wires": [] }, { "id": "142ba7e9832fdf4c", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on/off lights livingroom", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.{{ service }}", "floorId": [], "areaId": [ "9fb80339d4ee49f098decfafad38ab78" ], "deviceId": [], "entityId": [], "labelId": [], "data": "msg.payload", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "light", "service": "{{ service }}", "x": 1340, "y": 1240, "wires": [ [] ] }, { "id": "691f50e528c73024", "type": "switch", "z": "b70ee13eafa73823", "name": "On/Off check", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "button_1_press_release", "vt": "str" }, { "t": "eq", "v": "button_3_press_release", "vt": "str" }, { "t": "eq", "v": "on_press_release", "vt": "str" }, { "t": "eq", "v": "off_press_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 4, "x": 510, "y": 1120, "wires": [ [ "2db649c0455c7a49" ], [ "e64edc58615d79d4" ], [ "2db649c0455c7a49" ], [ "e64edc58615d79d4" ] ] }, { "id": "47eeb8d0da59b457", "type": "switch", "z": "b70ee13eafa73823", "name": "Brightness check - Up ", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "brightness_step_up", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 540, "y": 1220, "wires": [ [ "3403d228e69854ed" ] ] }, { "id": "3403d228e69854ed", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness increase (smooth)", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step\":15,\"transition\":0.1}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 830, "y": 1220, "wires": [ [ "142ba7e9832fdf4c" ] ] }, { "id": "fe9ea08e5c5eb757", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness decrease (smooth)", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step\":-15,\"transition\":0.1}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 840, "y": 1260, "wires": [ [ "142ba7e9832fdf4c" ] ] }, { "id": "e64edc58615d79d4", "type": "change", "z": "b70ee13eafa73823", "name": "Service: turn off", "rules": [ { "t": "set", "p": "service", "pt": "msg", "to": "turn_off", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\"transition\":0.5}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 800, "y": 1140, "wires": [ [ "a566b47735e884f7" ] ] }, { "id": "da4e9761a84ee45b", "type": "comment", "z": "b70ee13eafa73823", "name": "Dimmer functionality - HUE", "info": "", "x": 550, "y": 1180, "wires": [] }, { "id": "5c31d80bcb840a96", "type": "switch", "z": "b70ee13eafa73823", "name": "Brightness check - Down", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "brightness_step_down", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 550, "y": 1260, "wires": [ [ "fe9ea08e5c5eb757" ] ] }, { "id": "17a110d60b7dd497", "type": "switch", "z": "b70ee13eafa73823", "name": "On hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "button_1_hold", "vt": "str" }, { "t": "eq", "v": "button_3_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 780, "y": 1000, "wires": [ [ "ecf9fefeac6dc853" ], [ "21f09eeec20cb3f6" ] ] }, { "id": "3227ee1d0ce6a8e8", "type": "comment", "z": "b70ee13eafa73823", "name": "Allow two default modes via switch", "info": "", "x": 860, "y": 1040, "wires": [] }, { "id": "28e866353c605b91", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Hue - Living room tapdial", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.livingroom_tapdial_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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": 1120, "wires": [ [ "691f50e528c73024", "17a110d60b7dd497", "2de26b31165d3632", "fc17c979505f791b" ] ] }, { "id": "85818d214c994abb", "type": "comment", "z": "b70ee13eafa73823", "name": "Livingroom tap-dial", "info": "", "x": 150, "y": 1080, "wires": [] }, { "id": "efc95cdb439dfb7f", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Scene selector already on time-based scene?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "msg.payload", "halt_if_type": "jsonata", "halt_if_compare": "is_not", "entity_id": "input_select.livingroom_scene_selector", "state_type": "str", "blockInputOverrides": false, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 1560, "y": 760, "wires": [ [ "7399514dde3e0bfe" ], [ "e3ad58f3e13ded81" ] ] }, { "id": "7de469ae61567be2", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.livingroom_tapdial_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 240, "y": 1820, "wires": [ [ "4b1badad7ce89076" ] ] }, { "id": "4b1badad7ce89076", "type": "debug", "z": "b70ee13eafa73823", "name": "debug 6", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 660, "y": 1880, "wires": [] }, { "id": "66756ac444fc22da", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.livingroom_tapdial_action_time" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 260, "y": 1940, "wires": [ [ "4b1badad7ce89076" ] ] }, { "id": "7d4e2bdc0bcf256d", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.livingroom_tapdial_action_type" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 260, "y": 1900, "wires": [ [ "4b1badad7ce89076" ] ] }, { "id": "ec9d9a53e6083bcb", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.livingroom_tapdial_action_direction" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 270, "y": 1860, "wires": [ [ "4b1badad7ce89076" ] ] }, { "id": "13bf72e70e9bbd73", "type": "debug", "z": "b70ee13eafa73823", "name": "debug 7", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1880, "y": 240, "wires": [] }, { "id": "2de26b31165d3632", "type": "switch", "z": "b70ee13eafa73823", "name": "Button 2 release & hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "button_2_press_release", "vt": "str" }, { "t": "eq", "v": "button_2_hold_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 550, "y": 1360, "wires": [ [ "dining_scene_toggle_001" ], [ "dc98aceee1133a56" ] ] }, { "id": "2b837d7d2faf1d5a", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Dining table is on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.living_room_dining_table", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "entity_id", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 810, "y": 1340, "wires": [ [ "0d22e917d1b9469d" ], [ "deab274cb333a51e" ] ] }, { "id": "28f2c687c20d4265", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on/off lights", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.{{ service }}", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "{{ entity_id }}" ], "labelId": [], "data": "msg.payload", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "{{ service }}", "x": 1340, "y": 1380, "wires": [ [] ] }, { "id": "0d22e917d1b9469d", "type": "change", "z": "b70ee13eafa73823", "name": "Service: turn off", "rules": [ { "t": "set", "p": "service", "pt": "msg", "to": "turn_off", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\"transition\":0.5}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 1360, "wires": [ [ "28f2c687c20d4265" ] ] }, { "id": "deab274cb333a51e", "type": "change", "z": "b70ee13eafa73823", "name": "Service: turn on", "rules": [ { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{\"transition\":0.5}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 1400, "wires": [ [ "28f2c687c20d4265" ] ] }, { "id": "dc98aceee1133a56", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Any non main light on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.livingroom_non_main_lights", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "entity_id", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 820, "y": 1400, "wires": [ [ "0d22e917d1b9469d" ], [ "deab274cb333a51e" ] ] }, { "id": "a566b47735e884f7", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on/off lights livingroom", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.{{ service }}", "floorId": [], "areaId": [ "9fb80339d4ee49f098decfafad38ab78" ], "deviceId": [], "entityId": [], "labelId": [], "data": "msg.payload", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "{{ service }}", "x": 1340, "y": 1160, "wires": [ [] ] }, { "id": "cfe7a52d4819733b", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "Hue - Living room tapdial", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.livingroom_tapdial_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "dial_motion", "propertyType": "msg", "value": "string", "valueType": "entityState" } ], "x": 170, "y": 2060, "wires": [ [ "99ed51ceae7915cf" ] ] }, { "id": "b46f52f581f07d43", "type": "comment", "z": "b70ee13eafa73823", "name": "Livingroom tap-dial", "info": "", "x": 150, "y": 2020, "wires": [] }, { "id": "10325d851d92b3db", "type": "comment", "z": "b70ee13eafa73823", "name": "Dimmer functionality testing - HUE", "info": "", "x": 400, "y": 2020, "wires": [] }, { "id": "2e50d893ea29f932", "type": "switch", "z": "b70ee13eafa73823", "name": "Brightness check - Up step", "property": "dial_motion", "propertyType": "msg", "rules": [ { "t": "eq", "v": "dial_rotate_right_fast", "vt": "str" }, { "t": "eq", "v": "dial_rotate_right_slow", "vt": "str" }, { "t": "eq", "v": "dial_rotate_right_step", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 3, "x": 540, "y": 2260, "wires": [ [ "f7192e46a47b653a", "4c73d1e8092387b2" ], [ "f7192e46a47b653a", "0c483b69f2455536" ], [ "f7192e46a47b653a", "0cd947d505af3e73" ] ] }, { "id": "a4ea444bb95d8993", "type": "switch", "z": "b70ee13eafa73823", "name": "Brightness check - Down step", "property": "dial_motion", "propertyType": "msg", "rules": [ { "t": "eq", "v": "dial_rotate_left_fast", "vt": "str" }, { "t": "eq", "v": "dial_rotate_left_slow", "vt": "str" }, { "t": "eq", "v": "dial_rotate_left_step", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 3, "x": 550, "y": 2320, "wires": [ [ "f7192e46a47b653a", "7391f9b1cbede747" ], [ "f7192e46a47b653a", "05fd0d70d3bd26fd" ], [ "f7192e46a47b653a", "1649296f3891a37c" ] ] }, { "id": "0cd947d505af3e73", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness increase (smooth)", "rules": [ { "t": "set", "p": "service_payload", "pt": "msg", "to": "{\"brightness_step\":15,\"transition\":0.1}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 910, "y": 2280, "wires": [ [ "0470a1771bbbe584" ] ] }, { "id": "1649296f3891a37c", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness decrease (smooth)", "rules": [ { "t": "set", "p": "service_payload", "pt": "msg", "to": "{\"brightness_step\":-15,\"transition\":0.1}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 920, "y": 2400, "wires": [ [ "0470a1771bbbe584" ] ] }, { "id": "f7192e46a47b653a", "type": "debug", "z": "b70ee13eafa73823", "name": "tapdial debug", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 880, "y": 2500, "wires": [] }, { "id": "0c483b69f2455536", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness increase (smooth)", "rules": [ { "t": "set", "p": "service_payload", "pt": "msg", "to": "{\"brightness_step\":30,\"transition\":0.1}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 910, "y": 2240, "wires": [ [ "0470a1771bbbe584" ] ] }, { "id": "4c73d1e8092387b2", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness increase (smooth)", "rules": [ { "t": "set", "p": "service_payload", "pt": "msg", "to": "{\"brightness_step\":50,\"transition\":0.1}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 910, "y": 2200, "wires": [ [ "0470a1771bbbe584" ] ] }, { "id": "7391f9b1cbede747", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness decrease (smooth)", "rules": [ { "t": "set", "p": "service_payload", "pt": "msg", "to": "{\"brightness_step\":-50,\"transition\":0.1}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 920, "y": 2320, "wires": [ [ "0470a1771bbbe584" ] ] }, { "id": "05fd0d70d3bd26fd", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness decrease (smooth)", "rules": [ { "t": "set", "p": "service_payload", "pt": "msg", "to": "{\"brightness_step\":-30,\"transition\":0.1}", "tot": "json" }, { "t": "set", "p": "service", "pt": "msg", "to": "turn_on", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 920, "y": 2360, "wires": [ [ "0470a1771bbbe584" ] ] }, { "id": "0470a1771bbbe584", "type": "ha-get-entities", "z": "b70ee13eafa73823", "name": "Find lights that are on", "server": "657c7463.48e1e4", "version": 1, "rules": [ { "property": "entity_id", "logic": "includes", "value": "light.dining_table, light.living_room_bookshelf, light.living_room_main, light.living_room_top_of_bar", "valueType": "str" }, { "property": "state", "logic": "is", "value": "on", "valueType": "str" } ], "outputType": "array", "outputEmptyResults": false, "outputLocationType": "msg", "outputLocation": "payload", "outputResultsCount": 1, "x": 1300, "y": 2300, "wires": [ [ "a28ab05bdedd5bbd" ] ] }, { "id": "dab871622d804c6b", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Dim lights that are on", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "{{ entity }}" ], "labelId": [], "data": "msg.service_payload", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 1300, "y": 2480, "wires": [ [] ] }, { "id": "07fd05ad8f6aaecb", "type": "change", "z": "b70ee13eafa73823", "name": "Find entity id of each light", "rules": [ { "t": "set", "p": "entity", "pt": "msg", "to": "payload.entity_id", "tot": "msg" }, { "t": "delete", "p": "payload", "pt": "msg" }, { "t": "delete", "p": "parts", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1310, "y": 2420, "wires": [ [ "dab871622d804c6b" ] ] }, { "id": "a28ab05bdedd5bbd", "type": "split", "z": "b70ee13eafa73823", "name": "Loop through each light", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "property": "payload", "x": 1310, "y": 2360, "wires": [ [ "07fd05ad8f6aaecb" ] ] }, { "id": "7b987dbc853e7d20", "type": "comment", "z": "b70ee13eafa73823", "name": "TODO", "info": "- Does no longer work if lights are all off\n- Filament bulbs seem to be dimmed faster than others and turn off\n- Exclude Tetris light from this magic", "x": 1250, "y": 2540, "wires": [] }, { "id": "fc17c979505f791b", "type": "switch", "z": "b70ee13eafa73823", "name": "Button 4 release & hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "button_4_press_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 550, "y": 1520, "wires": [ [ "5c2460180f910664" ] ] }, { "id": "5c2460180f910664", "type": "api-call-service", "z": "b70ee13eafa73823", "d": true, "name": "Turn on/off christmas lights", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "switch.toggle", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "switch.christmas_lights" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "switch", "service": "toggle", "x": 840, "y": 1520, "wires": [ [] ] }, { "id": "f875e3eadcb1d94f", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Hue - Living room guest switch", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.living_room_second_switch_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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": 1360, "wires": [ [ "691f50e528c73024" ] ] }, { "id": "b79dff07f1f3276c", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Hue - Living room tapdial", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.livingroom_tapdial_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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": 1560, "wires": [ [ "f4bc5fdbf9dcecfa", "57a722e2ab174bc1" ] ] }, { "id": "57a722e2ab174bc1", "type": "switch", "z": "b70ee13eafa73823", "name": "Button 4 release & hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "button_4_hold_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 550, "y": 1560, "wires": [ [ "124ea1b2096c07ec" ] ] }, { "id": "f4bc5fdbf9dcecfa", "type": "debug", "z": "b70ee13eafa73823", "name": "debug 14", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 280, "y": 1480, "wires": [] }, { "id": "124ea1b2096c07ec", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Toggle music mode", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "input_boolean.toggle", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_boolean.livingroom_music_control" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "input_boolean", "service": "toggle", "x": 810, "y": 1560, "wires": [ [] ] }, { "id": "451542926c7b1dd2", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Music Control On", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_boolean.livingroom_music_control" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 140, "y": 1660, "wires": [ [ "f71263e2817da390" ], [ "42aaf23000066a7e" ] ] }, { "id": "317a78818934e225", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Flash lights", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_dining_table", "light.living_room_main" ], "labelId": [], "data": "{\"brightness\":255,\"effect\":\"blink\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 630, "y": 1720, "wires": [ [ "203f27c455479e23" ] ] }, { "id": "f71263e2817da390", "type": "change", "z": "b70ee13eafa73823", "name": "Flash Blue", "rules": [ { "t": "set", "p": "flash_color", "pt": "msg", "to": "blue", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 410, "y": 1640, "wires": [ [ "222353ea1c063036" ] ] }, { "id": "42aaf23000066a7e", "type": "change", "z": "b70ee13eafa73823", "name": "Flash Green", "rules": [ { "t": "set", "p": "flash_color", "pt": "msg", "to": "green", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 410, "y": 1680, "wires": [ [ "222353ea1c063036" ] ] }, { "id": "222353ea1c063036", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Create tmp scene", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "scene.create", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"snapshot_entities\":[\"light.living_room_dining_table\",\"light.living_room_main\"],\"scene_id\":\"music_mode_flash_livingroom\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "scene", "service": "create", "x": 630, "y": 1660, "wires": [ [ "317a78818934e225" ] ] }, { "id": "a890dae37cb6e247", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Delete tmp scene", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "scene.delete", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"entity_id\":\"scene.music_mode_flash_livingroom\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "scene", "service": "delete", "x": 1190, "y": 1720, "wires": [ [ "22a05465f41aea40" ] ] }, { "id": "8be5c8df48382bc5", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Go back to previous scene", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "scene.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "{\"entity_id\":\"scene.music_mode_flash_livingroom\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "scene", "service": "turn_on", "x": 940, "y": 1720, "wires": [ [ "a890dae37cb6e247" ] ] }, { "id": "203f27c455479e23", "type": "delay", "z": "b70ee13eafa73823", "name": "", "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 640, "y": 1780, "wires": [ [ "8be5c8df48382bc5" ] ] }, { "id": "436ec7f029106524", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "Music Control On", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_boolean.livingroom_music_control" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 140, "y": 1740, "wires": [ [ "4c6f4a717f76aa29" ], [ "4c6f4a717f76aa29" ] ] }, { "id": "4c6f4a717f76aa29", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Flash lights", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_dining_table", "light.living_room_main" ], "labelId": [], "data": "{\"brightness\":255,\"effect\":\"blink\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 410, "y": 1740, "wires": [ [] ] }, { "id": "22a05465f41aea40", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Stop any effects", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_dining_table", "light.living_room_main" ], "labelId": [], "data": "{\"effect\":\"stop\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 900, "y": 1800, "wires": [ [] ] }, { "id": "99ed51ceae7915cf", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Music control on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.livingroom_music_control", "state_type": "str", "blockInputOverrides": true, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 190, "y": 2120, "wires": [ [ "9e1b61c654b9ee81" ], [] ] }, { "id": "179f0b0c2b86c079", "type": "switch", "z": "b70ee13eafa73823", "name": "Volume check - Up step", "property": "dial_motion", "propertyType": "msg", "rules": [ { "t": "eq", "v": "dial_rotate_right_fast", "vt": "str" }, { "t": "eq", "v": "dial_rotate_right_slow", "vt": "str" }, { "t": "eq", "v": "dial_rotate_right_step", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 3, "x": 890, "y": 2040, "wires": [ [ "cc8831b6182557d2" ], [ "0029357f750ce03c" ], [ "a3f678465cf5e81f" ] ] }, { "id": "6943ef25dc561946", "type": "switch", "z": "b70ee13eafa73823", "name": "Volume check - Down step", "property": "dial_motion", "propertyType": "msg", "rules": [ { "t": "eq", "v": "dial_rotate_left_fast", "vt": "str" }, { "t": "eq", "v": "dial_rotate_left_slow", "vt": "str" }, { "t": "eq", "v": "dial_rotate_left_step", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 3, "x": 900, "y": 2100, "wires": [ [ "d8d786fbf89d22e8" ], [ "e6bc9026eba92ef0" ], [ "c8b0a802aa7912c4" ] ] }, { "id": "6260853b954dce29", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Set Volume", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "media_player.volume_set", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.home_theater_universal" ], "labelId": [], "data": "{\"volume_level\": {{{ payload }}} }", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "media_player", "service": "volume_set", "x": 1510, "y": 2160, "wires": [ [] ] }, { "id": "9e1b61c654b9ee81", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get current volume", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "playing", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "media_player.home_theater_universal", "state_type": "str", "blockInputOverrides": true, "outputProperties": [ { "property": "entity", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 510, "y": 2120, "wires": [ [ "dbffbb3c2e701c5d" ], [] ] }, { "id": "dbffbb3c2e701c5d", "type": "change", "z": "b70ee13eafa73823", "name": "Store current volume", "rules": [ { "t": "set", "p": "current_volume", "pt": "msg", "to": "entity.attributes.volume_level", "tot": "msg" }, { "t": "delete", "p": "entity", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 520, "y": 2060, "wires": [ [ "179f0b0c2b86c079", "6943ef25dc561946" ] ] }, { "id": "cc8831b6182557d2", "type": "change", "z": "b70ee13eafa73823", "name": "0.07", "rules": [ { "t": "set", "p": "volume_modifier", "pt": "msg", "to": "0.07", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1130, "y": 1960, "wires": [ [ "3080f3a618d4368b" ] ] }, { "id": "0029357f750ce03c", "type": "change", "z": "b70ee13eafa73823", "name": "0.03", "rules": [ { "t": "set", "p": "volume_modifier", "pt": "msg", "to": "0.03", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1130, "y": 2000, "wires": [ [ "3080f3a618d4368b" ] ] }, { "id": "a3f678465cf5e81f", "type": "change", "z": "b70ee13eafa73823", "name": "0.01", "rules": [ { "t": "set", "p": "volume_modifier", "pt": "msg", "to": "0.01", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1130, "y": 2040, "wires": [ [ "3080f3a618d4368b" ] ] }, { "id": "d8d786fbf89d22e8", "type": "change", "z": "b70ee13eafa73823", "name": "-0.07", "rules": [ { "t": "set", "p": "volume_modifier", "pt": "msg", "to": "-0.07", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1130, "y": 2100, "wires": [ [ "3080f3a618d4368b" ] ] }, { "id": "e6bc9026eba92ef0", "type": "change", "z": "b70ee13eafa73823", "name": "-0.03", "rules": [ { "t": "set", "p": "volume_modifier", "pt": "msg", "to": "-0.03", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1130, "y": 2140, "wires": [ [ "3080f3a618d4368b" ] ] }, { "id": "c8b0a802aa7912c4", "type": "change", "z": "b70ee13eafa73823", "name": "-0.01", "rules": [ { "t": "set", "p": "volume_modifier", "pt": "msg", "to": "-0.01", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1130, "y": 2180, "wires": [ [ "3080f3a618d4368b" ] ] }, { "id": "7534af436f628e33", "type": "calculator", "z": "b70ee13eafa73823", "name": "Sum and ensure 2 decimals", "inputMsgField": "payload", "outputMsgField": "payload", "operation": "sum", "constant": "", "round": false, "truncate": true, "decimals": 0, "decimals2": "2", "x": 1480, "y": 2100, "wires": [ [ "6260853b954dce29" ] ] }, { "id": "3080f3a618d4368b", "type": "change", "z": "b70ee13eafa73823", "name": "Create summable array", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "[ msg.current_volume, msg.volume_modifier ]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1390, "y": 2040, "wires": [ [ "7534af436f628e33" ] ] }, { "id": "ccdac6a5471ce5d1", "type": "trigger-state", "z": "b70ee13eafa73823", "name": "Switching home theater to non heos", "server": "657c7463.48e1e4", "version": 5, "inputs": 0, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "media_player.home_theater_universal" ], "substring": [], "regex": [] }, "debugEnabled": false, "constraints": [ { "targetType": "this_entity", "targetValue": "", "propertyType": "property", "propertyValue": "new_state.attributes.source", "comparatorType": "includes", "comparatorValueDatatype": "str", "comparatorValue": "Media Player,PS4,VINYL" } ], "customOutputs": [], "outputInitially": false, "stateType": "str", "enableInput": false, "x": 220, "y": 2620, "wires": [ [ "8b41a466c57cf276" ], [ "1a1fb3664cb5cbc4" ] ] }, { "id": "8b41a466c57cf276", "type": "switch", "z": "b70ee13eafa73823", "name": "Prev source was HEOS", "property": "data.old_state.attributes.source", "propertyType": "msg", "rules": [ { "t": "eq", "v": "HEOS Music", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 570, "y": 2680, "wires": [ [ "9bf8ce152f92cc25" ], [ "d5c9055d644276d7" ] ] }, { "id": "9bf8ce152f92cc25", "type": "switch", "z": "b70ee13eafa73823", "name": "Prev state was playing", "property": "data.old_state.state", "propertyType": "msg", "rules": [ { "t": "eq", "v": "playing", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 560, "y": 2620, "wires": [ [ "8ae9c55c69b0ff6c" ], [ "d5c9055d644276d7" ] ] }, { "id": "8ae9c55c69b0ff6c", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Pause media", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.media_pause", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.bathroom", "media_player.bedroom", "media_player.kitchen" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": true, "domain": "media_player", "service": "media_pause", "x": 1170, "y": 2620, "wires": [ [] ] }, { "id": "ab3f3ef4e3ab317d", "type": "split", "z": "b70ee13eafa73823", "name": "Split array", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "property": "payload", "x": 1180, "y": 2680, "wires": [ [ "3194aebd902a20ff" ] ] }, { "id": "d5c9055d644276d7", "type": "change", "z": "b70ee13eafa73823", "name": "All media players, but livingroom", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "[\"media_player.kitchen\",\"media_player.bathroom\"]", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 950, "y": 2680, "wires": [ [ "ab3f3ef4e3ab317d" ] ] }, { "id": "76d6452c8ce8fa5c", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get current state", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "playing", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "{{payload}}", "state_type": "str", "blockInputOverrides": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 910, "y": 2740, "wires": [ [ "6754aadb473ead61" ], [] ] }, { "id": "6754aadb473ead61", "type": "change", "z": "b70ee13eafa73823", "name": "Get leader (if grouped) or self", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "(\t $members := data.attributes.group_members;\t $leader := ($members and $count($members) > 0) ? $members[0] : entity_id; \t { \"entity_id\": $leader }\t)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1160, "y": 2740, "wires": [ [ "3d1036d3fa33e2ad" ] ] }, { "id": "3d1036d3fa33e2ad", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Pause media player", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.media_pause", "floorId": [], "areaId": [], "deviceId": [], "entityId": [], "labelId": [], "data": "payload", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": true, "domain": "media_player", "service": "media_pause", "x": 920, "y": 2800, "wires": [ [] ] }, { "id": "3194aebd902a20ff", "type": "delay", "z": "b70ee13eafa73823", "name": "", "pauseType": "rate", "timeout": "500", "timeoutUnits": "milliseconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1360, "y": 2680, "wires": [ [ "76d6452c8ce8fa5c" ] ] }, { "id": "1a1fb3664cb5cbc4", "type": "debug", "z": "b70ee13eafa73823", "name": "No match", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 490, "y": 2720, "wires": [] }, { "id": "e3060a7791881147", "type": "comment", "z": "b70ee13eafa73823", "name": "TV On - pause music", "info": "", "x": 180, "y": 2580, "wires": [] }, { "id": "dc2a982e648d103b", "type": "comment", "z": "b70ee13eafa73823", "name": "Pause TV & lights", "info": "", "x": 170, "y": 2880, "wires": [] }, { "id": "394cb7ef271fc2f8", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Media Box state", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "media_player.media_box" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "0", "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" }, { "property": "reset", "propertyType": "msg", "value": "true", "valueType": "bool" } ], "x": 160, "y": 2920, "wires": [ [ "e04092e8f97898cf" ] ] }, { "id": "dc7567e498a75b12", "type": "switch", "z": "b70ee13eafa73823", "name": "Check state", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "playing", "vt": "str" }, { "t": "eq", "v": "paused", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 510, "y": 2920, "wires": [ [ "39ea254eb72f0901" ], [ "787b1101083df9bf" ] ] }, { "id": "787b1101083df9bf", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Lights in movie mode?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "Movie", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_select.livingroom_scene_selector", "state_type": "str", "blockInputOverrides": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 780, "y": 2960, "wires": [ [ "71916041b8ca3d07" ], [] ] }, { "id": "39ea254eb72f0901", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Lights in movie-pause mode?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "Movie Pause", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_select.livingroom_scene_selector", "state_type": "str", "blockInputOverrides": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 800, "y": 2900, "wires": [ [ "bb3c4a6174931a21" ], [] ] }, { "id": "7f0f0d6e3eb5f8cb", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Update scene in selector", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_select.select_option", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_select.livingroom_scene_selector" ], "labelId": [], "data": "{\"option\": msg.payload}", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "input_select", "service": "select_option", "x": 1390, "y": 2920, "wires": [ [] ] }, { "id": "bb3c4a6174931a21", "type": "change", "z": "b70ee13eafa73823", "name": "Switch to Movie mode", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Movie", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1080, "y": 2900, "wires": [ [ "7f0f0d6e3eb5f8cb" ] ] }, { "id": "71916041b8ca3d07", "type": "change", "z": "b70ee13eafa73823", "name": "Switch to Movie pause mode", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "Movie Pause", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 2940, "wires": [ [ "7f0f0d6e3eb5f8cb" ] ] }, { "id": "dfd77a76dc2e0568", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "Midday starts", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.midday_starts_ha" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "milliseconds", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 130, "y": 680, "wires": [ [ "6073e4e66bb6e228" ] ] }, { "id": "6073e4e66bb6e228", "type": "subflow:be8264a322721305", "z": "b70ee13eafa73823", "name": "", "x": 250, "y": 740, "wires": [ [ "f833288986e00ae0" ] ] }, { "id": "afa6cccb1cfc8ddb", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "Late afternoon starts", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.late_afternoon_starts_ha" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "milliseconds", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 780, "wires": [ [ "2e03442c0d67da32" ] ] }, { "id": "2e03442c0d67da32", "type": "subflow:be8264a322721305", "z": "b70ee13eafa73823", "name": "", "x": 270, "y": 840, "wires": [ [ "f833288986e00ae0" ] ] }, { "id": "097585a397ef8e60", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "Evening starts", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.evening_starts_ha" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "milliseconds", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 130, "y": 880, "wires": [ [ "67659db54987a408" ] ] }, { "id": "67659db54987a408", "type": "subflow:be8264a322721305", "z": "b70ee13eafa73823", "name": "", "x": 270, "y": 940, "wires": [ [ "f833288986e00ae0" ] ] }, { "id": "a02362b40496cf27", "type": "server-state-changed", "z": "b70ee13eafa73823", "d": true, "name": "Late evening starts", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_datetime.late_evening_starts_ha" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "milliseconds", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 980, "wires": [ [ "a2f0111dc2cad4b2" ] ] }, { "id": "a2f0111dc2cad4b2", "type": "subflow:be8264a322721305", "z": "b70ee13eafa73823", "name": "", "x": 270, "y": 1040, "wires": [ [ "f833288986e00ae0" ] ] }, { "id": "f833288986e00ae0", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Livingroom lights on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.living_room", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 500, "y": 520, "wires": [ [ "0836295ca0bc0df3", "ce7a6033db2e3ffa" ], [] ] }, { "id": "613a9be150591ee7", "type": "comment", "z": "b70ee13eafa73823", "name": "Harmony Remote Control", "info": "", "x": 190, "y": 3160, "wires": [] }, { "id": "397fc02eaed29a41", "type": "server-events", "z": "b70ee13eafa73823", "name": "Listen to roku command events", "server": "657c7463.48e1e4", "version": 3, "exposeAsEntityConfig": "", "eventType": "roku_command", "eventData": "", "waitForRunning": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "$outputData(\"eventData\").event_type", "valueType": "jsonata" } ], "x": 210, "y": 3200, "wires": [ [ "dcc93b3ba73bee14" ] ] }, { "id": "dcc93b3ba73bee14", "type": "switch", "z": "b70ee13eafa73823", "name": "Event switch", "property": "payload.event.key", "propertyType": "msg", "rules": [ { "t": "eq", "v": "Play", "vt": "str" }, { "t": "eq", "v": "Rev", "vt": "str" }, { "t": "eq", "v": "Fwd", "vt": "str" }, { "t": "eq", "v": "Select", "vt": "str" }, { "t": "eq", "v": "Home", "vt": "str" }, { "t": "eq", "v": "Left", "vt": "str" }, { "t": "eq", "v": "Right", "vt": "str" }, { "t": "eq", "v": "Down", "vt": "str" }, { "t": "eq", "v": "Up", "vt": "str" }, { "t": "eq", "v": "Back", "vt": "str" }, { "t": "eq", "v": "Info", "vt": "str" }, { "t": "eq", "v": "PowerOn", "vt": "str" }, { "t": "eq", "v": "PowerOff", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 13, "x": 490, "y": 3220, "wires": [ [], [ "0cd947d505af3e73" ], [ "1649296f3891a37c" ], [ "8fd5e325dc59160a" ], [], [ "bb3c4a6174931a21" ], [ "71916041b8ca3d07" ], [], [], [], [], [], [] ] }, { "id": "8fd5e325dc59160a", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Shift the scene", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_button.press", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_button.livingroom_shift_scene" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": true, "domain": "input_button", "service": "press", "x": 880, "y": 3200, "wires": [ [] ] }, { "id": "e04092e8f97898cf", "type": "trigger", "z": "b70ee13eafa73823", "name": "wait 1 sec", "op1": "", "op2": "", "op1type": "nul", "op2type": "pay", "duration": "1", "extend": false, "overrideDelay": false, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 340, "y": 2920, "wires": [ [ "dc7567e498a75b12" ] ] }, { "id": "ssc_motion_lr_19dda5bc955", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom Motion Sensor", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.livingroom_motion_sensor_occupancy" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 580, "wires": [ [ "ca7ee0d8f3f6d02e" ], [] ] }, { "id": "ca7ee0d8f3f6d02e", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Motion - lights already on?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.living_room", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 520, "y": 580, "wires": [ [], [ "ec6ae14bf7d95e92" ] ] }, { "id": "dining_route_001", "type": "function", "z": "b70ee13eafa73823", "name": "Swap to no-dining scene if dining table off", "func": "const states = global.get('homeassistant')?.homeAssistantLatest?.states || {};\nconst diningOn = states['light.living_room_dining_table']?.state === 'on';\nif (!diningOn) {\n msg.entity_id = msg.entity_id.replace(/_ha$/, '') + '_no_dining';\n}\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1560, "y": 160, "wires": [ [ "f07c5e952b2f368b" ] ] }, { "id": "dining_scene_toggle_001", "type": "function", "z": "b70ee13eafa73823", "name": "Dining toggle: apply scene variant", "func": "const states = global.get('homeassistant')?.homeAssistantLatest?.states || {};\nconst diningOn = states['light.living_room_dining_table']?.state === 'on';\n\nconst mainLights = [\n 'light.living_room_ceiling_1',\n 'light.living_room_ceiling_2',\n 'light.living_room_ceiling_3',\n 'light.living_room_bookshelf',\n 'light.living_room_top_of_bar'\n];\nconst sceneActive = mainLights.some(id => states[id]?.state === 'on');\n\nif (!sceneActive) {\n return diningOn ? [null, { ...msg }, null] : [null, null, { ...msg }];\n}\n\nconst selectorName = states['input_select.livingroom_scene_selector']?.state || '';\nconst slug = selectorName.toLowerCase()\n .replace(/[^a-z0-9 ]/g, '')\n .trim()\n .replace(/ +/g, '_');\n\nconst sceneId = diningOn\n ? 'scene.livingroom_' + slug + '_no_dining'\n : 'scene.livingroom_' + slug + '_ha';\n\nreturn [{ ...msg, entity_id: sceneId }, diningOn ? { ...msg } : null, null];", "outputs": 3, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1060, "y": 1340, "wires": [ [ "dining_scene_apply_001" ], [ "dining_light_off_001" ], [ "dining_light_on_001" ] ] }, { "id": "dining_scene_apply_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Apply scene variant", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "scene.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "{{ entity_id }}" ], "labelId": [], "data": "{\"transition\":0.5}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "scene", "service": "turn_on", "x": 1300, "y": 1300, "wires": [ [] ] }, { "id": "dining_light_off_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn off dining lamp", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_dining_table" ], "labelId": [], "data": "{\"transition\":0.5}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "light", "service": "turn_off", "x": 1300, "y": 1380, "wires": [ [] ] }, { "id": "dining_light_on_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on dining lamp", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room_dining_table" ], "labelId": [], "data": "{\"transition\":0.5}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 1300, "y": 1460, "wires": [ [] ] }, { "id": "970f66c027cf1bda", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "Kitchen smart switch", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.kitchen_switch_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 100, "wires": [ [ "d5ae93765e66efa4", "099d186859d09206", "3ffbb3073f04796e", "bf062f43abe3400c", "86f4b8eb539e8b4f" ] ] }, { "id": "d5ae93765e66efa4", "type": "switch", "z": "5af82cd4c44df066", "name": "On/Off check", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on_press_release", "vt": "str" }, { "t": "eq", "v": "off_press_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 410, "y": 100, "wires": [ [ "28725aa2f0bc83ef" ], [ "102d2d6180407101" ] ] }, { "id": "deae916e70685ff1", "type": "comment", "z": "5af82cd4c44df066", "name": "Kitchen Lights on/off switch", "info": "", "x": 190, "y": 60, "wires": [] }, { "id": "099d186859d09206", "type": "switch", "z": "5af82cd4c44df066", "name": "Brightness check - Up press/hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "up_press", "vt": "str" }, { "t": "eq", "v": "up_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 480, "y": 340, "wires": [ [ "7c14d1f3a819183d" ], [ "7c14d1f3a819183d" ] ] }, { "id": "6289202be36f95a6", "type": "api-call-service", "z": "5af82cd4c44df066", "name": "Turn on lights kitchen", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [ "58b6232129db4aa396355dcff5edc036" ], "deviceId": [], "entityId": [], "labelId": [], "data": "{{{payload}}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 1580, "y": 200, "wires": [ [ "86f4b8eb539e8b4f" ] ] }, { "id": "7c14d1f3a819183d", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness increase (smooth)", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step\":15,\"transition\":0.8}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1170, "y": 340, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "044378dc99eb8bf0", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness decrease (smooth)", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step\":-15,\"transition\":0.8}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1160, "y": 380, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "102d2d6180407101", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 0 (turn off)", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness\":0}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1170, "y": 160, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "39aba0a7d9f18c40", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 20%", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":20}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1190, "y": 120, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "4584b1c0133c143c", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 100%", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":100}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1190, "y": 40, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "72521808adb6aa7f", "type": "comment", "z": "5af82cd4c44df066", "name": "Dimmer functionality - HUE", "info": "", "x": 450, "y": 300, "wires": [] }, { "id": "3ffbb3073f04796e", "type": "switch", "z": "5af82cd4c44df066", "name": "Brightness check - Down press/hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "down_press", "vt": "str" }, { "t": "eq", "v": "down_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 480, "y": 380, "wires": [ [ "044378dc99eb8bf0" ], [ "044378dc99eb8bf0" ] ] }, { "id": "bf062f43abe3400c", "type": "switch", "z": "5af82cd4c44df066", "name": "On hold", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on_hold", "vt": "str" }, { "t": "eq", "v": "off_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 400, "y": 240, "wires": [ [ "e6992acd908b4480" ], [ "07208f4cb940887d" ] ] }, { "id": "e6992acd908b4480", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 100% and energize profile", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness\":255,\"profile\":\"energize\"}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1120, "y": 240, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "0f7bdb44f2ca1db8", "type": "comment", "z": "5af82cd4c44df066", "name": "Reset to energize mode (default color hue)", "info": "", "x": 500, "y": 200, "wires": [] }, { "id": "23aa3bbdf2a47c04", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 0 (turn off)", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness\":0}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1170, "y": 500, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "893c90eae1394985", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 100%", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":100}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1190, "y": 600, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "39f60aff80425ab8", "type": "comment", "z": "5af82cd4c44df066", "name": "Kitchen motion sensor", "info": "", "x": 180, "y": 460, "wires": [] }, { "id": "07208f4cb940887d", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 20% and energize profile", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":20,\"profile\":\"relax\"}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1130, "y": 280, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "72fce694d3455880", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 65%", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":65}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1190, "y": 80, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "86f4b8eb539e8b4f", "type": "debug", "z": "5af82cd4c44df066", "name": "Kitchen Debug", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1580, "y": 300, "wires": [] }, { "id": "38192b587d9b9f39", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "Kitchen motion sensor", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.kitchen_motion_sensor_occupancy" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "off", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 180, "y": 500, "wires": [ [ "b5a33742cf8ae14a", "eb433762a15ff684" ], [ "893c90eae1394985", "eb433762a15ff684", "b5a33742cf8ae14a" ] ] }, { "id": "679f37f58704d88f", "type": "change", "z": "5af82cd4c44df066", "name": "Flash at brightness 100%", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1170, "y": 460, "wires": [ [ "6289202be36f95a6" ] ] }, { "id": "fb51416832400a90", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.test_button_kitchen" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 310, "y": 860, "wires": [ [ "a83bddfc2380a7fc" ] ] }, { "id": "a83bddfc2380a7fc", "type": "debug", "z": "5af82cd4c44df066", "name": "debug 5", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 740, "y": 860, "wires": [] }, { "id": "d8bfcf399f7df488", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_select.kitchen_scene_selector" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 280, "y": 920, "wires": [ [ "a83bddfc2380a7fc" ] ] }, { "id": "0f50cf7e0d776d55", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_select.kitchen_scene_shifter" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 280, "y": 980, "wires": [ [ "a83bddfc2380a7fc" ] ] }, { "id": "ee1d6a217dd0e238", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_boolean.kitchen_lights_on" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 280, "y": 1040, "wires": [ [ "a83bddfc2380a7fc" ] ] }, { "id": "bbae72e59241d2c0", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_boolean.kitchen_occupied" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 280, "y": 1160, "wires": [ [ "a83bddfc2380a7fc" ] ] }, { "id": "c223cdc7301b7103", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "light.kitchen_2" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 280, "y": 1100, "wires": [ [ "a83bddfc2380a7fc" ] ] }, { "id": "28725aa2f0bc83ef", "type": "subflow:52430f5e9f9ee267", "z": "5af82cd4c44df066", "name": "", "x": 730, "y": 60, "wires": [ [ "4584b1c0133c143c" ], [ "4584b1c0133c143c" ], [ "4584b1c0133c143c" ], [ "72fce694d3455880" ], [ "72fce694d3455880" ], [ "39aba0a7d9f18c40" ] ] }, { "id": "b5a33742cf8ae14a", "type": "trigger", "z": "5af82cd4c44df066", "name": "Trigger 2:30min for flash", "op1": "", "op2": "offf", "op1type": "nul", "op2type": "str", "duration": "150", "extend": false, "overrideDelay": false, "units": "s", "reset": "on", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 730, "y": 460, "wires": [ [ "679f37f58704d88f" ] ] }, { "id": "eb433762a15ff684", "type": "trigger", "z": "5af82cd4c44df066", "name": "Trigger 3:00 min for off", "op1": "", "op2": "offf", "op1type": "nul", "op2type": "str", "duration": "180", "extend": false, "overrideDelay": false, "units": "s", "reset": "on", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 720, "y": 500, "wires": [ [ "23aa3bbdf2a47c04" ] ] }, { "id": "ktchn_timebased_01", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "Kitchen time-based turn on", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.kitchen_time_based_turn_on" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "milliseconds", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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": 160, "wires": [ [ "28725aa2f0bc83ef", "b5a33742cf8ae14a", "eb433762a15ff684" ] ] }, { "id": "f3d66e8924f18806", "type": "server-state-changed", "z": "10cbea6aaac127cd", "name": "Balcony Tradfri button", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.balcony_light_switch_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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": [ [ "f1e907e6ede24945" ], [] ] }, { "id": "9412a727b1cbef12", "type": "comment", "z": "10cbea6aaac127cd", "name": "Balcony light control", "info": "", "x": 170, "y": 100, "wires": [] }, { "id": "f1e907e6ede24945", "type": "api-current-state", "z": "10cbea6aaac127cd", "name": "Balcony Lights On?", "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.outdoor_light_string", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 510, "y": 140, "wires": [ [ "199c4827dec86225" ], [ "a29b4c78a44241b6" ] ] }, { "id": "a29b4c78a44241b6", "type": "api-call-service", "z": "10cbea6aaac127cd", "name": "Turn on balcony lights", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.turn_on", "floorId": [], "areaId": [ "balcony" ], "deviceId": [], "entityId": [], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 860, "y": 160, "wires": [ [] ] }, { "id": "199c4827dec86225", "type": "api-call-service", "z": "10cbea6aaac127cd", "name": "Turn of balcony lights", "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, "action": "light.turn_off", "floorId": [], "areaId": [ "balcony" ], "deviceId": [], "entityId": [], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_off", "x": 860, "y": 100, "wires": [ [] ] }, { "type": "tab", "label": "Hallway", "id": "c19dee9f.e72838" }, { "id": "1be4d360986fd1f1", "type": "server-state-changed", "z": "c19dee9f.e72838", "name": "Hallway smart switch", "wires": [ [ "9bea73aa40198378", "hllw_sw_onhold_01", "hllw_sw_brup_01", "hllw_sw_brdn_01", "hllw_sw_dbg_01" ] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.hallway_switch_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 160, "y": 120 }, { "id": "9bea73aa40198378", "type": "switch", "z": "c19dee9f.e72838", "name": "On/Off check", "wires": [ [ "3369429b11ec6c87" ], [ "492a8c0fafdb95c0" ] ], "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on_press_release", "vt": "str" }, { "t": "eq", "v": "off_press_release", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 470, "y": 60 }, { "id": "93521b5966f6fca9", "type": "comment", "z": "c19dee9f.e72838", "name": "Hallway Lights on/off switch", "wires": [], "info": "", "x": 180, "y": 80 }, { "id": "28b5f90c956f8589", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Turn on/off lights hallway", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.hallway_all" ], "labelId": [], "data": "{{{payload}}}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 1790, "y": 260 }, { "id": "3369429b11ec6c87", "type": "subflow:52430f5e9f9ee267", "z": "c19dee9f.e72838", "name": "", "wires": [ [ "9e21108d47dd29fe" ], [ "9e21108d47dd29fe" ], [ "da8f36cbc0df2e8c" ], [ "da8f36cbc0df2e8c" ], [ "hllw_br_state_01" ], [ "hllw_br_state_01" ] ], "x": 930, "y": 60 }, { "id": "c2c1acbc73dc80f4", "type": "comment", "z": "c19dee9f.e72838", "name": "Hallway Motion sensor", "wires": [], "info": "", "x": 140, "y": 420 }, { "id": "c4a4ba3c5f68d440", "type": "server-state-changed", "z": "c19dee9f.e72838", "name": "Hallway motion sensor", "wires": [ [ "3369429b11ec6c87", "4b6861fef07dcf9c", "cb510a92532ea7f5" ], [] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.hallway_motion_sensor_1_occupancy", "binary_sensor.hallway_motion_sensor_2_occupancy", "binary_sensor.hallway_motion_sensor_3_occupancy" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 140, "y": 460 }, { "id": "hllw_timebased_01", "type": "server-state-changed", "z": "c19dee9f.e72838", "name": "Hallway Time Based Turn On", "wires": [ [ "3369429b11ec6c87", "4b6861fef07dcf9c", "cb510a92532ea7f5" ] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.hallway_time_based_turn_on" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 160, "y": 520 }, { "id": "492a8c0fafdb95c0", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness to 0 (turn off)", "wires": [ [ "28b5f90c956f8589" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness\":0}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1310, "y": 380 }, { "id": "dcd933bc4929181e", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness to 20%", "wires": [ [ "28b5f90c956f8589" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":20}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1310, "y": 200 }, { "id": "9e21108d47dd29fe", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness to 100%", "wires": [ [ "28b5f90c956f8589" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":100}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1310, "y": 120 }, { "id": "da8f36cbc0df2e8c", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness to 65%", "wires": [ [ "28b5f90c956f8589" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":65}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1310, "y": 160 }, { "id": "1e4d5008dcd7fb69", "type": "change", "z": "c19dee9f.e72838", "name": "Flash at brightness 100%", "wires": [ [ "28b5f90c956f8589" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1310, "y": 420 }, { "id": "4b6861fef07dcf9c", "type": "trigger", "z": "c19dee9f.e72838", "name": "Trigger 4:30min for flash", "wires": [ [ "1e4d5008dcd7fb69" ] ], "op1": "", "op2": "offf", "op1type": "nul", "op2type": "str", "duration": "270", "extend": true, "overrideDelay": false, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 710, "y": 500 }, { "id": "cb510a92532ea7f5", "type": "trigger", "z": "c19dee9f.e72838", "name": "Trigger 5:00 min for off", "wires": [ [ "492a8c0fafdb95c0" ] ], "op1": "", "op2": "offf", "op1type": "nul", "op2type": "str", "duration": "300", "extend": true, "overrideDelay": false, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 700, "y": 460 }, { "id": "hllw_sw_onhold_01", "type": "switch", "z": "c19dee9f.e72838", "name": "On hold", "wires": [ [ "9e21108d47dd29fe" ], [ "dcd933bc4929181e" ] ], "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on_hold", "vt": "str" }, { "t": "eq", "v": "off_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 460, "y": 140 }, { "id": "hllw_sw_brup_01", "type": "switch", "z": "c19dee9f.e72838", "name": "Brightness check - Up press/hold", "wires": [ [ "hllw_sw_inc_01" ], [ "hllw_sw_inc_01" ] ], "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "up_press", "vt": "str" }, { "t": "eq", "v": "up_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 540, "y": 180 }, { "id": "hllw_sw_brdn_01", "type": "switch", "z": "c19dee9f.e72838", "name": "Brightness check - Down press/hold", "wires": [ [ "hllw_sw_dec_01" ], [ "hllw_sw_dec_01" ] ], "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "down_press", "vt": "str" }, { "t": "eq", "v": "down_hold", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 540, "y": 220 }, { "id": "hllw_sw_inc_01", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness increase (smooth)", "wires": [ [ "28b5f90c956f8589" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step\":15,\"transition\":0.8}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1340, "y": 240 }, { "id": "hllw_sw_dec_01", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness decrease (smooth)", "wires": [ [ "28b5f90c956f8589" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_step\":-15,\"transition\":0.8}", "tot": "json" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1350, "y": 280 }, { "id": "hllw_sw_dbg_01", "type": "debug", "z": "c19dee9f.e72838", "name": "Hallway Switch Debug", "wires": [], "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 180, "y": 200 }, { "id": "hllw_goodbye_comment_01", "type": "comment", "z": "c19dee9f.e72838", "name": "Goodbye button", "wires": [], "info": "", "x": 160, "y": 600 }, { "id": "hllw_goodbye_trigger_01", "type": "server-state-changed", "z": "c19dee9f.e72838", "name": "Goodbye button", "wires": [ [ "hllw_goodbye_espresso_01", "hllw_goodbye_harmony_01", "hllw_goodbye_heos_01", "hllw_goodbye_lights_01" ] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.goodbye_button_action" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 160, "y": 640 }, { "id": "hllw_goodbye_espresso_01", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Espresso off", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "switch.turn_off", "domain": "switch", "service": "turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "switch.espresso_kitchen" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "x": 500, "y": 600 }, { "id": "hllw_goodbye_harmony_01", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Harmony off", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "remote.turn_off", "domain": "remote", "service": "turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "remote.living_room" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "x": 500, "y": 640 }, { "id": "hllw_goodbye_heos_01", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "HEOS pause", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "media_player.media_pause", "domain": "media_player", "service": "media_pause", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "media_player.bathroom", "media_player.bedroom", "media_player.kitchen" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "x": 500, "y": 680 }, { "id": "hllw_goodbye_lights_01", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Lights off (LR/BR/Bath)", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_off", "domain": "light", "service": "turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.living_room", "light.bedroom", "light.bathroom" ], "labelId": [], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "x": 500, "y": 720 }, { "id": "hllw_br_state_01", "type": "api-current-state", "z": "c19dee9f.e72838", "name": "Bedroom ceiling brightness", "wires": [ [ "hllw_br_switch_01" ] ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.bedroom_main", "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": 1120, "y": 300 }, { "id": "hllw_br_switch_01", "type": "switch", "z": "c19dee9f.e72838", "name": "Bedroom brightness > 50%?", "wires": [ [ "da8f36cbc0df2e8c" ], [ "dcd933bc4929181e" ] ], "property": "data.attributes.brightness", "propertyType": "msg", "rules": [ { "t": "gt", "v": "128", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1400, "y": 300 }, { "type": "tab", "label": "Bathroom", "id": "c7f876875da48b87" }, { "id": "13c933aa7d791e63", "type": "subflow:52430f5e9f9ee267", "z": "c7f876875da48b87", "name": "", "wires": [ [ "cc46642a3ea04954" ], [ "cc46642a3ea04954" ], [ "cc46642a3ea04954" ], [ "1ae97faec6bec4ae" ], [ "1ae97faec6bec4ae" ], [ "bath_br_state_01" ] ], "x": 670, "y": 160 }, { "id": "8ff99e0276ad242f", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait 4:30 min", "wires": [ [ "ce6d7cb10437a4ac" ] ], "op1": "", "op2": "270", "op1type": "nul", "op2type": "num", "duration": "270", "extend": true, "overrideDelay": false, "units": "s", "reset": "on", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 600, "y": 360 }, { "id": "a2887d07baac63d5", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait for 5:00 min", "wires": [ [ "ce6d7cb10437a4ac" ] ], "op1": "", "op2": "300", "op1type": "nul", "op2type": "num", "duration": "300", "extend": true, "overrideDelay": false, "units": "s", "reset": "on", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 610, "y": 320 }, { "id": "173369324c7a842c", "type": "change", "z": "c7f876875da48b87", "name": "Flash at brightness 100%", "wires": [ [ "3013e31f0b3d9303" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1150, "y": 440 }, { "id": "812f8294add5575c", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom lights on", "wires": [ [ "eab005bf8b682c46" ], [] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "light.bathroom_switch_left" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 240 }, { "id": "23f3fd10ac242022", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom Humidity Changed", "wires": [ [ "f1a2b3c4d5e60001" ], [] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "sensor.bathroom_temperature_humidity" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "num", "ifState": "0", "ifStateType": "num", "ifStateOperator": "gte", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 180, "y": 1040 }, { "id": "b2a9a137a909e257", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn on fan", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "switch.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "switch.bathroom_switch_right" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "switch", "service": "turn_on", "x": 670, "y": 1040 }, { "id": "7e4f4bb9c0c9ef2b", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait for 5:00", "wires": [ [ "82599133dd2b9883" ] ], "op1": "", "op2": "5 minutes past", "op1type": "nul", "op2type": "str", "duration": "300", "extend": false, "overrideDelay": false, "units": "s", "reset": "off", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 670, "y": 1120 }, { "id": "82599133dd2b9883", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Get Bathroom Humidity", "wires": [ [ "d6e7f8a9b0c10002" ], [] ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "0", "halt_if_type": "num", "halt_if_compare": "gte", "entity_id": "sensor.bathroom_temperature_humidity", "state_type": "num", "blockInputOverrides": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 950, "y": 1120 }, { "id": "27d9e5846a679b8b", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn off fan", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "switch.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "switch.bathroom_switch_right" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "switch", "service": "turn_off", "x": 1510, "y": 1120 }, { "id": "4548a32796918fd8", "type": "comment", "z": "c7f876875da48b87", "name": "Bathroom ventilator automation shower", "wires": [], "info": "", "x": 210, "y": 1000 }, { "id": "3d44cb85e182a197", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom fan turned on", "wires": [ [ "7e4f4bb9c0c9ef2b" ], [] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "switch.bathroom_switch_right" ], "substring": [], "regex": [] }, "outputInitially": true, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "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": 160, "y": 1120 }, { "id": "ebb5b8c2c3eb6ff5", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom motion sensor on", "wires": [ [ "eab005bf8b682c46", "a2887d07baac63d5", "8ff99e0276ad242f" ], [ "a2887d07baac63d5", "8ff99e0276ad242f" ] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.bathroom_motion_occupancy" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 180, "y": 320 }, { "id": "cc46642a3ea04954", "type": "change", "z": "c7f876875da48b87", "name": "Scene Bathroom Bright", "wires": [ [ "ed2d549e91e1399d" ] ], "rules": [ { "t": "set", "p": "entity_id", "pt": "msg", "to": "scene.bathroom_bright", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1010, "y": 120 }, { "id": "ed2d549e91e1399d", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn on Scene", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "scene.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "{{ entity_id }}" ], "labelId": [], "data": "{\"transition\":0}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "all", "blockInputOverrides": false, "domain": "scene", "service": "turn_on", "x": 1560, "y": 100 }, { "id": "1ae97faec6bec4ae", "type": "change", "z": "c7f876875da48b87", "name": "Scene Bathroom Evening", "wires": [ [ "ed2d549e91e1399d" ] ], "rules": [ { "t": "set", "p": "entity_id", "pt": "msg", "to": "scene.bathroom_evening", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1010, "y": 160 }, { "id": "ddf62bacca5574f6", "type": "change", "z": "c7f876875da48b87", "name": "Scene Bathroom Night", "wires": [ [ "ed2d549e91e1399d" ] ], "rules": [ { "t": "set", "p": "entity_id", "pt": "msg", "to": "scene.bathroom_night", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1000, "y": 200 }, { "id": "3013e31f0b3d9303", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Execute effect on lights bathroom", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.bathroom_lights" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 1540, "y": 440 }, { "id": "bdccd31c131b65fb", "type": "comment", "z": "c7f876875da48b87", "name": "Bathroom automated lights", "wires": [], "info": "", "x": 170, "y": 200 }, { "id": "a9f5122a5704e0e2", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Noone bathing?", "wires": [ [ "ff97c96955f8d423" ], [] ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "off", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.bath_mode", "state_type": "str", "blockInputOverrides": true, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 1040, "y": 340 }, { "id": "38ff5b8ecfcbfdd0", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathmode turned on", "wires": [ [ "20da8eedd69886b0" ], [ "13c933aa7d791e63" ] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_boolean.bath_mode" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 150, "y": 100 }, { "id": "20da8eedd69886b0", "type": "change", "z": "c7f876875da48b87", "name": "Scene Bathroom Bath", "wires": [ [ "ed2d549e91e1399d" ] ], "rules": [ { "t": "set", "p": "entity_id", "pt": "msg", "to": "scene.bathroom_bath", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1000, "y": 80 }, { "id": "b8f30c8224cf9d74", "type": "comment", "z": "c7f876875da48b87", "name": "Bathmode ", "wires": [], "info": "", "x": 120, "y": 60 }, { "id": "eab005bf8b682c46", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Noone bathing?", "wires": [ [ "13c933aa7d791e63" ], [] ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "off", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.bath_mode", "state_type": "str", "blockInputOverrides": true, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 440, "y": 220 }, { "id": "97b500f5140c1dc1", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn off lights bathroom", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.bathroom_lights" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_off", "x": 1510, "y": 380 }, { "id": "ce6d7cb10437a4ac", "type": "change", "z": "c7f876875da48b87", "name": "Store which delay", "wires": [ [ "a9f5122a5704e0e2" ] ], "rules": [ { "t": "set", "p": "delay", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 830, "y": 340 }, { "id": "ff97c96955f8d423", "type": "switch", "z": "c7f876875da48b87", "name": "5:00 or 4:30 min delay", "wires": [ [ "97b500f5140c1dc1" ], [ "173369324c7a842c" ] ], "property": "delay", "propertyType": "msg", "rules": [ { "t": "eq", "v": "300", "vt": "num" }, { "t": "eq", "v": "270", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 840, "y": 420 }, { "id": "cbba47369f1e6479", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait 1:30 min", "wires": [ [ "e12d8801b6c6f320" ] ], "op1": "", "op2": "90", "op1type": "nul", "op2type": "num", "duration": "90", "extend": false, "overrideDelay": false, "units": "s", "reset": "on", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 640, "y": 660 }, { "id": "580c3afd65deefed", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait for 2:00 min", "wires": [ [ "e12d8801b6c6f320" ] ], "op1": "", "op2": "120", "op1type": "nul", "op2type": "num", "duration": "120", "extend": false, "overrideDelay": false, "units": "s", "reset": "on", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 650, "y": 620 }, { "id": "26f9395831aa077c", "type": "change", "z": "c7f876875da48b87", "name": "Flash at brightness 100%", "wires": [ [ "b1e7dd85582b7d3e" ] ], "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1270, "y": 820 }, { "id": "8f9be70d71578fba", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom motion sensor on", "wires": [ [ "580c3afd65deefed", "cbba47369f1e6479" ], [ "52af4ffdf85f60e4" ] ], "d": true, "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "binary_sensor.bathroom_motion_occupancy" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": 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": 180, "y": 620 }, { "id": "b1e7dd85582b7d3e", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Execute effect on lights bathroom", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_on", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.bathroom_lights" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_on", "x": 1580, "y": 820 }, { "id": "07d4571f236fd04b", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Noone bathing?", "wires": [ [ "32e3e60ad0e0d9a1" ], [] ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "off", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "input_boolean.bath_mode", "state_type": "str", "blockInputOverrides": true, "outputProperties": [], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 1100, "y": 640 }, { "id": "a8ad8572dc926e44", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn off lights bathroom", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "light.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "light.bathroom_lights" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "light", "service": "turn_off", "x": 1550, "y": 760 }, { "id": "ade1222fab2ea469", "type": "inject", "z": "c7f876875da48b87", "name": "", "wires": [ [ "32e3e60ad0e0d9a1" ] ], "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 740 }, { "id": "32e3e60ad0e0d9a1", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Bathroom door closed?", "wires": [ [], [ "bbd7dc3adff7b866" ] ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, "halt_if": "off", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "binary_sensor.bathroom_door_contact", "state_type": "str", "blockInputOverrides": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 1350, "y": 640 }, { "id": "52af4ffdf85f60e4", "type": "change", "z": "c7f876875da48b87", "name": "Store motion off time", "wires": [ [ "580c3afd65deefed", "cbba47369f1e6479" ] ], "rules": [ { "t": "set", "p": "motion_off_at", "pt": "msg", "to": "data.last_changed", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 400, "y": 680 }, { "id": "e12d8801b6c6f320", "type": "change", "z": "c7f876875da48b87", "name": "Store which delay", "wires": [ [ "07d4571f236fd04b" ] ], "rules": [ { "t": "set", "p": "delay", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 890, "y": 640 }, { "id": "bbd7dc3adff7b866", "type": "switch", "z": "c7f876875da48b87", "name": "2:00 or 1:30 min delay", "wires": [ [ "a8ad8572dc926e44" ], [ "26f9395831aa077c" ] ], "property": "delay", "propertyType": "msg", "rules": [ { "t": "eq", "v": "120", "vt": "num" }, { "t": "eq", "v": "90", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 940, "y": 780 }, { "id": "339b3b18887a2819", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathing mode on", "wires": [ [ "f4a8732084a282d7" ], [ "f4a8732084a282d7" ] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_boolean.bath_mode" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "on", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "string", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 140, "y": 520 }, { "id": "f4a8732084a282d7", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait for 5 hours", "wires": [ [ "4b98e17771cc3851" ] ], "op1": "", "op2": "", "op1type": "nul", "op2type": "num", "duration": "5", "extend": false, "overrideDelay": false, "units": "hr", "reset": "off", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 600, "y": 520 }, { "id": "4b98e17771cc3851", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn off bath mode", "wires": [ [] ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, "action": "input_boolean.turn_off", "floorId": [], "areaId": [], "deviceId": [], "entityId": [ "input_boolean.bath_mode" ], "labelId": [], "data": "", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "blockInputOverrides": false, "domain": "input_boolean", "service": "turn_off", "x": 850, "y": 520 }, { "id": "bb74897476a1a5e6", "type": "comment", "z": "c7f876875da48b87", "name": "Automatic turn off bath mode after X hours", "wires": [], "info": "", "x": 220, "y": 480 }, { "id": "f1a2b3c4d5e60001", "type": "function", "z": "c7f876875da48b87", "name": "Rise >= 3% in 2 min?", "wires": [ [ "b2a9a137a909e257" ] ], "func": "const readings = context.get(\"readings\") || [];\nconst lastTriggered = context.get(\"lastTriggered\") || 0;\nconst now = Date.now();\nconst current = parseFloat(msg.payload);\n\nif (isNaN(current)) return null;\n\n// 15-minute cooldown after triggering\nif (now - lastTriggered < 15 * 60 * 1000) return null;\n\nreadings.push({ time: now, value: current });\nconst windowMs = 2 * 60 * 1000;\nconst filtered = readings.filter(r => r.time >= now - windowMs);\ncontext.set(\"readings\", filtered);\n\nif (filtered.length < 2) return null;\n\nconst minInWindow = Math.min(...filtered.map(r => r.value));\nconst rise = current - minInWindow;\n\nif (rise >= 3) {\n context.set(\"lastTriggered\", now);\n context.set(\"readings\", []);\n flow.set(\"humidityBaseline\", minInWindow);\n return msg;\n}\nreturn null;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 460, "y": 1040 }, { "id": "d6e7f8a9b0c10002", "type": "function", "z": "c7f876875da48b87", "name": "Below baseline + 5%?", "wires": [ [ "27d9e5846a679b8b" ], [ "7e4f4bb9c0c9ef2b" ] ], "func": "const current = parseFloat(msg.payload);\nconst baseline = flow.get(\"humidityBaseline\") || 60;\nconst threshold = baseline + 5;\n\nif (current <= threshold) {\n return [msg, null];\n}\nreturn [null, msg];", "outputs": 2, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1240, "y": 1120 }, { "id": "bthrm_timebased_01", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom time-based turn on", "wires": [ [ "13c933aa7d791e63", "a2887d07baac63d5", "8ff99e0276ad242f" ] ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, "exposeAsEntityConfig": "", "entities": { "entity": [ "input_button.bathroom_time_based_turn_on" ], "substring": [], "regex": [] }, "outputInitially": false, "stateType": "str", "ifState": "", "ifStateType": "str", "ifStateOperator": "is", "outputOnlyOnStateChange": true, "for": "", "forType": "num", "forUnits": "milliseconds", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": true, "ignoreCurrentStateUnavailable": true, "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 }, { "id": "bath_br_state_01", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Bedroom ceiling brightness", "wires": [ [ "bath_br_switch_01" ] ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, "halt_if": "", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "light.bedroom_main", "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": 830, "y": 240 }, { "id": "bath_br_switch_01", "type": "switch", "z": "c7f876875da48b87", "name": "Bedroom brightness > 50%?", "wires": [ [ "1ae97faec6bec4ae" ], [ "ddf62bacca5574f6" ] ], "property": "data.attributes.brightness", "propertyType": "msg", "rules": [ { "t": "gt", "v": "128", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1080, "y": 240 }, { "type": "tab", "label": "presence", "id": "6dfa989bb120e6c6" } ]