node-red-contrib-home-assistant-websocket
Version:
Node-RED integration with Home Assistant through websocket and REST API
290 lines • 321 kB
HTML
<link rel="stylesheet" href="resources/node-red-contrib-home-assistant-websocket/virtual-select.v1.0.44.min.css"><script src="resources/node-red-contrib-home-assistant-websocket/virtual-select.v1.0.44.min.js"></script><script src="resources/node-red-contrib-home-assistant-websocket/handlebars.min-v4.7.8.js"></script><script type="text/html" data-template-name="ha_entity_filter"><div class="form-row ha-entity-search-row"><label data-i18n="home-assistant.label.filter_results_label"></label> <input type="text"></div><div class="form-row ha-entity-search-row"><ul></ul></div></script>
<script type="text/html" data-template-name="ha_sidebar"><div class="home-assistant-sidebar-container"></div></script>
<script type="text/html" data-template-name="ha_sidebar_toolbar"><div><a class="red-ui-footer-button" id="home-assistant-diagnostics-button" href="#"><i class="fa fa-cogs"></i></a></div></script>
<script type="text/html" data-help-name="ha-api"><p>The API node provides access to all points of the Home Assistant WebSocket and HTTP API. This enables you to interact programmatically with Home Assistant, sending and receiving data through these protocols. It’s a powerful tool for integrating third-party systems, custom automations, or advanced control within Node-RED, offering full access to Home Assistant's core functionalities.</p><h3>Config</h3><dl class="message-properties"><dt>Protocol <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><ul><li>Values: <code>websocket|http</code></li><li>Default: <code>websocket</code></li></ul><dd>Protocol to use to access Home Assistant API.</dd><dt>Method<span class="property-type">string</span></dt><ul><li>Values: <code>get|post</code></li></ul><dd>Type of method to use to access the HTTP endpoint.</dd><dt>Path<span class="property-type">string</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a></li></ul><dd>URL of the API endpoint.</dd><dt>Params<span class="property-type">Object</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a></li></ul><dd>A JSON object with key/value pairs that will be converted into URL parameters.</dd><dt>Data<span class="property-type">Object</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a> when the data type is JSON</li></ul><dd>JSON Object to send for WebSocket requests and HTTP posts.</dd><dt>Results<span class="property-type">string</span></dt></dl><h3>Input</h3><dl class="message-properties"><dd>All properties need to be under <code>msg.payload</code>.</dd><dt>protocol<span class="property-type">string</span></dt><ul><li>Values: <code>websocket|http</code></li></ul><dd>Overrides or sets the protocol property of the config.</dd><dt>method<span class="property-type">string</span></dt><ul><li>Values: <code>get|post</code></li></ul><dd>Overrides or sets the method property of the config.</dd><dt>path<span class="property-type">string</span></dt><dd>Overrides or sets the path property of the config.</dd><dt>data<span class="property-type">Object|string</span></dt><dd>Overrides or sets the data/params property of the config.</dd><dt>location<span class="property-type">string</span></dt><dd>Overrides or sets the results property of the config.</dd><dt>locationType<span class="property-type">string</span></dt><ul><li>Values: <code>msg|flow|global</code></li></ul><dd>Overrides or sets the results type property of the config.</dd></dl><h3>Output</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>results</code>: results of the API request</li><li><code>config</code>: config properties of the node</li></ul></dl><h3>References</h3><dl class="message-properties"><ul><li><a href="https://developers.home-assistant.io/docs/api/rest">http api</a></li><li><a href="https://developers.home-assistant.io/docs/api/websocket">websocket api</a></li></ul></dl></script>
<script type="text/html" id="handlebars-notification-bar" data-template-name="x-tmpl-handlebars"><li class="ha-notification">
<svg width="24" height="24" viewBox="0 0 240 240" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M240 224.762C240 233.012 233.25 239.762 225 239.762H15C6.75 239.762 0 233.012 0 224.762V134.762C0 126.512 4.77 114.993 10.61 109.153L109.39 10.3725C115.22 4.5425 124.77 4.5425 130.6 10.3725L229.39 109.162C235.22 114.992 240 126.522 240 134.772V224.772V224.762Z" fill="#F2F4F9"></path><path d="M229.39 109.153L130.61 10.3725C124.78 4.5425 115.23 4.5425 109.4 10.3725L10.61 109.153C4.78 114.983 0 126.512 0 134.762V224.762C0 233.012 6.75 239.762 15 239.762H107.27L66.64 199.132C64.55 199.852 62.32 200.262 60 200.262C48.7 200.262 39.5 191.062 39.5 179.762C39.5 168.462 48.7 159.262 60 159.262C71.3 159.262 80.5 168.462 80.5 179.762C80.5 182.092 80.09 184.322 79.37 186.412L111 218.042V102.162C104.2 98.8225 99.5 91.8425 99.5 83.7725C99.5 72.4725 108.7 63.2725 120 63.2725C131.3 63.2725 140.5 72.4725 140.5 83.7725C140.5 91.8425 135.8 98.8225 129 102.162V183.432L160.46 151.972C159.84 150.012 159.5 147.932 159.5 145.772C159.5 134.472 168.7 125.272 180 125.272C191.3 125.272 200.5 134.472 200.5 145.772C200.5 157.072 191.3 166.272 180 166.272C177.5 166.272 175.12 165.802 172.91 164.982L129 208.892V239.772H225C233.25 239.772 240 233.022 240 224.772V134.772C240 126.522 235.23 115.002 229.39 109.162V109.153Z" fill="#18BCF2"></path></svg>
<div id="notification-issues">
<span class="ha-issue-count">{{issuesCount}}</span>
<i class="fa fa-exclamation-triangle"></i>
</div>
</li>
</script>
<script type="text/javascript">!function(){"use strict";const e="0.0.0",t="__ALL_TAGS__";var i,n,a,o,s,r,l,u;!function(e){e.Is="is",e.IsNot="is_not",e.IsLessThan="lt",e.IsLessThanOrEqual="lte",e.IsGreaterThan="gt",e.IsGreaterThanOrEqual="gte",e.Includes="includes",e.DoesNotInclude="does_not_include",e.Contains="cont",e.DoesNotContain="does_not_cont",e.StartsWith="starts_with",e.InGroup="in_group",e.JSONata="jsonata",e.IsNull="is_null",e.IsNotNull="is_not_null",e.IsTrue="is_true",e.IsFalse="is_false",e.Regex="regex"}(i||(i={})),function(e){e.Boolean="boolean",e.Float="float",e.Integer="integer",e.PositiveTimePeriod="positive_time_period_dict",e.Select="select",e.String="string"}(n||(n={})),function(e){e.BinarySensor="binary_sensor",e.Button="button",e.Number="number",e.Select="select",e.Sensor="sensor",e.Switch="switch",e.Text="text",e.Time="time"}(a||(a={})),function(e){e.Exact="exact",e.List="list",e.Regex="regex",e.Substring="substring"}(o||(o={})),function(e){e.Action="api-call-service",e.API="ha-api",e.CurrentState="api-current-state",e.Device="ha-device",e.Entity="ha-entity",e.EventsAll="server-events",e.EventsCalendar="ha-events-calendar",e.EventsState="server-state-changed",e.FireEvent="ha-fire-event",e.GetEntities="ha-get-entities",e.GetHistory="api-get-history",e.PollState="poll-state",e.RenderTemplate="api-render-template",e.Select="ha-select",e.Sentence="ha-sentence",e.TriggerState="trigger-state",e.Tag="ha-tag",e.Time="ha-time",e.WaitUntil="ha-wait-until",e.Webhook="ha-webhook",e.Zone="ha-zone",e.Server="server",e.DeviceConfig="ha-device-config",e.EntityConfig="ha-entity-config",e.BinarySensor="ha-binary-sensor",e.Button="ha-button",e.Number="ha-number",e.Sensor="ha-sensor",e.Switch="ha-switch",e.Text="ha-text",e.TimeEntity="ha-time-entity",e.UpdateConfig="ha-update-config"}(s||(s={})),function(e){e.Get="get",e.Set="set",e.Listen="listen"}(r||(r={})),function(e){e.Message="msg",e.Flow="flow",e.Global="global",e.Boolean="bool",e.JSON="json",e.Date="date",e.JSONata="jsonata",e.Number="num",e.String="str",e.None="none",e.Config="config",e.Data="data",e.Entity="entity",e.EntityState="entityState",e.EventData="eventData",e.Headers="headers",e.Params="params",e.TriggerId="triggerId",e.PrevEntity="prevEntity",e.Results="results",e.Regex="re",e.Value="value",e.PreviousValue="previousValue",e.CalendarItem="calendarItem",e.DeviceId="deviceId",e.Enviroment="env"}(l||(l={})),function(e){e.Milliseconds="milliseconds",e.Seconds="seconds",e.Minutes="minutes",e.Hours="hours",e.Days="days"}(u||(u={}));const p=(e,t)=>{let i=RED._(`node-red-contrib-home-assistant-websocket/all:${e}`,t);return-1!==i.indexOf("\n")&&(i=i.split("\n").map((e=>`<p>${e}</p>`)).join("")),i};function d(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null==e||null==t)return!1;const i=Object.keys(e),n=Object.keys(t);if(i.length<n.length)return!1;for(const a of n){if(!i.includes(a))return!1;if(!d(e[a],t[a]))return!1}return!0}function c(e,t){return e.split(".").reduce(((e,t)=>e[t]),t)}const v={},y={},g={},h={},f={},m={},b={};function T(e){return e.split("/")[2]}function _(e,t){const i=e.label,n=t.label;return i===n?0:i.localeCompare(n)}function S(e,t){const i=E(e);if(t&&(null==i?void 0:i.length)){const e=i.find((e=>e.area_id===t));if(e)return e.name}return p("ha-device.ui.no_area")}function E(e){var t;return null!==(t=v[e])&&void 0!==t?t:[]}function w(e){var t;return null!==(t=y[e])&&void 0!==t?t:[]}function D(e,t){return b[e].find((e=>e.id===t))}function O(e,t,i="."){return Object.keys(e).reduce(((n,a)=>{const o=e[a],s=[t,a].filter(Boolean).join(i);return["object"==typeof o,null!==o,!(o instanceof Date),!(o instanceof RegExp),!(Array.isArray(o)&&0===o.length)].every(Boolean)?Object.assign(Object.assign({},n),O(o,s,i)):Object.assign(Object.assign({},n),{[s]:o})}),{})}let x;const I={show:e=>{RED.view.state(RED.state.EDITING);const t={title:p("home-assistant.label.filter_results_title"),width:"inherit",buttons:[{id:"node-dialog-cancel",text:p("home-assistant.label.cancel"),click:()=>{RED.tray.close()}},{id:"node-dialog-ok",text:p("home-assistant.label.done"),class:"primary",click:()=>{e.complete(x),RED.tray.close()}}],open:t=>{const i=t.find(".red-ui-tray-body");RED.editor.buildEditForm(i,"dialog-form","ha_entity_filter","node-red-contrib-home-assistant-websocket/all"),t.i18n(),$("#dialog-form").addClass("home-assistant"),i.find("select").val(e.filterType),i.find("input").val(e.filter).on("input",(t=>{const n=((e,t,i)=>{let n=[];if("regex"===i)try{const i=new RegExp(t);n=e.filter((e=>i.test(e.entity_id)))}catch(e){n=[]}else"substring"===i&&(n=e.filter((e=>e.entity_id.includes(t))));return n.sort(function(e){function t(e){let t,i=1;return"string"==typeof e&&e.startsWith("-")?(i=-1,t=e.substring(1)):t=e,function(e,n){const a=e[t],o=n[t];return("string"==typeof a&&"string"==typeof o?a.localeCompare(o):a<o?-1:a>o?1:0)*i}}return function(i,n){let a=0,o=0;const s=null==e?void 0:e.length;for(;0===o&&a<s;)o=t(e[a])(i,n),a++;return o}}(["entity_id"]))})(e.entities,t.target.value,e.filterType);x=t.target.value,i.find("ul").html((e=>e.length?e.map((e=>`<li>${e.entity_id}</li>`)).join(""):`<li>${p("home-assistant.label.no_matches_found")}</li>`)(n))})).trigger("input")}};RED.tray.show(t)}},C=({filter:e,filterType:t,entities:i,complete:n})=>{RED.editor.showTypeEditor("ha_entity_filter",{filter:e,filterType:t,entities:i,complete:n})};var j,R;let k;!function(e){e.Trigger="trigger",e.Response="response"}(j||(j={})),function(e){e.Dynamic="dynamic",e.Fixed="fixed"}(R||(R={}));const A={};function P(){const e=[s.BinarySensor,s.Button,s.Number,s.Select,s.Sensor,s.Switch,s.Text,s.TimeEntity];return"type"in k&&(null==k?void 0:k.type)&&e.includes(k.type)}function L(){const t=function(){let e=$("#node-input-server").val();if(P()){const t=RED.nodes.node($("#node-input-entityConfig").val());e=null==t?void 0:t.server}if(e&&"_ADD_"!==e)return e}();return t&&A[t]?A[t]:e}function N(){return L()!==e}function B(e){return"_ADD_"===$(`#node-input-${e}`).val()}function H(e){k=e;const t="type"in k&&k.type;!function(){const e="type"in k&&k.type;switch(e){case s.BinarySensor:case s.Button:case s.Number:case s.Select:case s.Sensor:case s.Switch:case s.Text:case s.TimeEntity:B("entityConfig")||M(e);break;case s.Device:case s.Sentence:case s.Webhook:B("server")||M(e);break;case s.EventsAll:case s.EventsCalendar:case s.EventsState:case s.PollState:case s.Tag:case s.Time:case s.TriggerState:case s.Zone:break;default:!function(){const e=$("<div />",{id:"exposeToHa",class:"form-row checkbox-option"+("type"in k&&"trigger-state"===k.type?"-left":"")});$("<input />",{type:"checkbox",id:"node-input-exposeToHomeAssistant",checked:k.exposeToHomeAssistant}).on("change",(function(){$("#haConfigRow").toggle(!0===$("#node-input-exposeToHomeAssistant").is(":checked"))})).appendTo(e),$("<label />",{for:"node-input-exposeToHomeAssistant",text:"Expose to Home Assistant"}).appendTo(e);const t=$("<div />",{class:"form-row",id:"haConfigRow"}),i=$("<ol />",{id:"haConfig"}).appendTo(t),n=k.haConfig||[{property:"name",value:""},{property:"icon",value:""}];i.editableList({addButton:!1,header:$("<div>Home Assistant Config (optional)</div>"),addItem:function(e,t,i){const n=$("<div />").appendTo(e),a=$("<label>").appendTo(n);$("<span>").text(i.property.replace(/_/g," ")).appendTo(a),$("<input />",{type:"hidden",name:"property",value:i.property}).appendTo(a),$("<input />",{type:"text",name:"value",value:i.value}).attr("autocomplete","disable").appendTo(a)}}).editableList("addItems",n),$("#dialog-form").append(e).append(t),$("#node-input-exposeToHomeAssistant").trigger("change")}()}}(),$("#node-input-server, #node-input-entityConfig").on("change",(()=>{switch(t){case s.BinarySensor:case s.Button:case s.Number:case s.Select:case s.Sensor:case s.Switch:case s.Text:case s.TimeEntity:B("entityConfig")||M(t);break;case s.Device:M(t);break;case s.Sentence:{const e=$("#node-input-mode").val();$("#exposed-as-row").toggle(e===j.Trigger),B("server")||M(t)}break;case s.Webhook:B("server")||M(t);break;case s.EventsAll:case s.EventsCalendar:case s.EventsState:case s.PollState:case s.Tag:case s.TriggerState:case s.Zone:case s.Time:default:!function(){$("#node-input-exposeAsEntityConfig").closest("div.form-row").toggle(N()),N()||$("#node-input-exposeToHomeAssistant").prop("checked",!1).trigger("change");$("#exposeToHa").toggle(N())}()}})),P()&&$("#node-input-mode").on("change",F)}const V={[s.BinarySensor]:"1.1.0",[s.Button]:"1.0.4",[s.Device]:"4.0.2",[s.Number]:"1.3.0",[s.Select]:"1.4.0",[s.Sentence]:"4.1.0",[s.Sensor]:"1.1.0",[s.Switch]:"1.1.0",[s.Tag]:"0.5.0",[s.Text]:"1.3.0",[s.TimeEntity]:"2.1.0",[s.Webhook]:"1.6.0"};function M(e){const t=V[e],i=void 0===t||(n=t,a=L(),(n=n.split(".").map((e=>e.padStart(5))).join("."))<=a.split(".").map((e=>e.padStart(5))).join("."));var n,a;const o=N()&&i;if(!$("#integrationAlert").length){const e=`\n <div id="integrationAlert" class="ui-state-error ha-alert-box">\n This node requires <a href="https://github.com/zachowj/hass-node-red" target="_blank">Node-RED custom integration ${i?"":`version ${t}+`} <i class="fa fa-external-link external-link"></i></a> to be installed in Home Assistant for it to function.\n </div>`;$("#dialog-form").prepend(e)}$("#integrationAlert").toggle(!o)}function F(){const e=$("#node-input-mode").val();$("#exposed-as-row").toggle(e===r.Listen)}var q;!function(e){e.IssuesUpdated="home-assistant:issues-updated",e.OpenIssues="home-assistant:open-issues"}(q||(q={}));const G=Handlebars.compile($("#handlebars-notification-bar").html());let W,J=[],z=!1;function U(){return J}var K=e=>{var t;try{null===(t=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===t||t.writeText(e)}catch(t){const i=document.createElement("textarea");i.textContent=e;const n=document.getElementsByTagName("body")[0];n.appendChild(i),i.select(),document.execCommand("copy"),n.removeChild(i)}};Handlebars.registerHelper("backgroundcolor",(function(e){return`style="background-color: ${e};"`})),Handlebars.registerHelper("ishidden",(function(e){return e?'class="ha-hidden"':""})),Handlebars.registerHelper("i18n",(function(e){return p(e)}));const Z=Handlebars.compile($("#handlebars-sidebar-list").html()),X=Handlebars.compile($("#handlebars-sidebar-filter").html()),Y=Handlebars.compile($("#handlebars-sidebar-issues").html()),Q=Handlebars.compile($("#handlebars-sidebar-issues-list").html());let ee,te,ie,ne;function ae(){[{type:s.Server,section:ee},{type:s.EntityConfig,section:te},{type:s.DeviceConfig,section:ie}].forEach((({type:e,section:t})=>{t.content.empty();const i=function(e){const t=[],i=new Set;return RED.nodes.eachConfig((function(n){return n.type===e&&(n.entityType&&i.add(n.entityType),t.push({name:n.name||n.id,id:n.id,count:n.users.length,type:n.entityType})),!0})),{list:t.sort(((e,t)=>e.name.localeCompare(t.name))),types:[...i].sort()}}(e);i.types.length>1&&$(X(i)).on("change","select",(function(){const e=$(this).val();t.content.find(".ha-list-row").each((function(){const t=$(this);"__all__"===e||t.data("type")===e?t.show():t.hide()}))})).appendTo(t.content),$(Z(i)).on("click",".ha-list-row-name",(function(t){t.stopPropagation(),RED.editor.editConfig("",e,$(this).parent().data("id"),"")})).on("click",".ha-list-row-count",(function(e){e.stopPropagation(),RED.search.show($(this).parent().data("id"))})).appendTo(t.content)}))}function oe(e){return e.map((e=>{const t=RED.nodes.node(e.nodeId),i=null==t?void 0:t._def.icon,n=!!(null==i?void 0:i.startsWith("font-awesome/")),a=n?i.slice(13):i;return{color:t._def.color,icon:a,isFontAwesomeIcon:n,name:t?t._def.label.call(t):e.nodeId,id:e.nodeId,issues:e.messages,hide:e.hide}}))}function se(e){ne&&($(Y({issues:e})).on("click","#ha-issues-toggle-hidden",(function(){this.checked?$(".ha-issues-list").addClass("ha-show-hidden"):$(".ha-issues-list").removeClass("ha-show-hidden")})).appendTo(ne.content),ne.content.find(".ha-issues-list").append(re(e)).on("click",".ha-find-node",(function(e){e.stopPropagation(),RED.view.reveal($(this).parents("li").data("id"))})).on("click",".ha-edit-node",(function(e){e.stopPropagation();const t=$(this).parents("li").data("id"),i=RED.nodes.node(t);i&&RED.editor.edit(i)})).on("click",".ha-hidden-issue",(function(e){e.stopPropagation();const t=$(this).parents("li[data-id]"),i=t.data("id"),n=$(this).data("popover");n&&(n.close(),n.setContent(t.hasClass("ha-hidden")?p("home-assistant.sidebar.issues.show_issue"):p("home-assistant.sidebar.issues.hide_issue"))),$.ajax({url:"homeassistant/issues/hidden",type:"POST",data:JSON.stringify({issue:i}),contentType:"application/json",success:()=>{RED.notify(p("home-assistant.service.issue.issue_hidden",{issue_id:i}),{type:"success",id:`issue${i}`,timeout:2e3}),t.addClass("ha-hidden")},error:function(e,t){let n="";n=500===e.status?p("home-assistant.service.issue.failed_to_hide",{issue_id:i}):0===e.status?p("home-assistant.service.issue.no-response"):p("home-assistant.service.issue.unexpected",{status:e.status,message:t}),RED.notify(n,"error")}})})))}function re(e){const t=$(Q({issues:oe(e)}));return $(".ha-edit-node",t).each((function(){RED.popover.tooltip($(this),p("home-assistant.sidebar.issues.open_editor"))})),$(".ha-find-node",t).each((function(){RED.popover.tooltip($(this),p("home-assistant.sidebar.issues.find_node"))})),$(".ha-hidden-issue",t).each((function(){const e=$(this),t=e.parents("li").hasClass("ha-hidden"),i=RED.popover.tooltip(e,p(t?"home-assistant.sidebar.issues.show_issue":"home-assistant.sidebar.issues.hide_issue"));$(this).data("popover",i)})),t}var le,ue,pe=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>{const t=Object.assign(Object.assign({},e),{version:1});try{const i=JSON.parse(e.data);i.entity_id?(t.entityId=i.entity_id,delete i.entity_id,t.data=Object.keys(i).length?JSON.stringify(i):""):t.entityId=""}catch(e){}return t}},{version:2,up:e=>{const t=Object.assign(Object.assign({},e),{version:2,outputProperties:[]});return"none"!==e.output_location_type&&(t.outputProperties=[{property:e.output_location,propertyType:e.output_location_type,value:"",valueType:"data"}]),t}},{version:3,up:e=>Object.assign(Object.assign({},e),{version:3,queue:"none"})},{version:4,up:e=>Object.assign(Object.assign({},e),{version:4,target:{entityId:(null==e?void 0:e.entityId)?e.entityId.split(",").map((e=>e.trim())):[],areaId:[],deviceId:[]},domain:e.service_domain,mergeContext:e.mergecontext,entityId:void 0,service_domain:void 0,mergecontext:void 0})},{version:5,up:e=>{var t,i,n;return Object.assign(Object.assign({},e),{version:5,areaId:null===(t=e.target)||void 0===t?void 0:t.areaId,deviceId:null===(i=e.target)||void 0===i?void 0:i.deviceId,entityId:null===(n=e.target)||void 0===n?void 0:n.entityId,target:void 0})}},{version:6,up:e=>{const t=Object.assign(Object.assign({},e),{version:6,floorId:[],labelId:[]});return(e.domain||e.service)&&(t.action=`${e.domain}.${e.service}`),t}},{version:7,up:e=>Object.assign(Object.assign({},e),{version:7,blockInputOverrides:!1})}],de=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>{const t=Object.assign(Object.assign({},e),{version:1,outputProperties:[],location:void 0,locationType:void 0});return"none"!==e.locationType&&(t.outputProperties=[{property:e.location,propertyType:e.locationType,value:"",valueType:"results"}]),t}}],ce=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})}],ve=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,ha_boolean:e.ha_boolean||"y|yes|true|on|home|open",rejectUnauthorizedCerts:void 0===e.rejectUnauthorizedCerts||e.rejectUnauthorizedCerts,connectionDelay:void 0===e.connectionDelay||e.connectionDelay,cacheJson:void 0===e.cacheJson||e.cacheJson})},{version:2,up:e=>Object.assign(Object.assign({},e),{version:2,heartbeat:!1,heartbeatInterval:30})},{version:3,up:e=>Object.assign(Object.assign({},e),{version:3,areaSelector:"friendlyName",deviceSelector:"friendlyName",entitySelector:"friendlyName"})},{version:4,up:e=>Object.assign(Object.assign({},e),{version:4,statusSeparator:"at: ",statusYear:"hidden",statusMonth:"short",statusDay:"numeric",statusHourCycle:"h23",statusTimeFormat:"h:m"})},{version:5,up:e=>Object.assign(Object.assign({},e),{version:5,enableGlobalContextStore:!0})}],ye=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,blockInputOverrides:!1,entity_location:"data",halt_if_compare:"is",override_payload:!1===e.override_payload?"none":"msg",override_data:!1===e.override_data?"none":"msg",state_location:"payload",state_type:"str"})},{version:2,up:e=>{const t=Object.assign(Object.assign({},e),{version:2,outputProperties:[],state_location:void 0,override_payload:void 0,entity_location:void 0,override_data:void 0,override_topic:void 0});return"none"!==e.override_payload&&t.outputProperties.push({property:e.state_location,propertyType:e.override_payload,value:"",valueType:"entityState"}),"none"!==e.override_data&&t.outputProperties.push({property:e.entity_location,propertyType:e.override_data,value:"",valueType:"entity"}),!0===e.override_topic&&t.outputProperties.push({property:"topic",propertyType:"msg",value:"",valueType:"triggerId"}),t}},{version:3,up:e=>Object.assign(Object.assign({},e),{version:3,for:0,forType:"num",forUnits:"minutes"})}],ge=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>{const t=Object.assign(Object.assign({},e),{version:1,exposeAsEntityConfig:""});return t.exposeToHomeAssistant=void 0,t.haConfig=void 0,t}}],he=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})}],fe=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,inputOverride:"allow"})},{version:2,up:e=>{const t=Object.assign(Object.assign({},e),{version:2});return t.config.push({property:"state_class",value:""}),t.config.push({property:"last_reset",value:""}),t}},{version:3,up:e=>Object.assign(Object.assign({},e),{version:3})}],me=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1})},{version:2,up:e=>Object.assign(Object.assign({},e),{version:2})},{version:3,up:e=>Object.assign(Object.assign({},e),{version:3})},{version:4,up:e=>Object.assign(Object.assign({},e),{version:4})},{version:5,up:e=>Object.assign(Object.assign({},e),{version:5})},{version:6,up:e=>Object.assign(Object.assign({},e),{version:6})}],be=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0,waitForRunning:void 0===e.waitForRunning||e.waitForRunning})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,outputProperties:[{property:"payload",propertyType:"msg",value:"",valueType:"eventData"},{property:"topic",propertyType:"msg",value:'$outputData("eventData").event_type',valueType:"jsonata"},{property:"event_type",propertyType:"msg",value:'$outputData("eventData").event_type',valueType:"jsonata"}]})},{version:2,up:e=>Object.assign(Object.assign({},e),{version:2,eventType:e.event_type,event_type:void 0})},{version:3,up:e=>{const t=Object.assign(Object.assign({},e),{version:3,exposeAsEntityConfig:""});return t.exposeToHomeAssistant=void 0,t.haConfig=void 0,t}}],Te=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})}];!function(e){e.Floor="floor",e.Area="area",e.Device="device",e.Entity="entity",e.Label="label",e.Substring="substring",e.Regex="regex"}(le||(le={})),function(e){e.Floor="floor_registry",e.Area="area_registry",e.Device="device_registry",e.State="state_object",e.Label="label_registry"}(ue||(ue={}));var _e=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0,state_type:void 0!==e.state_type?e.state_type:"str",halt_if_type:void 0!==e.halt_if_type?e.halt_if_type:"str",halt_if_compare:void 0!==e.halt_if_compare?e.halt_if_compare:"is"})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,ignorePrevStateNull:!1,ignorePrevStateUnknown:!1,ignorePrevStateUnavailable:!1,ignoreCurrentStateUnknown:!1,ignoreCurrentStateUnavailable:!1})},{version:2,up:e=>Object.assign(Object.assign({},e),{version:2,for:void 0!==e.for?e.for:"0",forType:e.forType||"num",forUnits:e.forUnits||"minutes"})},{version:3,up:e=>Object.assign(Object.assign({},e),{version:3,outputProperties:[{property:"payload",propertyType:"msg",value:"",valueType:"entityState"},{property:"data",propertyType:"msg",value:"",valueType:"eventData"},{property:"topic",propertyType:"msg",value:"",valueType:"triggerId"}]})},{version:4,up:e=>{var t;const i=Object.assign(Object.assign({},e),{version:4});return"substring"===e.entityidfiltertype&&(null===(t=e.entityidfilter)||void 0===t?void 0:t.includes(","))&&(i.entityidfiltertype="list",i.entityidfilter=e.entityidfilter.split(",").map((e=>e.trim())).filter((e=>e.length>0))),i}},{version:5,up:e=>{const t=Object.assign(Object.assign({},e),{version:5,entityId:e.entityidfilter,entityIdType:e.entityidfiltertype,ifState:e.haltifstate,ifStateType:e.halt_if_type,ifStateOperator:e.halt_if_compare,outputInitially:e.outputinitially,stateType:e.state_type,outputOnlyOnStateChange:e.output_only_on_state_change,exposeAsEntityConfig:""});return t.entityidfilter=void 0,t.entityidfiltertype=void 0,t.haltifstate=void 0,t.halt_if_type=void 0,t.halt_if_compare=void 0,t.outputinitially=void 0,t.state_type=void 0,t.output_only_on_state_change=void 0,t.exposeToHomeAssistant=void 0,t.haConfig=void 0,t}},{version:6,up:e=>{const t=Object.assign(Object.assign({},e),{version:6,entities:[],entityId:void 0,entityIdType:void 0}),i={[le.Entity]:[],[le.Substring]:[],[le.Regex]:[]};switch(e.entityIdType){case"list":i[le.Entity]=e.entityId;break;case"exact":i[le.Entity]=[e.entityId];break;case"substring":i[le.Substring]=[e.entityId];break;case"regex":i[le.Regex]=[e.entityId]}return t.entities=i,t}}],$e=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})}],Se=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>{const t=Object.assign(Object.assign({},e),{version:1,outputType:e.output_type,outputEmptyResults:e.output_empty_results,outputLocationType:e.output_location_type,outputLocation:e.output_location,outputResultsCount:e.output_results_count});return t.output_type=void 0,t.output_empty_results=void 0,t.output_location_type=void 0,t.output_location=void 0,t.output_results_count=void 0,t}}],Ee=[{version:0,up:e=>{const t=Object.assign(Object.assign({},e),{version:0,output_type:void 0===e.output_type?"array":e.output_type});return void 0===t.output_location&&(t.output_location="payload",t.output_location_type="msg"),t}},{version:1,up:e=>{const t=Object.assign(Object.assign({},e),{version:1,startDate:e.startdate,endDate:e.enddate,entityId:e.entityid,outputType:e.output_type,outputLocationType:e.output_location_type,outputLocation:e.output_location,entityIdType:"includes"===e.entityidtype?"regex":"equals"});return t.startdate=void 0,t.enddate=void 0,t.entityid=void 0,t.entityidtype=void 0,t.output_type=void 0,t.output_location_type=void 0,t.output_location=void 0,t}}],we=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,mode:"out"===e.mode?"set":"listen"})}],De=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,state_type:"str",halt_if_type:"str",halt_if_compare:"is",updateIntervalUnits:"seconds"})},{version:2,up:e=>Object.assign(Object.assign({},e),{version:2,updateIntervalType:"num"})},{version:3,up:e=>{const t=Object.assign(Object.assign({},e),{version:3,entityId:e.entity_id,exposeAsEntityConfig:"",ifState:e.halt_if,ifStateType:e.halt_if_type,ifStateOperator:e.halt_if_compare,outputInitially:e.outputinitially,outputOnChanged:e.outputonchanged,outputProperties:[{property:"payload",propertyType:l.Message,value:"",valueType:"entityState"},{property:"data",propertyType:l.Message,value:"",valueType:"entity"},{property:"topic",propertyType:l.Message,value:"",valueType:"triggerId"}],stateType:e.state_type,updateInterval:e.updateinterval});return t.entity_id=void 0,t.updateinterval=void 0,t.outputinitially=void 0,t.outputonchanged=void 0,t.state_type=void 0,t.halt_if=void 0,t.halt_if_type=void 0,t.halt_if_compare=void 0,t.exposeToHomeAssistant=void 0,t.haConfig=void 0,t}}],Oe=[{version:0,up:e=>{const t=Object.assign(Object.assign({},e),{version:0});return void 0===t.templateLocationType&&(t.templateLocation="template",t.templateLocationType="msg"),void 0===t.resultsLocationType&&(t.resultsLocation="payload",t.resultsLocationType="msg"),t}}],xe=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,mode:"out"===e.mode?"set":"listen"})}],Ie=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})}],Ce=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,exposeAsEntityConfig:"",response:""})},{version:2,up:e=>Object.assign(Object.assign({},e),{version:2,mode:"trigger",triggerResponseType:"fixed",responseType:"jsonata",responseTimeout:1e3})}],je=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})}],Re=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,outputProperties:[{property:"payload",propertyType:"msg",value:"",valueType:"eventData"},{property:"topic",propertyType:"msg",value:"",valueType:"triggerId"}]})},{version:2,up:e=>{var t;const i=Object.assign(Object.assign({},e),{version:2,exposeAsEntityConfig:null!==(t=e.exposeAsEntityConfig)&&void 0!==t?t:""});return i.exposeToHomeAssistant=void 0,i.haConfig=void 0,i}}],ke=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,mode:"out"===e.mode?"set":"listen"})}],Ae=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,sunday:!0,monday:!0,tuesday:!0,wednesday:!0,thursday:!0,friday:!0,saturday:!0})},{version:2,up:e=>{const t="jsonata"===e.payloadType&&"$entity().state"===e.payload;return Object.assign(Object.assign({},e),{version:2,outputProperties:[{property:"payload",propertyType:"msg",value:t?"":e.payload,valueType:t?"entityState":e.payloadType},{property:"data",propertyType:"msg",value:"",valueType:"entity"},{property:"topic",propertyType:"msg",value:"",valueType:"triggerId"}],payload:void 0,payloadType:void 0})}},{version:3,up:e=>{const t=Object.assign(Object.assign({},e),{version:3,exposeAsEntityConfig:""});return t.debugenabled=void 0,t.exposeToHomeAssistant=void 0,t.haConfig=void 0,t}},{version:4,up:e=>Object.assign(Object.assign({},e),{version:4,ignorePastDate:!1})}],Pe=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>Object.assign(Object.assign({},e),{version:1,inputs:1,enableInput:!0})},{version:2,up:e=>{var t;const i=Object.assign(Object.assign({},e),{version:2});return"substring"===e.entityidfiltertype&&(null===(t=e.entityid)||void 0===t?void 0:t.includes(","))&&(i.entityidfiltertype="list",i.entityid=e.entityid.split(",").map((e=>e.trim())).filter((e=>e.length>0))),i}},{version:3,up:e=>{const t=Object.assign(Object.assign({},e),{version:3,entityId:e.entityid,entityIdType:e.entityidfiltertype,debugEnabled:e.debugenabled,customOutputs:e.customoutputs,outputInitially:e.outputinitially,stateType:e.state_type,exposeAsEntityConfig:""});return t.entityid=void 0,t.entityidfiltertype=void 0,t.debugenabled=void 0,t.customoutputs=void 0,t.outputinitially=void 0,t.state_type=void 0,t}},{version:4,up:e=>{const t=Object.assign(Object.assign({},e),{version:4});return void 0===e.stateType&&(t.stateType="str"),t}},{version:5,up:e=>{const t=Object.assign(Object.assign({},e),{version:5,entities:[],entityId:void 0,entityIdType:void 0}),i={[le.Entity]:[],[le.Substring]:[],[le.Regex]:[]};switch(e.entityIdType){case"list":i[le.Entity]=e.entityId;break;case"exact":i[le.Entity]=[e.entityId];break;case"substring":i[le.Substring]=[e.entityId];break;case"regex":i[le.Regex]=[e.entityId]}return t.entities=i,t}}],Le=[{version:0,up:e=>{const t=Object.assign(Object.assign({},e),{version:0,entityIdFilterType:e.entityIdFilterType||"exact",timeoutType:e.timeoutType||"num"});return void 0===t.blockInputOverrides&&(t.blockInputOverrides=!0),void 0===t.checkCurrentState&&(t.checkCurrentState=!1),t}},{version:1,up:e=>{var t;const i=Object.assign(Object.assign({},e),{version:1});return"substring"===e.entityIdFilterType&&(null===(t=e.entityId)||void 0===t?void 0:t.includes(","))&&(i.entityIdFilterType="list",i.entityId=e.entityId.split(",").map((e=>e.trim())).filter((e=>e.length>0))),i}},{version:2,up:e=>{const t=Object.assign(Object.assign({},e),{version:2,outputProperties:[],entityLocation:void 0,entityLocationType:void 0});return"none"!==e.entityLocationType&&t.outputProperties.push({property:e.entityLocation,propertyType:e.entityLocationType,value:"",valueType:l.Entity}),t}},{version:3,up:e=>{const t=Object.assign(Object.assign({},e),{version:3,entities:[],entityId:void 0,entityIdFilterType:void 0}),i={[le.Entity]:[],[le.Substring]:[],[le.Regex]:[]};switch(e.entityIdFilterType){case"list":i[le.Entity]=e.entityId;break;case"exact":i[le.Entity]=[e.entityId];break;case"substring":i[le.Substring]=[e.entityId];break;case"regex":i[le.Regex]=[e.entityId]}return t.entities=i,t}}],Ne=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>{const t=Object.assign(Object.assign({},e),{version:1,outputProperties:[{property:"topic",propertyType:"msg",value:"",valueType:"triggerId"}],payloadLocation:void 0,payloadLocationType:void 0,headersLocation:void 0,headersLocationType:void 0});return"none"!==e.payloadLocationType&&t.outputProperties.push({property:e.payloadLocation,propertyType:e.payloadLocationType,value:"",valueType:"data"}),"none"!==e.headersLocationType&&t.outputProperties.push({property:e.headersLocation,propertyType:e.headersLocationType,value:"",valueType:"headers"}),t}},{version:2,up:e=>Object.assign(Object.assign({},e),{version:2,method_post:!0,method_put:!0,method_get:!1,method_head:!1})},{version:3,up:e=>Object.assign(Object.assign({},e),{version:3,exposeAsEntityConfig:""})}],Be=[{version:0,up:e=>Object.assign(Object.assign({},e),{version:0})},{version:1,up:e=>{const t=Object.assign(Object.assign({},e),{version:1,exposeAsEntityConfig:""});return t.exposeToHomeAssistant=void 0,t.haConfig=void 0,t}}];const He={[s.API]:de,[s.BinarySensor]:ce,[s.Action]:pe,[s.Server]:ve,[s.CurrentState]:ye,[s.Device]:ge,[s.DeviceConfig]:he,[s.Entity]:fe,[s.EntityConfig]:me,[s.EventsAll]:be,[s.EventsCalendar]:Te,[s.EventsState]:_e,[s.FireEvent]:$e,[s.GetEntities]:Se,[s.GetHistory]:Ee,[s.Number]:we,[s.PollState]:De,[s.RenderTemplate]:Oe,[s.Select]:xe,[s.Sensor]:Ie,[s.Sentence]:Ce,[s.Switch]:je,[s.TriggerState]:Pe,[s.Tag]:Re,[s.Text]:ke,[s.Time]:Ae,[s.WaitUntil]:Le,[s.Webhook]:Ne,[s.Zone]:Be};function Ve(e){var t;const i=function(e){var t;const i=null!==(t=Me(e))&&void 0!==t?t:[],n=i.reduce(((e,t)=>t.version>e?t.version:e),0);return n}(e.type);if(void 0!==e.version&&e.version>=i)return e;const n=null===(t=function(e,t=-1){const i=Me(e),n=null==i?void 0:i.find((e=>e.version===Number(t)+1));return n}(e.type,e.version))||void 0===t?void 0:t.up;if(n){return Ve(n(e))}return e}function Me(e){return He[e]}const Fe=(e,t)=>{let i;for(i in t)t[i].forEach((t=>{RED.nodes.addLink(Object.assign(Object.assign({},t),{[i]:RED.nodes.node(e)}))}))},qe=()=>{let e;do{e=RED.nodes.id()}while(RED.nodes.node(e));return e},Ge=e=>{const t={source:RED.nodes.getNodeLinks(e.id),target:RED.nodes.getNodeLinks(e.id,1)},i=qe();if(e.g){const t=RED.nodes.node(e.id);t&&RED.group.removeFromGroup(RED.nodes.group(e.g),t)}RED.nodes.remove(e.id),(e=>{var t,i;RED.nodes.import({type:s.EntityConfig,id:e.id,server:e.server,deviceConfig:"",name:`${e.entityType.replace("_"," ")} config for ${e.name||e.id}`,version:RED.settings.get("haEntityConfigVersion",0),entityType:e.entityType,haConfig:null!==(t=e.config)&&void 0!==t?t:[],resend:null!==(i=e.resend)&&void 0!==i&&i})})(e),((e,t)=>{var i,n,o,r,l;let u={id:t,name:e.name,inputs:1,outputs:1,version:0,g:e.g,x:e.x,y:e.y,z:e.z,entityConfig:e.id};switch(e.entityType){case a.BinarySensor:case a.Sensor:u=Object.assign(Object.assign({},u),{type:e.entityType===a.Sensor?s.Sensor:s.BinarySensor,state:null!==(i=e.state)&&void 0!==i?i:"payload",stateType:null!==(n=e.stateType)&&void 0!==n?n:"msg",attributes:null!==(o=e.attributes)&&void 0!==o?o:[],inputOverride:null!==(r=e.inputOverride)&&void 0!==r?r:"allow",outputProperties:"none"===e.outputLocationType?[]:[{property:e.outputLocation,propertyType:e.outputLocationType,value:"",valueType:"data"}]});break;case a.Switch:default:u=Object.assign(Object.assign({},u),{type:s.Switch,outputs:2,outputOnStateChange:null!==(l=e.outputOnStateChange)&&void 0!==l&&l,enableInput:!0,outputProperties:"none"===e.outputPayloadType?[]:[{property:"payload",propertyType:"msg",value:e.outputPayload,valueType:e.outputPayloadType}]})}RED.nodes.import(u)})(e,i),Fe(i,t);const n=RED.nodes.node(i);n&&(RED.nodes.moveNodeToTab(n,e.z),e.g&&RED.group.addToGroup(RED.nodes.group(e.g),n),n.changed=!0),RED.view.redraw(!0)},We=(e,t)=>{const i={source:RED.nodes.getNodeLinks(e.id),target:RED.nodes.getNodeLinks(e.id,1)};if(e.g){const t=RED.nodes.node(e.id);t&&RED.group.removeFromGroup(RED.nodes.group(e.g),t)}RED.nodes.import([{type:s.EntityConfig,id:e.id,server:e.server,deviceConfig:"",name:`exposed as for ${e.name||e.id}`,version:RED.settings.get("haEntityConfigVersion",0),entityType:a.Switch,haConfig:null!=t?t:[],resend:!1}],{importMap:{[e.id]:"replace"}});const n=qe();RED.nodes.import(Object.assign(Object.assign({},e),{id:n,exposeAsEntityConfig:e.id})),Fe(n,i);const o=RED.nodes.node(n);o&&(RED.nodes.moveNodeToTab(o,e.z),e.g&&RED.group.addToGroup(RED.nodes.group(e.g),o),o.changed=!0),RED.view.redraw(!0)};let Je;const ze=[s.Device,s.EventsAll,s.EventsState,s.PollState,s.Tag,s.Time,s.Zone];function Ue(e){const t=RED.nodes.convertNode(e,!1),i=ze.includes(e.type)&&(!0===e.exposeToHomeAssistant||e.type===s.Device&&e.version<1)?t.haConfig:void 0,n=Ve(t);let a;for(a in"type"in n&&n.type===s.Entity?Ge(n):i&&We(n,i),n)void 0===n[a]?delete e[a]:e[a]=n[a];e.changed=!0,RED.editor.updateNodeProperties(e);const o=$("#upgrade-ha-node");return o.is(":visible")&&0===Qe()&&o.hide(),e}function Ke(){const e="home-assistant.ui.migrations",t=p(`${e}.button_ok`),i=p(`${e}.button_cancel`);$("#ha-dialog-confirm").dialog({resizable:!1,height:"auto",width:400,modal:!0,buttons:{[t]:function(){$(this).dialog("close"),function(){const e=[],t=t=>{Xe(t)&&!Ze(t)&&e.push(t)};RED.nodes.eachNode(t),RED.nodes.eachConfig(t),e.forEach((e=>Ue(e))),RED.nodes.dirty(!0),RED.notify(p("home-assistant.ui.migrations.all_nodes_updated")),RED.view.redraw()}()},[i]:function(){$(this).dialog("close")}}})}function Ze(e){const t=RED.settings.get(`${e.type.split("-").reduce(((e,t,i)=>e.concat(`${i?t[0].toUpperCase():t[0]}${t.slice(1)}`)),[]).join("")}Version`,-1);const i=Ye(e)&&void 0===e.version?e._def.defaults.version.value:e.version;return void 0!==i&&i>=t}function Xe(e){const t=RED.nodes.registry.getNodeSetForType(e.type);return"node-red-contrib-home-assistant-websocket"===(null==t?void 0:t.module)}function Ye(e){return(null==e?void 0:e.type)&&[s.Server,s.EntityConfig,s.DeviceConfig].includes(e.type)}function Qe(){let e=0;const t=t=>{Xe(t)&&!Ze(t)&&e++};return RED.nodes.eachNode(t),RED.nodes.eachConfig(t),e}function et(e,t,i,n){return new(i||(i=Promise))((function(a,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,r)}l((n=n.apply(e,t||[])).next())}))}function tt(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function it(e,t,i,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,i):a?a.value=i:t.set(e,i),i}let nt,at,ot;"function"==typeof SuppressedError&&SuppressedError;let st=!1;function rt(e,t,i){nt=$(t),ot=e,ot.server||function(){let e;RED.nodes.eachConfig((t=>(t.type!==s.Server||e||(e=t.id),!0))),e&&nt.val(e)}(),at=nt.val(),setTimeout((()=>{nt.on("change",(()=>{at=nt.val(),null==i||i(at)}))}),500)}function lt(e,t){let i=nt.val();(ot.server||i&&"_ADD_"!==i)&&(at=ot.server||i,ut(e,t)),nt.on("change",(()=>{at=nt.val(),at!==i&&(i=at,ut(e,t))}))}function ut(e,t){"_ADD_"!==at&&$.getJSON(`homeassistant/${e}/${at}`).done((e=>{t(e)})).fail((e=>{503===e.status&&!1===st&&(st=!0,RED.notify(ot._("config-server.errors.server_deploy")),setTimeout((()=>st=!1),2e3))}))}function pt(e,t,{params:i={}}){let n=`homeassistant/${t}/${nt.val()}`;$.isEmptyObject(i)||(n+=`?${$.param(i)}`),$.getJSON(n).done((t=>{e(t)}))}function dt(e,t={}){let i=`homeassistant/${e}/${nt.val()}`;return $.isEmptyObject(t)||(i+=`?${$.param(t)}`),new Promise(((e,t)=>{$.getJSON(i).done((t=>e(t))).fail((e=>t(e)))}))}const ct=e=>S(at,e),vt=()=>function(e){var t;return null!==(t=b[e])&&void 0!==t?t:[]}(at),yt=()=>Object.values(function(e){var t;return null!==(t=g[e])&&void 0!==t?t:{}}(at)),gt=()=>function(e){var t;return null!==(t=h[e])&&void 0!==t?t:[]}(at),ht=()=>function(e){var t;return null!==(t=f[e])&&void 0!==t?t:[]}(at),ft=()=>function(e){var t;return null!==(t=m[e])&&void 0!==t?t:{}}(at),mt=()=>{const e=RED.nodes.node(at);return{areaSelector:null==e?void 0:e.areaSelector,deviceSelector:null==e?void 0:e.deviceSelector,entitySelector:null==e?void 0:e.entitySelector,status:{separator:null==e?void 0:e.statusSeparator,year:null==e?void 0:e.statusYear,month:null==e?void 0:e.statusMonth,day:null==e?void 0:e.statusDay,hourCycle:null==e?void 0:e.statusHourCycle,timeFormat:null==e?void 0:e.statusTimeFormat}}};var bt,Tt;!function(e){e.Config="config",e.HomeAssistant="home_assistant",e.HomeAssistantDeprecated="home_assistant_deprecated",e.HomeAssistantEntities="home_assistant_entities"}(bt||(bt={})),function(e){e.Action="#46B1EF",e.Alpha="#E78BB9",e.Api="#7CDFFD",e.Beta="#77DD77",e.Data="#5BCBF7",e.Deprecated="#A6BBCF",e.Event="#399CDF",e.HaBlue="#41BDF5"}(Tt||(Tt={}));var _t,$t,St={alphaWarning:e=>$.parseHTML(`\n <div class="ui-state-error ha-alpha-box">\n Alpha version: At this point anything could change or not work.\n <br />\n Found an issue? Post it in\n <a\n href="https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues"\n target="_blank"\n rel="noreferrer"\n >\n issues\n </a>\n . Have questions or comments? Post them\n <a\n href="https://github.com/zachowj/node-red-contrib-home-assistant-websocket/discussions/${e}"\n target="_blank"\n rel="noreferrer"\n >\n here\n </a>\n .\n </div>\n `),betaWarning:e=>$.parseHTML(`\n <div class="ui-state-error ha-beta-box">\n Beta version: Config should be stable and hopefully not too many bugs.\n <br />\n Found an issue? Post it in\n <a\n href="https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues"\n target="_blank"\n rel="noreferrer"\n >\n issues\n </a>\n . Have questions or comments? Post them\n <a\n href="https://github.com/zachowj/node-red-contrib-home-assistant-websocket/discussions/${e}"\n target="_blank"\n rel="noreferrer"\n >\n here\n </a>\n .\n </div>\n `),labelStyle:function(){const e=[];return Ze(this)||e.push("ha-node-label-legacy"),this.name&&e.push("node_label_italic"),e.join(" ")},setup:e=>{$("#dialog-form, #node-config-dialog-edit-form").addClass("home-assistant"),function(e){Xe(e)&&!Ze(e)&&(Ye(e=Ue(e))||RED.events.on("editor:close",(function t(){RED.events.off("editor:close",t),RED.editor.edit(e)})),RED.nodes.dirty(!0),RED.tray.close(),RED.notify(p("home-assistant.ui.migrations.node_schema_updated")))}(e)}};const Et=null===($t=null===(_t=null===Intl||void 0===Intl?void 0:Intl.DateTimeFormat())||void 0===_t?void 0:_t.resolvedOptions())||void 0===$t?void 0:$t.locale,wt={month:"short",day:"numeric",hour:"numeric",minute:"numeric"};var Dt;!function(e){e.Id="id",e.FriendlyName="friendlyName"}(Dt||(Dt={}));const Ot={category:bt.Config,defaults:{name:{value:"Home Assistant",required:!1},version:{value:RED.settings.get("serverVersion",0)},addon:{value:!1},rejectUnauthorizedCerts:{value:!0},ha_boolean:{value:"y|yes|true|on|home|open"},connectionDelay:{value:!0},cacheJson:{value:!0},heartbeat:{value:!1},heartbeatInterval:{value:30,validate:function(e){return!$("#node-config-input-heartbeat").is(":checked")||RED.validators.number()(e)&&Number(e)>=10}},areaSelector:{value:Dt.FriendlyName},deviceSelector:{value:Dt.FriendlyName},entitySelector:{value:Dt.FriendlyName},statusSeparator:{value:": "},statusYear:{value:"hidden"},statusMonth:{value:"short"},statusDay:{value:"numeric"},statusHourCycle:{value:"default"},statusTimeFormat:{value:"h:m"},enableGlobalContextStore:{value:!1}},credentials:{host:{type:"text"},access_token:{type:"text"}},icon:"font-awesome/fa-home",label:function(){return this.name||"Home Assistant"},oneditprepare:function(){St.setup(this);const e=$("#node-config-input-addon"),t=$("#node-config-input-host");!1===this.rejectUnauthorizedCerts&&$("#accept_unauthorized_certs").prop("checked",!0);function i(){$("#server-info").toggle(!e.prop("checked")),$(".addon").toggle(e.prop("checked"))}["http://hassio/homeassistant","http://supervisor/core"].includes(t.val())&&e.prop("checked",!0),i(),e.on("click",(function(){i()}));try{t.autocomplete("destroy")}catch(e){}const n=$("#discoverInstances");n.on("click",(function(){if($(this).hasClass("disabled"))return;const e=$("i",this).removeClass("fa-search").addClass("spinner");n.addClass("disabled"),t.autocomplete({source:(e,t)=>{$.ajax({dataType:"json",url:"/homeassistant/discover",cache:!1}).done((e=>{t(e)}))},minLength:0,response:()=>{e.addClass("fa-search").removeClass("spinner"),n.removeClass("disabled")},close:()=>t.autocomplete("destroy")}).autocomplete("search","")})),$("#node-config-input-heartbeat").on("change",(function(){$("#heartbeatIntervalRow").toggle(this.checked)})),$("#node-config-input-statusHourCycle").on("change",(function(){const e={hour:"numeric",minute:"numeric"},t=$(this).val();t&&"default"!==t&&(e.hourCycle=t),$("#node-config-input-statusTimeFormat").children().each((function(){const t=$(this);switch(t.val()){case"h:m:s":e.second="numeric";break;case"h:m:s.ms":e.second="numeric",e.fractionalSecondDigits=3}const i=function({date:e=new Date,locale:t=(null!=Et?Et:"en-US"),options:i=wt}){return new Intl.DateTimeFormat(t,i).format(e)}({date:new Date(2022,1,1,3,4,5,6),options:e});t.text(i)}))})).trigger("change")},oneditsave:function(){const e=$("#node-config-input-addon").is(":checked"),t=$("#node-config-input-host").val();if(e)this.addon=!0,this.rejectUnauthorizedCerts=!0;else{const e=document.createElement("a");e.href=t,t===e.origin||/^\$\{[a-zA-Z_][a-zA-Z0-9_]*\}$/.test(t)||RED.notify("Invalid format of Base URL: "+t),this.rejectUnauthorizedCerts=!$("#accept_unauthorized_certs").prop("checked"),this.connectionDelay=!1}}};function xt(e,t){const i=[],n=mt().deviceSelector===Dt.Id,a=mt().entitySelector===Dt.Id;switch(t){case le.Floor:e.floors.forEach((e=>{i.push({label:e.name,value:e.floor_id,alias:[e.floor_id]})}));break;case le.Area:e.areas.forEach((e=>{i.push({label:e.name,value:e.area_id,alias:[e.area_id]})}));break;case le.Device:e.devices.forEach((e=>{const t=n?e.id:e.name_by_user||e.name;i.push({label:t,value:e.id,description:ct(e.area_id),alias:[e.id]})}));break;case le.Entity:e.entities.forEach((e=>{var t,n;const o=a?e.entity_id:(null===(t=e.attributes)||void 0===t?void 0:t.friendly_name)||e.entity_id,s=a?null===(n=e.attributes)||void 0===n?void 0:n.friendly_name:e.entity_id;i.push({label:o,value:e.entity_id,description:s})}));break;case le.Label:e.labels.forEach((e=>{i.push({label:e.name,value:e.label_id,alias:[e.label_id]})}))}return i.sort(((e,t)=>{var i,n;return(null!==(i=e.label)&&void 0!==i?i:e.value).localeCompare(null!==(n=t.label)&&void 0!==n?n:t.value)}))}function It(e,t,i){const n=$("<div>",{class:"virtual-select",style:"flex:1;"});return VirtualSelect.init(Object.assign({ele:n[0],hideClearButton:!0,search:!0,maxWidth:"100%",options:xt(e,t),placeholder:"",allowNewOption:!0,optionsCount:6,selectedValue:i},function(e){switch(e){case le.Device:case le.Entity:return{hasOptionDescription:!0};case le.Area:case le.Floor:case le.Label:default:return{}}}(t))),n}function Ct(e,t,i,n,a){const o=$("<div>",{class:"id-selector-row"}).html(i),s=$("<div>",{class:"id-selector-wrapper"});switch(i){case le.Floor:case le.Area:case le.Device:case le.Entity:case le.Label:It(a,i,n).appendTo(s),function(e){return $("<a>",{href:"#",class:"red-ui-button",style:"margin-left: 10px;",title:p("home-assistant.component.id-selector.label.copy")}).on("click",(function(t){t.preventDefault();const i=e.find(".virtual-select");if(0===i.length)return;const n=i[0].value;n&&RED.clipboard.copyText(n)&&RED.notify(p("home-assistant.ui.notifications.clipboard_copy"),{type:"success",timeout:2e3})})).append($("<i>",{class:"fa fa-copy"}))}(t).appendTo(s);break;case le.Substring:case le.Regex:(function(e){return $("<input>",{type:"text",class:"id-selector-regex",css:{flex:1},value:e})})(n).appendTo(s),function(e,t){return $("<a>",{href:"#",class:"red-ui-button",style:"margin-left: 10px;",title:p("home-assistant.component.id-selector.label.preview")}).on("click",(function(i){i.preventDefault();const n=e.find("input"),a=n.val();"string"!=typeof a||t!==le.Substring&&t!==le.Regex||C({filter:a,filterType:t,entities:yt(),complete:e=>{n.val(e)}})})).append($("<i>",{class:"fa fa-eye"}))}(t,i).appendTo(s)}return function(e,t){return $("<a>",{href:"#",class:"red-ui-button id-delete-button",style:"margin-left: 10px;",title:p("home-assistant.component.id-selector.label.delete")}).on("click",(i=>{i.preventDefault();const n=t.data("data"),a=t.closest("li");a.addClass("red-ui-editableList-item-deleting"),a.fadeOut(200,(()=>{e.editableList("removeItem",n)}));const o=t.find(".virtual-select");o.length&&o[0].destroy()})).append($("<i>",{class:"fa fa-remove"}))}(e,t).appendTo(s),[o,s]}function jt(e,t){e.includes(t)||e.push(t)}function Rt(e,t){return 0===t.length||function(e,t){return t.some((t=>Array.isArray(t)?t.every((t=>0!=(e&t))):0!=(e&t)))}(e,t)}var kt,At,Pt,Lt,Nt,Bt,Ht,Vt,Mt;class Ft{constructor({types:e,element:t,headerText:i,filter:n}){kt.add(this),At.set(this,void 0),Pt.set(this,void 0),Lt.set(this,void 0),Nt.set(this,void 0),Bt.set(this,void 0),it(this,Lt,e,"f"),it(this,At,$(t),"f"),it(this,Pt,i,"f"),it(this,Nt,null!=n?n:[],"f"),it(this,Bt,tt(this,kt,"m",Ht).call(this),"f"),this.init()}init(){tt(this,At,"f").addClass("id-selector"),tt(this,At,"f").editableList({addButton:!1,height:"auto",header:$("<div>").append(tt(this,Pt,"f")),addItem:(e,t,i)=>{Ct(tt(this,At,"f"),e,i.type,i.value,tt(this,Bt,"f")).forEach((t=>e.append(t)))},buttons:tt(this,kt,"m",Mt).call(this)})}addId(e,t){tt(this,At,"f").editableList("addItem",{type:e,value:t})}clear(){tt(this,At,"f").find(".id-delete-button").trigger("click")}refreshOptions(){const e=this;tt(this,At,"f").editableList("items").each((function(){const t=$(this),{type:i}=t.data("data");if(!qt(i))return;const n=t.find(".virtual-select");if(n.length){const t=xt(tt(e,Bt,"f"),i);n[0].setOptions(t,!0)}}))}updateFilter(e){it(this,Nt,e,"f"),it(this,Bt,tt(this,kt,"m",Ht).call(this),"f"),this.refreshOptions()}}function qt(e){return Object.values(le).includes(e)}function Gt(e){const t=$(e).editableList("items"),i={[le.Floor]:new Set,[le.Area]:new Set,[le.Device]:new Set,[le.Entity]:new Set,[le.Label]:new Set,[le.Substring]:new Set,[le.Regex]:new Set};return t.each((function(){const{type:e}=$(this).data("data");if(!qt(e))return;let t="";switch(e){case le.Entity:case le.Device:case le.Area:case le.Floor:case le.Label:t=$(this).find(".virtual-select")[0].value;break;case le.Substring:case le.Regex:t=$(this).find(".id-selector-regex").val();break}t.length&&i[e].add(t)})),{[le.Floor]:Array.from(i[le.Floor]),[le.Area]:Array.from(i[le.Area]),[le.Device]:Array.from(i[le.Device]),[le.Entity]:Array.from(i[le.Entity]),[le.Label]:Array.from(i[le.Label]),[le.Substring]:Array.from(i[le.Substring]),[le.Regex]:Array.from(i[le.Regex])}}At=new WeakMap,Pt=new WeakMap,Lt=new WeakMap,Nt=new WeakMap,Bt=new WeakMap,kt=new WeakSet,Ht=function(){var e;const t=vt(),i=yt(),n=w(at),a=E(at),o=gt(),s=ht();if(0===tt(this,Nt,"f").length)return{entities:i,devices:n,areas:a,floors:o,labels:s};const r=[],l=[],u=[],p=[],d=[];for(const c of tt(this,Nt,"f")){const{integration:v,domain:y,device_class:g,supported_features:h}=c;for(const c of i){const i=t.find((e=>e.entity_id===c.entity_id));if(v&&(null==i?void 0:i.platform)!==v)continue;const f=c.entity_id.split(".")[0];if((null==y?void 0:y.length)&&!y.includes(f))continue;if((null==g?void 0:g.length)&&void 0!==c.attributes.device_class&&!g.includes(c.attributes.device_class))continue;if(void 0!==h&&void 0!==c.attributes.supported_features&&!Rt(c.attributes.supported_features,h))continue;if(r.push(c),!i)continue;const m=e=>{for(const t of e){const e=s.find((e=>e.label_id===t));e&&jt(d,e)}};let b,T;i.labels.length&&m(i.labels),i.device_id&&(b=n.find((e=>e.id===i.device_id)),b&&(jt(l,b),m(b.labels)));const _=null!==(e=i.area_id)&&void 0!==e?e:null==b?void 0:b.area_id;if(_&&(T=a.find((e=>e.area_id===_)),T&&(jt(u,T),m(T.labels))),null==T?void 0:T.floor_id){const e=o.find((e=>e.floor_id===(null==T?void 0:T.floor_id)));e&&jt(p,e)}}}return{entities:r,devices:l,areas:u,floors:p,labels:d}},Vt=function(e){return{label:p(`home-assistant.component.id-selector.label.add-button.${e}`),icon:"fa fa-plus",class:"red-ui-editableList-add",click:()=>{tt(this,At,"f").editableList("addItem",{type:e})}}},Mt=function(){return tt(this,Lt,"f").map((e=>tt(this,kt,"m",Vt).call(this,e)))};const Wt="#custom-outputs";let Jt,zt=[];const Ut={config:{value:"config",label:"config.",hasValue:!0},deviceId:{value:"deviceId",label:"device id",hasValue:!1},entity:{value:"entity",label:"entity",hasValue:!1},entityId:{value:"triggerId",label:"entity id",hasValue:!1},entityState:{value:"entityState",label:"entity state",hasValue:!1},eventData:{value:"eventData",label:"event data",hasValue:!1},headers:{value:"headers",label:"headers",hasValue:!1},params:{value:"params",label:"params",hasValue:!1},prevEntity:{value:"prevEntity",label:"previous entity",hasValue:!1},previousValue:{value:"previousValue",label:"previous value",hasValue:!1},results:{value:"results",label:"results",hasValue:!1},receivedData:{value:"data",label:"received data",hasValue:!1},sentData:{value:"data",label:"sent data",hasValue:!1},tagId:{value:"triggerId",label:"tag id",hasValue:!1},timeSinceChangedMs:{value:"timeSinceChangedMs",label:"timeSinceChangedMs",hasValue:!1},triggerId:{value:"triggerId",label:"trigger id",hasValue:!1},value:{value:"value",label:"value",hasValue:!1},calendarItem:{value:"calendarItem",label:"calendar item",hasValue:!1}},Kt=[Ut.config,l.Flow,l.Global,l.String,l.Number,l.Boolean,l.Date,l.JSONata];function Zt(e=[],{element:t=Wt,extraTypes:i=[]}={}){Jt=$(t),zt=i,Jt.editableList({addButton:!0,removable:!0,sortable:!0,height:"auto",header:$("<div>").append(p("home-assistant.label.output_properties")),addItem:function(e,t,i){e.css({overflow:"hidden",whiteSpace:"nowrap"});const n=$("<div />").appendTo(e),a=$("<input/>",{class:"property-name",type:"text"}).css("width","30%").appendTo(n).typedInput({types:[l.Message,l.Flow,l.Global]});$("<div/>",{style:"display:inline-block; padding:0px 6px;"}).text("=").appendTo(n);const o=$("<input/>",{class:"property-value",type:"text"}).css("width","calc(70% - 30px)").appendTo(n).typedInput({default:"str",types:Xt()});i.property&&a.typedInput("value",i.property),i.propertyType&&a.typedInput("type",i.propertyType),i.value&&o.typedInput("value",i.value),i.valueType&&o.typedInput("type",i.valueType)}}),Jt.editableList("addItems",e)}function Xt(){let e=zt.reduce(((e,t)=>t in Ut?[...e,Ut[t]]:e),[]);if(e=[...e,...Kt],zt.includes(l.Message)){const t=e.indexOf(l.Flow);e.splice(t,0,l.Message)}return e}function Yt(){const e=$(Wt).editableList("items"),t=[];return e.each((function(){const e=$(this).find(".property-name"),i=$(this).find(".property-value"),n=e.typedInput("value"),a=e.typedInput("type"),o=i.typedInput("value"),s=i.typedInput("type");t.push({property:n,propertyType:a,value:o,valueType:s})})),t}function Qt(e){return void 0===e||Array.isArray(e)&&!e.some((e=>0===e.property.length))}const ei={target:"_blank",ref:"noopener noreferrer",class:"social-bar-button"},ti=p("home-assistant.ui.text.documentation");const ii=p("home-assistant.ui.text.discord");const ni=p("home-assistant.ui.text.discussions");function ai(e){const t=$("<div>",{id:"ha-social-bar"});t.append($("<span>",{text:p("home-assistant.ui.text.looking_for_help")})).append(function(e){return $("<a>",Object.assign({href:"https://zachowj.github.io/node-red-contrib-home-assistant-websocket/"+(e?`node/${e}.html`:""),title:ti,text:ti},ei))}(e)).append($("<span>").text(" / ")).append($("<a>",Object.assign({href:"https://github.com/zachowj/node-red-contrib-home-assistant-websocket/discussions",title:ni,text:ni},ei))).append($("<span>").text(" / ")).append($("<a>",Object.assign({href:"https://discord.gg/QNdsZgNBnU",title:"Discord",text:ii},ei))),$("#dialog-form").prepend(t)}function oi(){const e=$("#ha-action").val(),[t,i]=e.toLowerCase().split(".");return[t,i]}function si(e){return Object.keys(e).sort().reduce(((t,i)=>(Object.keys(e[i]).sort().forEach((n=>{t.push({value:`${i}.${n}`,label:`${i}.${n}`,description:e[i][n].description})})),t)),[])}const ri=()=>{var e;const t=$("#service-data-desc"),i=$(".service-description",t),n=$("tbody",t),a=$(".unknown-service",t),o=$(".known-service",t),s=$("#example-data"),[r,l]=oi(),u=ft(),p=null===(e=null==u?void 0:u[r])||void 0===e?void 0:e[l];if(p){const e=p.description?p.description:"No description provided by home assistant",t=p.fields,u=Object.keys(t).reduce(((e,i)=>{var n,a;const o=t[i];return o.description||o.example?(e.push(`<tr><td><code>${i}</code></td><td>${null!==(n=t[i].description)&&void 0!==n?n:""}</td><td>${null!==(a=t[i].example)&&void 0!==a?a:""}</td></tr>`),e):e}),[]);i.html(e),$("#service-data-desc .title").html(`${r}.${l}`),u.length?($("#service-data-table").show(),s.show(),n.html(u.length>0?u.join(""):"")):($("#service-data-table").hide(),s.hide(),i.append("<p>No fields documented by Home Assistant<p>")),a.hide(),o.show()}else a.show(),o.hide(),s.hide(),$("#service-data-desc .title").html("")},li=()=>{var e;const t=$("#node-input-data"),[i,n]=oi(),a=$("#node-input-server").val();if(i&&n&&a){const a=ft(),o=null===(e=null==a?void 0:a[i])||void 0===e?void 0:e[n];if(o){const e=o.fields,i=Object.keys(e).reduce(((t,i)=>{const n=e[i].example;if("entity_id"===i)return t[i]=null!=n?n:"",t;if(void 0===n)return t;if("string"==typeof n)if("["===n[0]&&"]"===n[n.length-1])try{t[i]=JSON.parse(n)}catch(e){}else'"'===n[0]&&'"'===n[n.length-1]?t[i]=n.substring(1,n.length-1):t[i]=n;else"number"!=typeof n||isNaN(n)?n&&(t[i]=n):t[i]=Number(n);return t}),{});Object.keys(i).length&&t.typedInput("value",JSON.stringify(i))}}};var ui;function pi(e){return{integration:e.integration,domain:Array.isArray(e.domain)?e.domain:e.domain?[e.domain]:void 0,device_class:Array.isArray(e.device_class)?e.device_class:e.device_class?[e.device_class]:void 0,supported_features:e.supported_features}}function di(){var e,t;const i=ft(),[n,a]=oi(),o=null===(t=null===(e=null==i?void 0:i[n])||void 0===e?void 0:e[a])||void 0===t?void 0:t.target;return o?function(e){return e.entity?Array.isArray(e.entity)?e.entity.map(pi):[pi(e.entity)]:[]}(o):[]}!function(e){e.All="all",e.None="none"}(ui||(ui={}));const ci={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:1,outputs:1,icon:"ha-call-service.svg",align:"right",paletteLabel:"action",label:function(){return this.name||this.action||"action"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("apiCallServiceVersion",0)},debugenabled:{value:!1},action:{value:""},floorId:{value:[]},areaId:{value:[]},deviceId:{value:[]},entityId:{value:[]},labelId:{value:[]},data:{value:"",validate:RED.validators.typedInput({type:"dateType",allowBlank:!0})},dataType:{value:l.JSONata},mergeContext:{value:""},mustacheAltTags:{value:!1},outputProperties:{value:[],validate:Qt},queue:{value:"none"},blockInputOverrides:{value:!0},domain:{value:""},service:{value:""},target:{value:void 0},output_location:{value:void 0},output_location_type:{value:void 0},service_domain:{value:void 0},mergecontext:{value:void 0}},oneditprepare:function(){St.setup(this);const e=$("#ha-action");let t="";rt(this,"#node-input-server",(function(n){if(n===t)return;t=n,ri(),i.refreshOptions();const a=ft();e[0].setOptions(si(a))})),VirtualSelect.init({ele:"#ha-action",allowNewOption:!0,search:!0,maxWidth:"70%",placeholder:"",selectedValue:this.action,silentInitialValueSet:!0,hasOptionDescription:!0,options:si(ft()),optionsCount:8});const i=new Ft({element:"#target-list",types:[le.Entity,le.Device,le.Area,le.Floor,le.Label],headerText:p("ha-action.label.targets"),filter:di()}),n={[le.Floor]:this.floorId,[le.Area]:this.areaId,[le.Device]:this.deviceId,[le.Entity]:this.entityId,[le.Label]:this.labelId};Object.entries(n).forEach((([e,t])=>{null==t||t.forEach((t=>{i.addId(e,t)}))})),e.on("change",(()=>{ri(),i.updateFilter(di());const t=function(e){var t,i,n;if(/{{(?:(?!}}).+)}}/g.test(e))return ui.All;const a=ft(),[o,s]=oi();return 0!==Object.keys(a).length&&(null===(t=null==a?void 0:a[o])||void 0===t?void 0:t[s])&&void 0===(null===(n=null===(i=null==a?void 0:a[o])||void 0===i?void 0:i[s])||void 0===n?void 0:n.target)?ui.None:ui.All}(e.val())===ui.All;$("#target-list").parents(".form-row").toggle(t),t||i.clear()})).trigger("change");const a=$("#node-input-data"),o=$("#node-input-dataType");a.typedInput({default:l.JSONata,types:[l.JSONata,l.JSON],typeField:"#node-input-dataType"}),a.on("change",(()=>{$("#mustacheAltTags").toggle(o.val()===l.JSON)})),Zt(this.outputProperties,{extraTypes:["sentData","results","msg"]}),$("#example-data").on("click",li),ai("action")},oneditsave:function(){this.action=$("#ha-action").val(),-1!==this.action.indexOf(".")&&([this.domain,this.service]=this.action.split("."));const e=Gt("#target-list");this.floorId=e[le.Floor],this.areaId=e[le.Area],this.deviceId=e[le.Device],this.entityId=e[le.Entity],this.labelId=e[le.Label],this.outputProperties=Yt()}};var vi,yi;!function(e){e.Delete="delete",e.Get="get",e.Post="post",e.Put="put"}(vi||(vi={})),function(e){e.Http="http",e.Websocket="websocket"}(yi||(yi={}));const gi={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:1,outputs:1,icon:"font-awesome/fa-paper-plane-o",paletteLabel:"API",label:function(){return this.name||"API"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haApiVersion",0)},debugenabled:{value:!1},protocol:{value:yi.Websocket},method:{value:vi.Get},path:{value:""},data:{value:"",validate:RED.validators.typedInput({type:"dateType",allowBlank:!0})},dataType:{value:l.JSONata},responseType:{value:"json"},outputProperties:{value:[{property:"payload",propertyType:l.Message,value:"",valueType:"results"}],validate:Qt},location:{value:void 0},locationType:{value:void 0}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),$("#node-input-data").typedInput({types:[l.JSONata,l.JSON],typeField:"#node-input-dataType"}),$("#node-input-protocol").on("change",(function(){const e=$(this).val()===yi.Http;$(".http").toggle(e),$("#node-input-method").trigger("change")})).trigger("change"),$("#node-input-method").on("change",(function(){const e=$("#node-input-method").val(),t=$("#node-input-protocol").val()===yi.Http&&[vi.Get,vi.Delete].includes(e)?"parameters":"data";$("#data-label").text(p(`ha-api.label.${t}`))})),$("#node-input-location").typedInput({types:[l.Message,l.Flow,l.Global,{value:"none",label:"None",hasValue:!1}],typeField:"#node-input-locationType"}),Zt(this.outputProperties,{extraTypes:["results"]}),ai("API")},oneditsave:function(){this.outputProperties=Yt()}},hi="node-red-contrib-home-assistant-websocket/all:ha-entity-config.data.label",fi=(e,t,i)=>$("<input />",{type:"text",name:"value",value:t,id:e,"data-property":i.id}).attr("autocomplete","off"),mi=(e,t)=>{const i=`ha-config-${t.id}`,n=$("<div />",{class:"form-row ha-config-row","data-type":t.type}),a=RED._(`${hi}.${t.id}`),o=$("<label>",{for:i}).text(a);switch(n.append(o," "),t.type){case"date":n.append(((e,t,i)=>$("<input />",{type:"date",name:"value",value:t,id:e,"data-property":i.id}))(i,e,t));break;case"datetime":n.append(((e,t,i)=>{const n=new Date(t),a=e=>e<10?"0"+e:e,o=t?`${n.getFullYear()}-${a(n.getMonth()+1)}-${a(n.getDate())}T${a(n.getHours())}:${a(n.getMinutes())}`:"";return $("<input />",{type:"datetime-local",name:"value",value:o,id:e,"data-property":i.id})})(i,e,t));break;case"editableList":o.css({verticalAlign:"top"}),n.append(((e,t,i)=>{const n=$("<ol />",{id:e}),a=$("<div />",{style:"width: 70%;display: inline-block;"}).append(n);return n.editableList({addButton:!0,removable:!0,sortable:!0,height:"auto",addItem:function(e,t,i){$("<input />",{type:"text",value:"string"==typeof i?i:"",style:"width: 95%"}).appendTo(e)}}),n.editableList("addItems",Array.isArray(t)?t:i),a})(i,e,t.values));break;case"number":n.append(((e,t,i)=>$("<input />",{type:"number",name:"value",value:t,id:e,"data-property":i.id}).attr("autocomplete","off"))(i,e,t));break;case"select":n.append(((e,t,i)=>{const n=$("<select />",{name:"value",id:e,style:"width: 70%","data-property":i.id}),a=`${hi}.${i.id}_options`;return i.values.forEach((e=>{$("<option />",{value:e,text:e?RED._(`${a}.${e}`):"",selected:e===t}).appendTo(n)})),n})(i,e,t));break;case"unit_of_measurement":n.append(((e,t,i)=>{const n=$("#ha-config-device_class").val(),a=i.values[n];if(""===n||null===a)return fi(e,t,i);const o=$("<select />",{name:"value",id:e,style:"width: 70%","data-property":i.id});return a.forEach((e=>{$("<option />",{value:e,text:e,selected:e===t}).appendTo(o)})),o})(i,e,t));break;case"string":n.append(fi(i,e,t))}return n},bi=(e,t="entityConfig")=>{$(`#node-input-btn-${t}-add`).on("click",(function(){$("body").data("haEntityType",e)})),$(`#node-input-lookup-${t}`).on("click",(function(){"_ADD_"===$(`#node-input-${t}`).val()&&$("body").data("haEntityType",e)}))},Ti=["msg","flow","global","jsonata","str","num","bool"],_i=["str","num","bool","date","jsonata","msg","flow","global"],$i={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:1,outputs:1,icon:"font-awesome/fa-check-circle-o",align:"right",paletteLabel:"binary sensor",label:function(){return this.name||"binary sensor"},labelStyle:St.labelStyle,defaults:{name:{value:""},entityConfig:{value:"",type:s.EntityConfig,filter:e=>"binary_sensor"===e.entityType,required:!0},version:{value:RED.settings.get("haBinarySensorVersion",0)},state:{value:"payload"},stateType:{value:"msg"},attributes:{value:[]},inputOverride:{value:"allow"},outputProperties:{value:[],validate:Qt}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),H(this);$("#node-input-state").typedInput({types:Ti,typeField:"#node-input-stateType",type:this.stateType}),bi(a.BinarySensor),$("#attributes").editableList({removable:!0,addButton:"add attribute",header:$("<div>").append($.parseHTML("<div style='width:40%; display: inline-grid'>Attribute Key</div><div style='display: inline-grid'>Value</div>")),addItem:function(e,t,i){const n=$("<div />").appendTo(e);$("<input />",{type:"text",name:"property",style:"width: 40%;margin-right: 5px;"}).attr("autocomplete","disable").appendTo(n).val(i.property);const a=$("<input />",{type:"text",name:"value",style:"width: 55%;"}).appendTo(n).val(i.value);a.typedInput({types:_i}),a.typedInput("type",i.valueType)}}).editableList("addItems",this.attributes),Zt(this.outputProperties,{extraTypes:["sentData"]}),ai("binary-sensor")},oneditsave:function(){this.attributes=[];const e=this;$("#attributes").editableList("items").each((function(){const t=$(this);e.attributes.push({property:t.find("input[name=property]").val(),value:t.find("input[name=value]").typedInput("value"),valueType:t.find("input[name=value]").typedInput("type")})})),this.outputProperties=Yt()}},Si={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:0,outputs:1,icon:"font-awesome/fa-hand-o-up",align:"left",paletteLabel:"button",label:function(){return this.name||"button"},labelStyle:St.labelStyle,defaults:{name:{value:""},version:{value:RED.settings.get("haButtonVersion",0)},debugenabled:{value:!1},outputs:{value:1},entityConfig:{value:"",type:s.EntityConfig,filter:e=>"button"===e.entityType,required:!0},outputProperties:{value:[{property:"payload",propertyType:"msg",value:"",valueType:"entityState"},{property:"topic",propertyType:"msg",value:"",valueType:"triggerId"},{property:"data",propertyType:"msg",value:"",valueType:"entity"}],validate:Qt}},oneditprepare:function(){St.setup(this),H(this),bi(a.Button),Zt(this.outputProperties,{extraTypes:["entity","entityState","entityId"]}),ai("button")},oneditsave:function(){this.outputProperties=Yt()}},Ei={serverId:"#node-input-server",type:"entities"};function wi({root:e,options:t}){const i=(n=e)&&(n instanceof jQuery||n.constructor.prototype.jquery)?e:$(e);var n;const a=Object.assign(Object.assign({},Ei),t),o=$(a.serverId).val(),s=a.type;i.autocomplete({source:(e,t)=>{const i=e.term.toLowerCase(),n=function(e,t){let i=[];switch(t){case"entities":{if(!(e in g))return[];const t="attributes.friendly_name";i=Object.values(g[e]).map((e=>({value:e.entity_id,label:c(t,e)||e.entity_id}))).sort(_);break}case"properties":if(!(e in g))return[];i=Object.values(g[e]).map((e=>({value:e.entity_id,label:e.state}))).sort(_);break;case"trackers":{if(!(e in g))return[];const t="attributes.friendly_name";i=Object.values(g[e]).filter((e=>e.entity_id.startsWith("person.")||e.entity_id.startsWith("device_tracker."))).map((e=>({value:e.entity_id,label:c(t,e)||e.entity_id}))).sort(_);break}case"zones":{if(!(e in g))return[];const t="attributes.friendly_name";i=Object.values(g[e]).filter((e=>e.entity_id.startsWith("zone."))).map((e=>({value:e.entity_id,label:c(t,e)||e.entity_id}))).sort(_);break}case"calendars":{if(!(e in g))return[];const t="attributes.friendly_name";i=Object.values(g[e]).filter((e=>e.entity_id.startsWith("calendar."))).map((e=>({value:e.entity_id,label:c(t,e)||e.entity_id}))).sort(_);break}}return i}(o,s).filter((e=>e.value.toLowerCase().includes(i)||e.label.toLowerCase().includes(i)));t(n)},minLength:0}).autocomplete("instance")._renderItem=(e,t)=>$("<li>").append(`<div>${t.label}<p class="sublabel">${t.value}</p></div>`).appendTo(e)}const Di=function(e,t,i,n){const a=$(e),o=$(i),s={value:"entity",label:"entity."},r=["str","num","bool","re","jsonata","msg","flow","global",s];"currentState"!==n&&r.splice(5,1),a.after(' <a id="clearIfState" class="editor-button"><i class="fa fa-remove"></i></a>');const l=$("#clearIfState");a.typedInput({default:"str",types:r,typeField:t}),o.on("change",(function(){const e=$(this);let t=r,i=["flow","global",s];switch(r.includes("msg")&&(i=["msg",...i]),e.val()){case"is":case"is_not":break;case"lt":case"lte":case"gt":case"gte":t=["num","jsonata",...i];break;case"includes":case"does_not_include":t=["str","jsonata",...i];break;case"jsonata":t=["jsonata"]}a.typedInput("types",t)})),o.trigger("change"),a.on("change",(function(){$(this).val()&&l.show()})),l.on("click",(e=>{a.typedInput("type","str"),a.typedInput("value",""),$(e.currentTarget).hide()})),a.val()||l.hide()},Oi={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:1,outputs:1,outputLabels:function(e){if(this.halt_if){if(0===e)return"'If State' is true";if(1===e)return"'If State' is false"}},icon:"ha-current-state.svg",paletteLabel:"current state",label:function(){return this.name||`current_state: ${this.entity_id}`},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("apiCurrentStateVersion",0)},outputs:{value:1},halt_if:{value:""},halt_if_type:{value:"str"},halt_if_compare:{value:"is"},entity_id:{value:""},state_type:{value:"str"},blockInputOverrides:{value:!0},outputProperties:{value:[{property:"payload",propertyType:"msg",value:"",valueType:"entityState"},{property:"data",propertyType:"msg",value:"",valueType:"entity"}],validate:Qt},for:{value:"0"},forType:{value:"num"},forUnits:{value:"minutes"},override_topic:{value:!1},state_location:{value:"payload"},override_payload:{value:"msg"},entity_location:{value:"data"},override_data:{value:"msg"}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),wi({root:"#node-input-entity_id"}),Di("#node-input-halt_if","#node-input-halt_if_type","#node-input-halt_if_compare","currentState"),$("#node-input-halt_if_compare").on("change",(function(){const e=["is","is_not","includes","does_not_include"].includes(this.value);$("#for-row").toggle(e)})),$("#node-input-for").typedInput({default:"num",types:["num","jsonata","msg","flow","global"],typeField:"#node-input-forType"}),Zt(this.outputProperties,{extraTypes:["entity","entityId","entityState"]}),ai("current-state")},oneditsave:function(){const e=$("#node-input-halt_if").val()?2:1;$("#node-input-outputs").val(e),this.outputProperties=Yt()}};var xi,Ii;function Ci(e){const t=w(e),i=[];return t.forEach((t=>{i.push({value:t.id,label:t.name_by_user||t.name,description:S(e,t.area_id)})})),i.sort(((e,t)=>(e.label||e.value).localeCompare(t.label||t.value))),i}function ji(e,t,i){return et(this,void 0,void 0,(function*(){const n=yield dt(e,t).catch((e=>{var t;throw new Error(`${p(i)} ${null!==(t=e.message)&&void 0!==t?t:""}`)}));if(!n.success)throw new Error(`${p(i)} ${n.message}`);return n.data}))}!function(e){e.Action="action",e.Trigger="trigger"}(xi||(xi={})),function(e){e.DeviceActionCapabilities="deviceActionCapabilities",e.DeviceActions="deviceActions",e.DeviceTriggerCapabilities="deviceTriggerCapabilities",e.DeviceTriggers="deviceTriggers"}(Ii||(Ii={}));var Ri=Object.freeze({__proto__:null,getCapabilitiesList:function(e){return et(this,void 0,void 0,(function*(){return ji(Ii.DeviceActionCapabilities,{event:JSON.stringify(e)},"ha-device.error.failed_to_fetch_capabilities")}))},getEventList:function(e){return et(this,void 0,void 0,(function*(){return ji(Ii.DeviceActions,{deviceId:e},"ha-device.error.failed_to_fetch_actions")}))},inputCount:1,setDefaultOutputs:function(){return[]}});var ki=Object.freeze({__proto__:null,getCapabilitiesList:function(e){return et(this,void 0,void 0,(function*(){return ji(Ii.DeviceTriggerCapabilities,{event:JSON.stringify(e)},"ha-device.error.failed_to_fetch_capabilities")}))},getEventList:function(e){return et(this,void 0,void 0,(function*(){return ji(Ii.DeviceTriggers,{deviceId:e},"ha-device.error.failed_to_fetch_actions")}))},inputCount:0,setDefaultOutputs:function(e){return e}});function Ai(e,t){return`<label for="${t}">${e.replace(/_/g," ")}</label>`}function Pi(e=[],t=[]){const i=[];return e.forEach((e=>{const n=t.find((t=>t.name===e.name));switch(e.type){case"boolean":{const t=function(e,t){const i=`deviceExtra-${e.name}`,n=t?t.value:"",a=`${Ai(e.name,i)} \n <input type="checkbox" id="${i}" style="width: auto" value="${n}"/> \n `;return Li(a)}(e,n);i.push($(t));break}case"float":{const t=function(e,t){const i=`deviceExtra-${e.name}`,n=t?t.value:"";let a=`\n ${Ai(e.name,i)}\n <input type="text" id="${i}" style="width: 35%" value="${n}"/> \n `;e.description&&e.description.suffix&&(a+=`<span>${e.description.suffix}</span>`);return Li(a)}(e,n);i.push($(t));break}case"integer":{const t=function(e,t){var i;const n=`deviceExtra-${e.name}`,a=t?t.value:"",o=$(`\n ${Ai(e.name,n)}\n <div class="range-row">\n <input type="checkbox" />\n <input type="range" id="${n}" max="${e.valueMax}" min="${null!==(i=e.valueMin)&&void 0!==i?i:0}" value="${a}" />\n <input type="text" value="${a}" />\n </div>\n `),s=o.find('input[type="checkbox"]'),r=o.find('input[type="range"]'),l=o.find('input[type="text"]');!1!==e.optional&&void 0===(null==t?void 0:t.value)||s.prop("checked",!0);!1===e.optional&&s.hide();return s.on("change",(()=>{r.prop("disabled",!s.prop("checked")).trigger("change"),l.prop("disabled",!s.prop("checked"))})).trigger("change"),r.on("change input",(()=>{l.val(r.val())})).trigger("change"),l.on("keyup change",(()=>{const t=l.val();if(t.length>0){const i=Number(t);i<e.valueMin&&l.val(e.valueMin),i>e.valueMax&&l.val(e.valueMax),r.val(l.val())}})),Li(o)}(e,n);i.push(t);break}case"positive_time_period_dict":{const t=function(e,t){const i=`deviceExtra-${e.name}`,n=t?t.value:"",a=e=>t&&e===t.unit?"selected":"",o="ha-device.label",s={seconds:p(`${o}.seconds`),minutes:p(`${o}.minutes`),hours:p(`${o}.hours`)},r=`\n ${Ai(e.name,i)}\n <input type="text" id="${i}" style="width: 35%" value="${n}"/>\n <select id="${i}Units" style="width: 35%">\n <option value="seconds" ${a("seconds")}>${s.seconds}</option>\n <option value="minutes" ${a("minutes")}>${s.minutes}</option>\n <option value="hours" ${a("hours")}>${s.hours}</option>\n </select>`;return Li(r)}(e,n);i.push($(t));break}case"select":{const t=function(e,t={}){const i=`deviceExtra-${e.name}`,n=e.options.reduce(((e,[i,n])=>{const a=t.value===i?"selected":"";return e.push(`<option value="${i}" ${a}>${n}</option>`),e}),[]),a=`\n ${Ai(e.name,i)}\n <select id="${i}" style="width: 70%">\n ${n.join("")}\n </select> \n `;return Li(a)}(e,n);i.push($(t));break}case"string":{const t=function(e,t){const i=`deviceExtra-${e.name}`,n=t?t.value:"",a=`\n ${Ai(e.name,i)}\n <input type="text" id="${i}" style="width: 70%" value="${n}"/>\n `;return Li(a)}(e,n);i.push($(t));break}default:{const t=function(e,t={}){const i=`<label class="error"><i class="fa fa-exclamation-triangle"></i> Error</label>${e} -- <a href="https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/new?title=[Device Node] Unknown extra type: ${t.type}" target="_blank"> ${p("ha-device.error.report")}</a>`;return Li(i)}(p("ha-device.error.unknown_field_type",{type:e.type}),{type:e.type});i.push($(t))}}})),i}function Li(e,t=["deviceExtra"]){return e instanceof $?$(`<div class="form-row ${t.join(" ")}"></div>`).append(e):`<div class="form-row ${t.join(" ")}">${e}</div>`}function Ni(e){return e===xi.Action?Ri:ki}const Bi=[{property:"payload",propertyType:l.Message,value:"",valueType:"eventData"},{property:"topic",propertyType:l.Message,value:"",valueType:"triggerId"}],Hi={category:bt.HomeAssistant,color:Tt.Beta,inputs:0,outputs:1,icon:"font-awesome/fa-cube",paletteLabel:"device",label:function(){return this.name||`device ${this.deviceType}`},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haDeviceVersion",0)},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},inputs:{value:0},deviceType:{value:xi.Trigger},device:{value:""},event:{value:void 0,validate:e=>void 0!==e},capabilities:{value:[],validate:function(e){if(!Array.isArray(e))return!0;for(const t of e)switch(t.type){case"float":if(!Number.isFinite(Number(t.value)))return!1;break;case"positive_time_period_dict":if(-1===Math.sign(t.value))return!1;break}return!0}},outputProperties:{value:Bi,validate:Qt},exposeToHomeAssistant:{value:void 0},haConfig:{value:void 0}},oneditprepare:function(){return et(this,void 0,void 0,(function*(){const e="_ADD_",t=$("#node-input-server"),i=$("#node-input-deviceType"),n=$("#ha-device"),o=$("#event");St.setup(this),rt(this,"#node-input-server",(t=>et(this,void 0,void 0,(function*(){u(),n[0].setOptions(Ci(t)),t!==e&&(yield l(),yield y(n.val()))})))),H(this);let s,r=Ni(i.val());bi(a.Switch,"exposeAsEntityConfig");const l=()=>et(this,void 0,void 0,(function*(){const e=RED.i18n.lang();try{s=yield dt("translations",{cat:"device_automation",lang:e})}catch(e){RED.notify("Error retrieving translations.")}}));yield l(),VirtualSelect.init({ele:"#ha-device",allowNewOption:!0,search:!0,maxWidth:"70%",placeholder:"",selectedValue:this.device,silentInitialValueSet:!0,hasOptionDescription:!0,options:Ci(at),optionsCount:8,hideClearButton:!0}),n.on("change",(function(e){return et(this,void 0,void 0,(function*(){yield y(e.currentTarget.value)}))})),o.on("change",(function(e){return et(this,void 0,void 0,(function*(){const t=e.currentTarget.value;if("__NONE__"===t)return;const i=o.data("events");yield h(i[t])}))}));const u=()=>{c(),v()},p=e=>et(this,void 0,void 0,(function*(){const t=n.val(),i=e.currentTarget.value;var a;v(),t&&(r=Ni(i),yield y(t)),a=m(i),zt=a;const s=i===xi.Trigger?Bi:[],l=r.setDefaultOutputs(s);var u;u=l,Jt.editableList("empty"),Jt.editableList("addItems",u),o.prev().text(i),$("#node-input-exposeAsEntityConfig").closest("div.form-row").toggle(i===xi.Trigger)}));t.one("change",(()=>et(this,void 0,void 0,(function*(){u(),t.val()!==e&&(yield y(this.device,this.event,this.capabilities)),setTimeout((()=>{i.on("change",p)}),100)}))));const c=()=>{o.html(`<option value="__NONE__">No ${i.val()}s</option>`).trigger("change").prop("disabled",!0)},v=()=>{$(".deviceExtra").remove()},y=(e,t,a)=>et(this,void 0,void 0,(function*(){if(!e)return;const s=yield r.getEventList(e).catch((e=>(RED.notify(e),[])));let l;if(0===s.length)c(),v(),l=0;else{if(s[0].device_id!==n.val())return;const e=i.val();o.data("events",s).empty().prop("disabled",!1);const r=[];for(let t=0;t<s.length;t++){const i=f(e,s[t]);r.push(new Option(i,t.toString()))}o.append(r),l=s.findIndex((e=>d(t,e))),l=-1===l?0:l,h(s[l],a)}$("option",o).eq(l).prop("selected",!0)})),h=(e,t)=>et(this,void 0,void 0,(function*(){v();const i=yield r.getCapabilitiesList(e).catch((e=>(RED.notify(e),[])));if(null==i?void 0:i.length){o.data("capabilities",i);const e=Pi(i,t);o.parent().after(e)}})),f=(e,i)=>{var n;const a=(t="type")=>`component.${i.domain}.device_automation.${e}_${t}.${i[t]}`;let o=null!==(n=null==s?void 0:s[a()])&&void 0!==n?n:i.subtype?`"${i.subtype}" ${i.type}`:i.type;const r={entity_name:()=>{var e;const n="<unknown>";if(!i.entity_id)return n;const a=t.val(),o=D(a,i.entity_id);if(!o)return n;if(null==o?void 0:o.name)return o.name;const s=function(e,t){return g[e][t]}(a,o.entity_id);return s?void 0===s.attributes.friendly_name?s.entity_id.replace(/_/g," "):null!==(e=s.attributes.friendly_name)&&void 0!==e?e:"":o.original_name||o.entity_id},subtype:()=>s[a("subtype")]||i.subtype},l=Object.keys(r);for(const e of l){const t=`{${e}}`;if(-1!==o.indexOf(t))try{const i=r[e]();o=o.replace(t,i)}catch(e){RED.notify(`Error fetaching translation device event: ${JSON.stringify(e)}`)}}return o},m=e=>({action:["sentData"],trigger:["eventData","triggerId"]}[e]);$("#dialog-form").prepend(St.betaWarning(1467)),Zt(this.outputProperties,{extraTypes:m(i.val())}),ai("device")}))},oneditsave:function(){const e=Ni($("#node-input-deviceType").val());this.inputs=e.inputCount,this.device=$("#ha-device").val();const t=$("#event"),i=t.val();if("__NONE__"!==i){const e=t.data("events"),n=t.data("capabilities");this.event=e[i],this.capabilities=function(e=[]){return e.reduce(((e,t)=>{const i=`deviceExtra-${t.name}`,n=$(`#${i}`).val();switch(t.type){case"boolean":e.push({name:t.name,type:t.type,value:$(`#${i}`).is(":checked")});break;case"float":case"positive_time_period_dict":if((null==n?void 0:n.length)&&!isNaN(Number(n))){const a={name:t.name,type:t.type,value:Number(n),unit:"positive_time_period_dict"===t.type?$(`#${i}Units`).val():void 0};e.push(a)}break;case"integer":if($(`#${i}`).siblings('input[type="checkbox"]').prop("checked")&&(null==n?void 0:n.length)&&!isNaN(Number(n))){const i={name:t.name,type:t.type,value:Number(n)};e.push(i)}break;case"select":n.length&&e.push({name:t.name,type:t.type,value:n});break;case"string":(null==n?void 0:n.length)&&e.push({name:t.name,type:t.type,value:n})}return e}),[])}(n)}this.outputProperties=Yt()}},Vi={category:bt.Config,defaults:{version:{value:RED.settings.get("haDeviceConfigVersion",0)},name:{value:"",required:!1},hwVersion:{value:"",required:!1},manufacturer:{value:"Node-RED",required:!1},model:{value:"",required:!1},swVersion:{value:"",required:!1}},icon:"font-awesome/fa-device",label:function(){return this.name||"Device Config"},oneditprepare:function(){St.setup(this)}},Mi={category:bt.HomeAssistantDeprecated,color:Tt.Deprecated,inputs:1,outputs:1,icon:function(){return"switch"===(null==this?void 0:this.entityType)?"ha-entity-switch.svg":"font-awesome/fa-genderless"},align:"right",paletteLabel:"entity",label:function(){return this.name||`type: ${this.entityType}`},labelStyle:function(){return this.name?"node_label_italic":""},defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haEntityVersion",0)},debugenabled:{value:!1},outputs:{value:1},entityType:{value:"sensor"},config:{value:[{property:"name",value:""},{property:"device_class",value:""},{property:"icon",value:""},{property:"unit_of_measurement",value:""},{property:"state_class",value:""},{property:"last_reset",value:""}]},state:{value:"payload"},stateType:{value:"msg"},attributes:{value:[]},resend:{value:!0},outputLocation:{value:"payload"},outputLocationType:{value:"none"},inputOverride:{value:"allow"},outputOnStateChange:{value:null},outputPayload:{value:null},outputPayloadType:{value:null}},oneditprepare:function(){St.setup(this),this.server&&RED.tray.close()}};var Fi,qi=[{id:"entity_category",type:"select",values:["","config","diagnostic"]},{id:"device_class",type:"select",values:["","battery","battery_charging","co","cold","connectivity","door","garage_door","gas","heat","light","lock","moisture","motion","moving","occupancy","opening","plug","power","presence","problem","running","safety","smoke","sound","tamper","update","vibration","window"]}];!function(e){e.ApparentPower="apparent_power",e.Aqi="aqi",e.Area="area",e.AtmosphericPressure="atmospheric_pressure",e.Battery="battery",e.BloodGlucoseConcentration="blood_glucose_concentration",e.CarbonDioxide="carbon_dioxide",e.CarbonMonoxide="carbon_monoxide",e.Conductivity="conductivity",e.Current="current",e.DataRate="data_rate",e.DataSize="data_size",e.Date="date",e.Distance="distance",e.Duration="duration",e.Energy="energy",e.EnergyStorage="energy_storage",e.Enum="enum",e.Frequency="frequency",e.Gas="gas",e.Humidity="humidity",e.Illuminance="illuminance",e.Irradiance="irradiance",e.Moisture="moisture",e.Monetary="monetary",e.NitrogenDioxide="nitrogen_dioxide",e.NitrogenMonoxide="nitrogen_monoxide",e.NitrousOxide="nitrous_oxide",e.Ozone="ozone",e.Pm1="pm1",e.Pm10="pm10",e.Pm25="pm25",e.PotentialHydrogen="potential_hydrogen",e.Power="power",e.PowerFactor="power_factor",e.Precipitation="precipitation",e.PrecipitationIntensity="precipitation_intensity",e.Pressure="pressure",e.ReactivePower="reactive_power",e.SignalStrength="signal_strength",e.SoundPressure="sound_pressure",e.Speed="speed",e.SulphurDioxide="sulphur_dioxide",e.Temperature="temperature",e.Timestamp="timestamp",e.VolatileOrganicCompounds="volatile_organic_compounds",e.VolatileOrganicCompoundsParts="volatile_organic_compounds_parts",e.Voltage="voltage",e.Volume="volume",e.VolumeFlowRate="volume_flow_rate",e.VolumeStorage="volume_storage",e.Water="water",e.Weight="weight",e.WindSpeed="wind_speed"}(Fi||(Fi={}));const Gi=["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","CNY","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLL","SOS","SRD","SSP","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VES","VND","VUV","WST","XAF","XAG","XAU","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","XXX","YER","ZAR","ZMW","ZWL"];var Wi=[{id:"entity_category",type:"select",values:["","config","diagnostic"]},{id:"device_class",type:"select",values:["",...[Fi.ApparentPower,Fi.Aqi,Fi.AtmosphericPressure,Fi.Battery,Fi.CarbonDioxide,Fi.CarbonMonoxide,Fi.Current,Fi.DataRate,Fi.DataSize,Fi.Distance,Fi.Energy,Fi.EnergyStorage,Fi.Frequency,Fi.Gas,Fi.Humidity,Fi.Illuminance,Fi.Irradiance,Fi.Moisture,Fi.Monetary,Fi.NitrogenDioxide,Fi.NitrogenMonoxide,Fi.NitrousOxide,Fi.Ozone,Fi.Pm1,Fi.Pm10,Fi.Pm25,Fi.Power,Fi.PowerFactor,Fi.Precipitation,Fi.PrecipitationIntensity,Fi.Pressure,Fi.ReactivePower,Fi.SignalStrength,Fi.SoundPressure,Fi.Speed,Fi.SulphurDioxide,Fi.Temperature,Fi.VolatileOrganicCompounds,Fi.Voltage,Fi.Volume,Fi.VolumeStorage,Fi.Water,Fi.Weight,Fi.WindSpeed]]},{id:"unit_of_measurement",type:"unit_of_measurement",values:{apparent_power:["VA"],aqi:null,atmospheric_pressure:["cbar","bar","hPa","inHg","kPa","mbar","Pa","psi"],battery:["%"],carbon_dioxide:["ppm"],carbon_monoxide:["ppm"],current:["A"],data_rate:["bit/s","kbit/s","Mbit/s","Gbit/s","B/s","kB/s","MB/s","GB/s","KiB/s","MiB/s","GiB/s"],data_size:["bit","kbit","Mbit","Gbit","B","kB","MB","GB","TB","PB","EB","ZB","YB","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],distance:["km","m","cm","mm","mi","yd","in"],energy:["Wh","kWh","MWh","GJ"],energy_storage:["Wh","kWh","MWh","MJ","GJ"],frequency:["Hz","kHz","MHz","GHz"],gas:["m³","ft³"],humidity:["%"],illuminance:["lx","lm"],irradiance:["W/m²","BTU/(h*ft²)"],moisture:["%"],monetary:Gi,nitrogen_dioxide:["µg/m³"],nitrogen_monoxide:["µg/m³"],nitrous_oxide:["µg/m³"],ozone:["µg/m³"],pm1:["µg/m³"],pm25:["µg/m³"],pm10:["µg/m³"],power:["W","kW"],power_factor:["%"],precipitation:["mm","in","cm"],precipitation_intensity:["mm/h","mm/d","in/h","in/d"],pressure:["cbar","bar","hPa","inHg","kPa","mbar","Pa","psi"],reactive_power:["var"],signal_strength:["dB","dBm"],sound_pressure:["dB","dBA"],speed:["ft/s","in/d","in/h","km/h","kn","m/s","mm/d","mph"],sulphur_dioxide:["µg/m³"],temperature:["°C","°F"],volatile_organic_compounds:["µg/m³"],voltage:["V"],volume:["fl. oz.","ft³","gal","L","mL","m³"],volume_storage:["L","mL","gal","fl. oz.","m³","ft³","CCF"],water:["L","gal","m³","ft³"],weight:["g","kg","lb","mg","oz","µg"],wind_speed:["ft/s","km/h","kn","m/s","mph"]}},{id:"min_value",type:"number"},{id:"max_value",type:"number"},{id:"step_value",type:"number"},{id:"mode",type:"select",values:["auto","box","slider"]}];var Ji=[{id:"entity_category",type:"select",values:["","diagnostic"]},{id:"device_class",type:"select",values:["",...[Fi.ApparentPower,Fi.Aqi,Fi.Area,Fi.AtmosphericPressure,Fi.Battery,Fi.BloodGlucoseConcentration,Fi.CarbonDioxide,Fi.CarbonMonoxide,Fi.Conductivity,Fi.Current,Fi.DataRate,Fi.DataSize,Fi.Date,Fi.Distance,Fi.Duration,Fi.Energy,Fi.EnergyStorage,Fi.Enum,Fi.Frequency,Fi.Gas,Fi.Humidity,Fi.Illuminance,Fi.Irradiance,Fi.Moisture,Fi.Monetary,Fi.NitrogenDioxide,Fi.NitrogenMonoxide,Fi.NitrousOxide,Fi.Ozone,Fi.Pm1,Fi.Pm10,Fi.Pm25,Fi.PotentialHydrogen,Fi.Power,Fi.PowerFactor,Fi.Precipitation,Fi.PrecipitationIntensity,Fi.Pressure,Fi.ReactivePower,Fi.SignalStrength,Fi.SoundPressure,Fi.Speed,Fi.SulphurDioxide,Fi.Temperature,Fi.Timestamp,Fi.VolatileOrganicCompounds,Fi.VolatileOrganicCompoundsParts,Fi.Voltage,Fi.Volume,Fi.VolumeFlowRate,Fi.VolumeStorage,Fi.Water,Fi.Weight,Fi.WindSpeed]]},{id:"unit_of_measurement",type:"unit_of_measurement",values:{apparent_power:["VA"],aqi:null,area:["m²","cm²","km²","mm²","in²","ft²","yd²","mi²","ac","ha"],atmospheric_pressure:["cbar","bar","hPa","inHg","kPa","mbar","Pa","psi"],battery:["%"],blood_glucose_concentration:["mg/dL","mmol/L"],carbon_dioxide:["ppm"],carbon_monoxide:["ppm"],conductivity:["S/cm","mS/cm","µS/cm"],current:["A"],data_rate:["bit/s","kbit/s","Mbit/s","Gbit/s","B/s","kB/s","MB/s","GB/s","KiB/s","MiB/s","GiB/s"],data_size:["bit","kbit","Mbit","Gbit","B","kB","MB","GB","TB","PB","EB","ZB","YB","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],date:null,distance:["km","m","cm","mm","mi","yd","in"],duration:["d","h","min","s","ms","µs"],energy:["Wh","kWh","MWh","GJ"],energy_storage:["Wh","kWh","MWh","MJ","GJ"],enum:null,frequency:["Hz","kHz","MHz","GHz"],gas:["m³","ft³"],humidity:["%"],illuminance:["lx","lm"],irradiance:["W/m²","BTU/(h*ft²)"],moisture:["%"],monetary:Gi,nitrogen_dioxide:["µg/m³"],nitrogen_monoxide:["µg/m³"],nitrous_oxide:["µg/m³"],ozone:["µg/m³"],pm1:["µg/m³"],pm25:["µg/m³"],pm10:["µg/m³"],potential_hydrogen:null,power:["W","kW"],power_factor:["%"],precipitation:["mm","in","cm"],precipitation_intensity:["mm/h","mm/d","in/h","in/d"],pressure:["cbar","bar","hPa","inHg","kPa","mbar","Pa","psi"],reactive_power:["var"],signal_strength:["dB","dBm"],sound_pressure:["dB","dBA"],speed:["ft/s","in/s","in/d","in/h","km/h","kn","m/s","mm/s","mm/h","mm/d","mph"],sulphur_dioxide:["µg/m³"],temperature:["°C","°F"],timestamp:null,volatile_organic_compounds:["µg/m³"],volatile_organic_compounds_parts:["ppm","ppb"],voltage:["V"],volume:["fl. oz.","ft³","gal","L","mL","m³"],volume_flow_rate:["m³/h","ft³/min","L/min","gal/min","mL/s"],volume_storage:["L","mL","gal","fl. oz.","m³","ft³","CCF"],water:["L","gal","m³","ft³"],weight:["g","kg","lb","mg","oz","µg"],wind_speed:["ft/s","km/h","kn","m/s","mph"]}},{id:"state_class",type:"select",values:["","measurement","total","total_increasing"]},{id:"last_reset",type:"datetime"}];const zi=[{id:"name",type:"string"},{id:"icon",type:"string"},{id:"entity_picture",type:"string"}],Ui={button:[{id:"entity_category",type:"select",values:["","config","diagnostic"]},{id:"device_class",type:"select",values:["","restart","update"]}],binary_sensor:qi,number:Wi,select:[{id:"entity_category",type:"select",values:["","config","diagnostic"]},{id:"options",type:"editableList",values:["option1"]}],sensor:Ji,switch:[{id:"entity_category",type:"select",values:["","config","diagnostic"]},{id:"device_class",type:"select",values:["","outlet","switch"]}],text:[{id:"entity_category",type:"select",values:["","config","diagnostic"]},{id:"mode",type:"select",values:["text","password"]},{id:"min_length",type:"number"},{id:"max_length",type:"number"},{id:"pattern",type:"string"}]},Ki={binary_sensor:["resend"],sensor:["resend"]},Zi={category:bt.Config,defaults:{server:{value:"",type:s.Server,required:!0},deviceConfig:{value:"",type:s.DeviceConfig,required:!1},name:{value:""},version:{value:RED.settings.get("haEntityConfigVersion",0)},entityType:{value:"binary_sensor",required:!0},haConfig:{value:[],validate:function(e){if("select"===$("#node-config-input-entityType").val()){const t=e.find((e=>"options"===e.property));if(!t||!Array.isArray(t.value)||!t.value.length)return!1}return!0}},resend:{value:!1},debugEnabled:{value:!1}},label:function(){return this.name||`${this.entityType} ${this.id}`},oneditprepare:function(){St.setup(this),this.deviceConfig||$("#node-config-input-deviceConfig").val("_ADD_"),(()=>{const e=$("body").data("haEntityType");e&&($("#node-config-input-entityType").val(e),$("body").data("haEntityType",null))})();const e=$("#ha-config-rows"),t=this;$("#node-config-input-entityType").on("change",(function(){var i;const n=$(this).val();$(".ha-config-row").remove(),$("#node-config-dialog-edit-form .ha-optional-row").each((function(){var e;const t=$(this),i=t.attr("id");i&&t.hasClass("ha-optional-row")&&t.toggle(null===(e=Ki[n])||void 0===e?void 0:e.includes(i.replace(/-row$/,"")))}));const o=[...zi,...null!==(i=Ui[n])&&void 0!==i?i:[]];o.forEach((i=>{var n,a;const o=null!==(a=null===(n=t.haConfig.find((e=>e.property===i.id)))||void 0===n?void 0:n.value)&&void 0!==a?a:"";e.append(mi(o,i))})),n!==a.Number&&n!==a.Sensor||$("#ha-config-device_class").on("change",(function(){var e,i,n,a;const s=null!==(i=null===(e=t.haConfig.find((e=>"unit_of_measurement"===e.property)))||void 0===e?void 0:e.value)&&void 0!==i?i:"",r=null!==(a=null===(n=o.find((e=>"unit_of_measurement"===e.id)))||void 0===n?void 0:n.values)&&void 0!==a?a:[];$("#ha-config-unit_of_measurement").parent().replaceWith(mi(s,{id:"unit_of_measurement",type:"unit_of_measurement",values:r}))}))}))},oneditsave:function(){const e=[];$(".ha-config-row").each((function(){const t=$(this);switch(t.data("type")){case"datetime":case"date":{const i=t.find("input").data("property"),n=t.find("input").val();if(""===n)return;const a=new Date(n);e.push({property:i,value:a.toISOString()});break}case"editableList":{const i=t.find("ol").editableList("items"),n=[];i.each((function(){const e=$(this).find("input");n.push(e.val())})),e.push({property:"options",value:n});break}case"number":{const i=t.find("input").data("property"),n=t.find("input").val(),a=n.length?Number(n):"";e.push({property:i,value:a});break}case"string":{const i=t.find("input").data("property"),n=t.find("input").val();e.push({property:i,value:n});break}case"select":{const i=t.find("select"),n=i.data("property"),a=i.val();e.push({property:n,value:a});break}case"unit_of_measurement":{const i=t.find("select, input"),n=i.data("property"),a=i.val();e.push({property:n,value:a});break}}})),this.haConfig=e}},Xi={category:bt.HomeAssistant,color:Tt.HaBlue,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("serverEventsVersion",0)},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},eventType:{value:"",required:!1},eventData:{value:"",validate:RED.validators.typedInput({allowBlank:!0})},waitForRunning:{value:!0},outputProperties:{value:[{property:"payload",propertyType:"msg",value:"",valueType:"eventData"},{property:"topic",propertyType:"msg",value:'$outputData("eventData").event_type',valueType:"jsonata"}],validate:Qt},event_type:{value:void 0},exposeToHomeAssistant:{value:void 0},haConfig:{value:void 0}},inputs:0,outputs:1,icon:"ha-events-all.svg",paletteLabel:"events: all",label:function(){return this.name||`events: ${this.eventType||"all"}`},labelStyle:St.labelStyle,oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),H(this),bi(a.Switch,"exposeAsEntityConfig"),$("#node-input-eventData").typedInput({types:["json"]}),$("#node-input-eventType").on("change input",(function(){const e=$(this).val().trim();$("#eventAlert").toggle(0===e.length),this.value=e})),Zt(this.outputProperties,{extraTypes:["eventData"]}),ai("events-all")},oneditsave:function(){this.outputProperties=Yt()}},Yi={category:bt.HomeAssistant,color:Tt.Beta,inputs:0,outputs:1,outputLabels:["Calendar event triggered"],icon:"ha-events-calendar.svg",paletteLabel:"events: calendar",label:function(){return this.name||"calendar_event"},labelStyle:St.labelStyle,defaults:{name:{value:""},version:{value:RED.settings.get("eventsCalendarVersion",0)},server:{value:"",type:s.Server,required:!0},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},entityId:{value:"",required:!0},filter:{value:""},filterType:{value:"str",required:!0},eventType:{value:"start",required:!0},offset:{value:0,required:!0},offsetType:{value:"num",required:!0},offsetUnits:{value:"minutes",required:!0},outputProperties:{value:[{property:"payload",propertyType:l.Message,value:"",valueType:"calendarItem"}],validate:Qt}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),H(this),bi(a.Switch,"exposeAsEntityConfig"),$("#dialog-form").prepend(St.betaWarning(1295)),wi({root:"#node-input-entityId",options:{type:"calendars"}}),$("#node-input-offset").typedInput({default:"num",types:["num","jsonata"],typeField:"#node-input-offsetType"}),$("#node-input-filter").typedInput({types:["str","jsonata"],typeField:"#node-input-filterType"}),Zt(this.outputProperties,{extraTypes:["calendarItem"]}),ai("events-calendar")},oneditsave:function(){this.outputProperties=Yt()}};var Qi;!function(e){e.Boolean="bool",e.Home_Assistant_Boolean="habool",e.List="list",e.Number="num",e.Regexp="re",e.String="str"}(Qi||(Qi={}));const en={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:0,outputs:1,outputLabels:["'If State' is true","'If State' is false"],icon:"ha-events-state-changed.svg",paletteLabel:"events: state",label:function(){let e=[];return this.entities&&Object.entries(this.entities).forEach((([,t])=>{Array.isArray(t)&&(null==t?void 0:t.length)&&(e=[...e,...t])})),this.name||`state_changed: ${e}`},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("serverStateChangedVersion",0)},outputs:{value:1},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},entities:{value:{[le.Entity]:[""],[le.Substring]:[],[le.Regex]:[]}},outputInitially:{value:!1},stateType:{value:Qi.String},ifState:{value:""},ifStateType:{value:l.String},ifStateOperator:{value:i.Is},outputOnlyOnStateChange:{value:!0},for:{value:"0"},forType:{value:"num"},forUnits:{value:"minutes"},ignorePrevStateNull:{value:!1},ignorePrevStateUnknown:{value:!1},ignorePrevStateUnavailable:{value:!1},ignoreCurrentStateUnknown:{value:!1},ignoreCurrentStateUnavailable:{value:!1},outputProperties:{value:[{property:"payload",propertyType:l.Message,value:"",valueType:"entityState"},{property:"data",propertyType:l.Message,value:"",valueType:"eventData"},{property:"topic",propertyType:l.Message,value:"",valueType:"triggerId"}],validate:Qt},entityId:{value:void 0},entityIdType:{value:void 0},exposeToHomeAssistant:{value:void 0},haConfig:{value:void 0},entityidfilter:{value:void 0},entityidfiltertype:{value:void 0},outputinitially:{value:void 0},state_type:{value:void 0},haltifstate:{value:void 0},halt_if_type:{value:void 0},halt_if_compare:{value:void 0},output_only_on_state_change:{value:void 0}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server",(()=>{e.refreshOptions()})),H(this),bi(a.Switch,"exposeAsEntityConfig");const e=new Ft({element:"#entity-list",types:[le.Entity,le.Substring,le.Regex],headerText:p("server-state-changed.label.entities")});Object.entries(this.entities).forEach((([t,i])=>{null==i||i.forEach((i=>{e.addId(t,i)}))})),Di("#node-input-ifState","#node-input-ifStateType","#node-input-ifStateOperator"),$("#node-input-for").typedInput({default:l.Number,types:[l.Number,l.JSONata,l.Flow,l.Global],typeField:"#node-input-forType"}),Zt(this.outputProperties,{extraTypes:["eventData","entityId","entityState"]}),ai("events-state")},oneditsave:function(){const e=$("#node-input-ifState").val()?2:1;$("#node-input-outputs").val(e);const t=Gt("#entity-list");this.entities={[le.Entity]:t[le.Entity],[le.Substring]:t[le.Substring],[le.Regex]:t[le.Regex]},this.outputProperties=Yt()}},tn={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:1,outputs:1,icon:"ha-fire-event.svg",align:"right",paletteLabel:"fire event",label:function(){return this.name||`Event: ${this.event}`},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haFireEventVersion",0)},event:{value:""},data:{value:"",validate:RED.validators.typedInput({type:"dateType",allowBlank:!0})},dataType:{value:l.JSONata}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),$("#node-input-data").typedInput({types:[l.JSON,l.JSONata],typeField:"#node-input-dataType"}),ai("fire-event")}},nn=[{value:i.Is,text:"=="},{value:i.IsNot,text:"!="},{value:i.IsLessThan,text:"<"},{value:i.IsLessThanOrEqual,text:"<="},{value:i.IsGreaterThan,text:">"},{value:i.IsGreaterThanOrEqual,text:">="},{value:i.Includes,text:"in"},{value:i.DoesNotInclude,text:"not in"},{value:i.StartsWith,text:"starts with"},{value:i.InGroup,text:"in group"},{value:i.JSONata,text:"JSONata"}],an=[{value:i.Is,text:"=="},{value:i.IsNot,text:"!="},{value:i.Contains,text:"contains"},{value:i.DoesNotContain,text:"does not contain"},{value:i.Includes,text:"in"},{value:i.DoesNotInclude,text:"not in"},{value:i.StartsWith,text:"starts with"},{value:i.IsNull,text:"is null"},{value:i.IsNotNull,text:"is not null"}],on={value:"entity",label:"entity."},sn=[l.String,l.Number,l.Boolean,l.Regex,l.JSONata,l.Message,l.Flow,l.Global,on],rn=[l.String,l.JSONata,l.Message,l.Flow,l.Global,on],ln={[ue.State]:[],[ue.Floor]:["aliases","floor_id","level","name"],[ue.Area]:["aliases","area_id","name"],[ue.Device]:["hw_version","id","manufacturer","model","model_id","name","name_by_user","serial_number","sw_version"],[ue.Label]:["description","label_id","name"]};function un(e){ut("properties",(t=>{const i=t.map((e=>({value:e,label:e})));e(i)}))}function pn(e){switch(e.condition){case ue.Area:case ue.Device:case ue.Floor:case ue.Label:return function(e){e.condition||(e.condition=ue.State);const t=$("<span />",{text:p(`home-assistant.component.property-selector.label.${e.condition}_property`),class:"property-label"}),i=$("<select>",{class:"input-property"});ln[e.condition].forEach((e=>{i.append($("<option></option>").val(e).text(e))})),i.val(e.property);const n=$("<select>",{class:"input-logic"});an.forEach((e=>{$("<option>",{value:e.value,text:e.text}).appendTo(n)})),e.logic&&n.val(e.logic);const a=$("<input>",{type:"text",class:"input-value",css:{width:"100%"}}).wrap('<div class="input-value-wrapper"></div>').val(e.value);return a.typedInput({types:rn}),a.typedInput("type",e.valueType),[t,i,n,a.parent()]}(e);case ue.State:default:return function(e){e.hasOwnProperty("logic")||(e.logic="is");const t=$("<span />",{text:"Entity Property",class:"property-label"}),n=$("<div />",{class:"input-property virtual-select"});VirtualSelect.init({ele:n[0],hideClearButton:!0,search:!0,maxWidth:"100%",placeholder:"",allowNewOption:!0,optionsCount:6,selectedValue:e.property}),un((e=>{n[0].setOptions(e,!0)}));const a=$("<select/>",{class:"input-logic"}).on("change",(function(){const e=$(this).val();let t=sn;switch(e===i.JSONata?(n[0].disable(),n[0].reset()):n[0].enable(),e){case i.Is:case i.IsNot:break;case i.IsLessThan:case i.IsLessThanOrEqual:case i.IsGreaterThan:case i.IsGreaterThanOrEqual:t=[l.Number,l.JSONata,l.Message,l.Flow,l.Global,on];break;case i.Includes:case i.DoesNotInclude:case i.StartsWith:case i.InGroup:t=[l.String,l.JSONata,l.Message,l.Flow,l.Global,on];break;case i.JSONata:t=[l.JSONata]}o.typedInput("types",t)}));for(const e in nn)a.append($("<option></option>").val(nn[e].value).text(nn[e].text));const o=$("<input />",{class:"input-value",type:"text",css:{width:"100%"}}).wrap('<div class="input-value-wrapper"></div>').val(e.value);return o.typedInput({types:sn}),o.typedInput("type",e.valueType),e.logic&&a.val(e.logic).trigger("change"),[t,n,a,o.parent()]}(e)}}var dn,cn,vn,yn,gn,hn;class fn{constructor({types:e,element:t}){dn.add(this),cn.set(this,void 0),vn.set(this,void 0),it(this,vn,e,"f"),it(this,cn,$(t),"f"),this.init()}init(){tt(this,cn,"f").addClass("property-selector"),tt(this,cn,"f").editableList({addButton:!1,removable:!0,height:"auto",addItem:(e,t,i)=>{pn(i).forEach((t=>e.append(t))),e.addClass("property-selector")},buttons:tt(this,dn,"m",gn).call(this)})}addId(e){e.condition||(e.condition=ue.State),tt(this,cn,"f").editableList("addItem",e)}clear(){tt(this,cn,"f").find(".id-delete-button").trigger("click")}refreshOptions(){tt(this,cn,"f").editableList("items").each((function(){const e=$(this),{condition:t}=e.data("data");if(!mn(t))return;const i=e.find(".virtual-select");i.length&&un((e=>{i[0].setOptions(e,!0)}))}))}}function mn(e){return Object.values(ue).includes(e)}function bn(e){const t=$(e).editableList("items"),i=[];return t.each((function(){const{condition:e}=$(this).data("data");let t;switch(e){case ue.Device:case ue.Area:case ue.Floor:case ue.Label:t=function(e,t){const i=$(e),n=i.find("select.input-property").val(),a=i.find("select.input-logic").val(),o=i.find("input.input-value");return{condition:t,property:n,logic:a,value:o.typedInput("value"),valueType:o.typedInput("type")}}(this,e);break;case ue.State:default:t=function(e){const t=$(e),i=t.find(".input-property")[0].value,n=t.find("select.input-logic").val(),a=t.find(".input-value").typedInput("value"),o=t.find(".input-value").typedInput("type");return{condition:ue.State,property:i,logic:n,value:a,valueType:o}}(this)}(function(e){return mn(e.condition)&&void 0!==e.property&&void 0!==e.logic&&void 0!==e.value&&void 0!==e.valueType})(t)&&i.push(t)})),i}cn=new WeakMap,vn=new WeakMap,dn=new WeakSet,yn=function(e){return{label:p(`home-assistant.component.property-selector.label.add-button.${e}`),icon:"fa fa-plus",class:"red-ui-editableList-add",click:()=>{tt(this,cn,"f").editableList("addItem",{condition:e})}}},gn=function(){return tt(this,vn,"f").map((e=>tt(this,dn,"m",yn).call(this,e)))},function(e){e.Array="array",e.Count="count",e.Random="random",e.Split="split"}(hn||(hn={}));const Tn={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:1,outputs:1,icon:"ha-get-entities.svg",paletteLabel:"get entities",label:function(){return this.name||"get entities"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haGetEntitiesVersion",0)},rules:{value:[{condition:ue.State,property:"",logic:i.Is,value:"",valueType:l.String}]},outputType:{value:hn.Array},outputEmptyResults:{value:!1},outputLocationType:{value:l.Message},outputLocation:{value:"payload"},outputResultsCount:{value:1,validate:function(e){return $("#node-input-outputType").val()!==hn.Random||Number.isInteger(Number(e))}},output_type:{value:void 0},output_empty_results:{value:void 0},output_location_type:{value:void 0},output_location:{value:void 0},output_results_count:{value:void 0}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server",(()=>{e.refreshOptions()}));const e=new fn({element:"#conditions-list",types:[ue.State,ue.Device,ue.Area,ue.Floor,ue.Label]});this.rules.forEach((t=>{e.addId(t)})),$("#node-input-outputLocation").typedInput({types:[l.Message,l.Flow,l.Global],typeField:"#node-input-outputLocationType"}),$("#node-input-outputResultsCount").spinner({min:1}),$("#node-input-outputType").on("change",(function(){switch($(".output-option").hide(),$(this).val()){case hn.Array:$("#output_empty_results").show(),$("#output_location").show();break;case hn.Count:$("#output_location").show();break;case hn.Random:$("#output_results_count").show(),$("#output_location").show();case hn.Split:}})).trigger("change"),ai("get-entities")},oneditsave:function(){this.rules=bn("#conditions-list")}};var _n,$n;!function(e){e.Array="array",e.Split="split"}(_n||(_n={})),function(e){e.Equals="equals",e.Regex="regex"}($n||($n={}));const Sn={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:1,outputs:1,icon:"ha-get-history.svg",paletteLabel:"get history",label:function(){if(this.name)return this.name;if(this.useRelativeTime&&this.relativeTime)return this.relativeTime;if(this.startDate){const e=new Date(this.startDate);return`${e.toLocaleDateString()} ${e.toLocaleTimeString()}`}return"get history"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("apiGetHistoryVersion",0)},startDate:{value:""},endDate:{value:""},entityId:{value:""},entityIdType:{value:$n.Equals},useRelativeTime:{value:!0},relativeTime:{value:""},flatten:{value:!0},outputType:{value:_n.Array},outputLocationType:{value:l.Message},outputLocation:{value:"payload"},startdate:{value:void 0},enddate:{value:void 0},entityid:{value:void 0},entityidtype:{value:void 0},output_type:{value:void 0},output_location_type:{value:void 0},output_location:{value:void 0}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),wi({root:"#node-input-entityId"}),$("#node-input-useRelativeTime").on("change",(function(){this.checked?($(".relative_row").show(),$(".date_row").hide()):($(".relative_row").hide(),$(".date_row").show())})),$("#node-input-outputLocation").typedInput({types:[l.Message,l.Flow,l.Global],typeField:"#node-input-outputLocationType"}),$("#node-input-outputType").on("change",(e=>{const t=e.target;$(".output-option").toggle(t.value===_n.Array)})).trigger("change"),ai("get-history")}},En={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:0,outputs:1,icon:"font-awesome/fa-hashtag",align:"left",paletteLabel:"number",label:function(){return this.name||"number"},labelStyle:St.labelStyle,defaults:{name:{value:""},version:{value:RED.settings.get("haNumberVersion",0)},debugenabled:{value:!1},inputs:{value:0},outputs:{value:1},entityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Number,required:!0},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},mode:{value:r.Listen},value:{value:"payload"},valueType:{value:l.Message},outputProperties:{value:[{property:"payload",propertyType:l.Message,value:"",valueType:l.Value},{property:"previousValue",propertyType:l.Message,value:"",valueType:l.PreviousValue}],validate:Qt}},oneditprepare:function(){St.setup(this),H(this),bi(a.Number),bi(a.Switch,"exposeAsEntityConfig"),$("#node-input-mode").on("change",(function(){$("#node-input-value").parent().toggle(this.value===r.Set),$("#node-input-inputs").val(this.value===r.Listen?0:1)})),$("#node-input-value").typedInput({types:[l.Message,l.Flow,l.Global,l.JSONata,l.Number],typeField:"#node-input-valueType",type:this.valueType}),Zt(this.outputProperties,{extraTypes:[l.Value,l.PreviousValue]}),ai("number")},oneditsave:function(){this.outputProperties=Yt()}},wn={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:0,outputs:1,outputLabels:[p("poll-state.output_label.if_state_true"),p("poll-state.output_label.if_state_false")],icon:"ha-poll-state.svg",paletteLabel:"poll state",label:function(){return this.name||`poll state: ${this.entityId}`},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("pollStateVersion",0)},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},updateInterval:{value:"60"},updateIntervalType:{value:l.Number},updateIntervalUnits:{value:u.Seconds},outputInitially:{value:!1},outputOnChanged:{value:!1},entityId:{value:"",required:!0},stateType:{value:Qi.String},ifState:{value:""},ifStateType:{value:l.String},ifStateOperator:{value:i.Is},outputs:{value:1},outputProperties:{value:[{property:"payload",propertyType:l.Message,value:"",valueType:"entityState"},{property:"data",propertyType:l.Message,value:"",valueType:"entity"},{property:"topic",propertyType:l.Message,value:"",valueType:"triggerId"}],validate:Qt},exposeToHomeAssistant:{value:void 0},haConfig:{value:void 0},updateinterval:{value:void 0},outputinitially:{value:void 0},outputonchanged:{value:void 0},entity_id:{value:void 0},state_type:{value:void 0},halt_if:{value:void 0},halt_if_type:{value:void 0},halt_if_compare:{value:void 0}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),H(this),wi({root:"#node-input-entityId"}),bi(a.Switch,"exposeAsEntityConfig"),$("#node-input-updateInterval").typedInput({types:[l.Number,l.JSONata],typeField:"#node-input-updateIntervalType"}),Di("#node-input-ifState","#node-input-ifStateType","#node-input-ifStateOperator"),Zt(this.outputProperties,{extraTypes:["entity","entityId","entityState"]}),ai("poll-state")},oneditsave:function(){const e=$("#node-input-ifState").val()?2:1;$("#node-input-outputs").val(e),this.outputProperties=Yt()}};let Dn;const On={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:1,outputs:1,icon:"ha-render-template.svg",paletteLabel:"render template",label:function(){return this.name||"template"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("apiRenderTemplateVersion",0)},template:{value:""},resultsLocation:{value:"payload"},resultsLocationType:{value:l.Message},templateLocation:{value:""},templateLocationType:{value:l.None}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server");const e=$("#node-input-template");$("#node-input-templateLocation").typedInput({types:[l.Message,l.Flow,l.Global,{value:l.None,label:"none",hasValue:!1}],typeField:"#node-input-templateLocationType"}),$("#node-input-resultsLocation").typedInput({types:[l.Message,l.Flow,l.Global],typeField:"#node-input-resultsLocationType"}),Dn=RED.editor.createEditor({id:"node-input-template-editor",mode:"ace/mode/text",value:e.val()}),ai("render-template")},oneditresize:function(){var e;const t=$("#dialog-form>div:not(.node-text-editor-row)"),i=$("#dialog-form>div.node-text-editor-row"),n=$(".node-text-editor");let a=null!==(e=$("#dialog-form").height())&&void 0!==e?e:0;for(let e=0;e<t.length;e++){const i=$(t[e]).outerHeight(!0);"number"==typeof i&&(a-=i)}a-=parseInt(i.css("marginTop"))+parseInt(i.css("marginBottom")),n.css("height",`${a}px`),null==Dn||Dn.resize()},oneditcancel:function(){null==Dn||Dn.destroy(),Dn=void 0},oneditsave:function(){var e;const t=null!==(e=null==Dn?void 0:Dn.getValue())&&void 0!==e?e:"";$("#node-input-template").val(t),null==Dn||Dn.destroy(),Dn=void 0}},xn={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:0,outputs:1,icon:"font-awesome/fa-list",align:"left",paletteLabel:"select",label:function(){return this.name||"select"},labelStyle:St.labelStyle,defaults:{name:{value:""},version:{value:RED.settings.get("haTextVersion",0)},debugenabled:{value:!1},inputs:{value:0},outputs:{value:1},entityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Select,required:!0},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},mode:{value:r.Listen},value:{value:"payload"},valueType:{value:l.Message},outputProperties:{value:[{property:"payload",propertyType:l.Message,value:"",valueType:l.Value},{property:"previousValue",propertyType:l.Message,value:"",valueType:l.PreviousValue}],validate:Qt}},oneditprepare:function(){St.setup(this),H(this),bi(a.Select),bi(a.Switch,"exposeAsEntityConfig");const e=$("#node-input-value").parent();$("#node-input-mode").on("change",(function(){e.toggle(this.value===r.Set),$("#node-input-inputs").val(this.value===r.Listen?0:1)})),$("#node-input-value").typedInput({types:[l.Message,l.Flow,l.Global,l.JSONata,l.String],typeField:"#node-input-valueType",type:this.valueType}),Zt(this.outputProperties,{extraTypes:[l.Value,l.PreviousValue]}),ai("select")},oneditsave:function(){this.outputProperties=Yt()}},In=["msg","flow","global","jsonata","str","num","bool"],Cn=["str","num","bool","date","jsonata","msg","flow","global"],jn={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:1,outputs:1,icon:"font-awesome/fa-genderless",align:"right",paletteLabel:"sensor",label:function(){return this.name||"sensor"},labelStyle:St.labelStyle,defaults:{name:{value:""},entityConfig:{value:"",type:s.EntityConfig,filter:e=>"sensor"===e.entityType,required:!0},version:{value:RED.settings.get("haSensorVersion",0)},state:{value:"payload"},stateType:{value:"msg"},attributes:{value:[]},inputOverride:{value:"allow"},outputProperties:{value:[],validate:Qt}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),H(this);$("#node-input-state").typedInput({types:In,typeField:"#node-input-stateType",type:this.stateType}),bi(a.Sensor),$("#attributes").editableList({removable:!0,addButton:"add attribute",header:$("<div>").append($.parseHTML("<div style='width:40%; display: inline-grid'>Attribute Key</div><div style='display: inline-grid'>Value</div>")),addItem:function(e,t,i){const n=$("<div />").appendTo(e);$("<input />",{type:"text",name:"property",style:"width: 40%;margin-right: 5px;"}).attr("autocomplete","disable").appendTo(n).val(i.property);const a=$("<input />",{type:"text",name:"value",style:"width: 55%;"}).appendTo(n).val(i.value);a.typedInput({types:Cn}),a.typedInput("type",i.valueType)}}).editableList("addItems",this.attributes),Zt(this.outputProperties,{extraTypes:["sentData"]}),ai("sensor")},oneditsave:function(){this.attributes=[];const e=this;$("#attributes").editableList("items").each((function(){const t=$(this);e.attributes.push({property:t.find("input[name=property]").val(),value:t.find("input[name=value]").typedInput("value"),valueType:t.find("input[name=value]").typedInput("type")})})),this.outputProperties=Yt()}},Rn={category:bt.HomeAssistant,color:Tt.Beta,outputs:1,outputLabels:"",icon:"font-awesome/fa-comment-o",paletteLabel:"sentence",label:function(){return this.name||"sentence"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haSentenceVersion",0)},inputs:{value:0},outputs:{value:1},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},mode:{value:j.Trigger},sentences:{value:[],validate:function(e){return e.length>0||this.mode!==j.Trigger}},response:{value:""},responseType:{value:l.String},triggerResponse:{value:""},triggerResponseType:{value:R.Fixed},responseTimeout:{value:1e3},outputProperties:{value:[{property:"topic",propertyType:l.Message,value:"",valueType:l.TriggerId},{property:"payload",propertyType:l.Message,value:"",valueType:l.TriggerId}],validate:Qt}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),H(this),bi(a.Switch,"exposeAsEntityConfig"),$("#dialog-form").prepend(St.betaWarning(981));const e=this;$("#node-input-mode").on("change",(function(){$("#node-input-inputs").val(this.value===j.Trigger?0:1);const t=$("#node-input-mode").val();$(".sentence-trigger").toggle(t===j.Trigger),$(".sentence-response").toggle(t===j.Response),$("#node-input-response").typedInput({types:[l.String,l.JSONata,l.Message,l.Flow,l.Global],typeField:"#node-input-responseType",type:e.responseType})})),$("#node-input-triggerResponseType").on("change",(function(){const e=this.value;$("#node-input-responseTimeout").parent().toggle(e===R.Dynamic),$("#node-input-triggerResponse").siblings("label").text(p(e===R.Fixed?"ha-sentence.label.response":"ha-sentence.label.fallback_response"))})).trigger("change"),$("#node-input-sentences-container").editableList({addButton:!0,removable:!0,height:"auto",header:$("<div>").append(this._("ha-sentence.label.sentences")),addItem:function(e,t,i){$("<input />",{type:"text",value:"string"==typeof i?i:"",style:"width: 100%"}).appendTo(e)}}).editableList("addItems",this.sentences.length?this.sentences:[""]),Zt(this.outputProperties,{extraTypes:[l.TriggerId,l.Results,l.DeviceId]}),ai("sentence")},oneditsave:function(){const e=[];$("#node-input-sentences-container").editableList("items").each((function(){const t=$(this).find("input").val();t&&e.push(t)})),this.sentences=e,this.outputProperties=Yt()}},kn={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:0,outputs:1,icon:"font-awesome/fa-toggle-on",align:"left",paletteLabel:"switch",label:function(){return this.name||"switch"},labelStyle:St.labelStyle,defaults:{name:{value:""},version:{value:RED.settings.get("haSwitchVersion",0)},debugenabled:{value:!1},inputs:{value:0},outputs:{value:2},entityConfig:{value:"",type:s.EntityConfig,filter:e=>"switch"===e.entityType,required:!0},enableInput:{value:!1},outputOnStateChange:{value:!1},outputProperties:{value:[{property:"outputType",propertyType:"msg",value:"state change",valueType:"str"},{property:"payload",propertyType:"msg",value:"",valueType:"entityState"}],validate:Qt}},oneditprepare:function(){St.setup(this),H(this),bi(a.Switch),Zt(this.outputProperties,{extraTypes:["entityState"]}),$("#node-input-outputOnStateChange").on("change",(function(){$("#ha-custom-ouputs").toggle($(this).is(":checked"))})),ai("switch")},oneditsave:function(){this.outputProperties=Yt(),$("#node-input-inputs").val($("#node-input-enableInput").is(":checked")?1:0)}},An={category:bt.HomeAssistant,color:Tt.HaBlue,outputs:1,icon:"font-awesome/fa-tag",paletteLabel:"tag",label:function(){return this.name||"tag"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haTagVersion",0)},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},tags:{value:[""],required:!0,validate:function(e){return!!e.length}},devices:{value:[]},outputProperties:{value:[{property:"payload",propertyType:"msg",value:"",valueType:"eventData"},{property:"topic",propertyType:"msg",value:"",valueType:"triggerId"}],validate:Qt},exposeToHomeAssistant:{value:void 0},haConfig:{value:void 0}},oneditprepare:function(){St.setup(this),H(this);const e=$("#tags"),i=$("#devices");let n=[];const o=this._;bi(a.Switch,"exposeAsEntityConfig");e.editableList({addButton:!0,removable:!0,height:"auto",header:$("<div>").append(o("ha-tag.label.tags")),addItem:function(e,i,a){const s=$("<div />").appendTo(e);$("<span />",{text:o("ha-tag.label.tag"),style:"padding-right: 74px;"}).appendTo(s),((e,i)=>{const a=$("<select>",{width:"70%"}).append($("<option>").attr({value:t,selected:i===t}).text(o("ha-tag.label.all_tags"))).appendTo(e);n.forEach((e=>{$("<option>").attr({value:e.id,selected:e.id===i}).text(e.name||e.id).appendTo(a)}))})(s,a)},buttons:[{id:"ha-tag-update-tag-list",label:o("ha-tag.label.update_tag_list"),icon:"fa fa-refresh",click:()=>{pt(r,"tags",{params:{update:!0}})}}]}),$("#ha-tag-update-tag-list").css("float","right").css("margin-right","unset");function s(e,t){const i=e.name||e.tag_id,n=t.name||t.tag_id;return i===n?0:i.localeCompare(n)}const r=i=>{n=i.sort(s);const a=new Set;e.editableList("items").each((function(){const e=$(this).find("select").val();a.add(e)}));const o=Array.from(a).filter((e=>e===t||n.find((t=>t.id===e))));e.editableList("empty"),e.editableList("addItems",o),$("#no-tags-found").toggle(0===n.length)};rt(this,"#node-input-server"),lt("tags",(t=>{n=t,e.editableList("addItems",this.tags),r(t)})),$("#update-tag-list").on("click",(()=>{pt(r,"tags",{params:{update:!0}})})),i.editableList({addButton:!0,removable:!0,height:"auto",header:$("<div>").append(o("ha-tag.label.devices")),addItem:function(e,t,i){const n=$("<div />").appendTo(e);$("<span />",{text:o("ha-tag.label.device_id"),style:"padding-right: 35px;"}).appendTo(n);const a=$.isEmptyObject(i)?"":i;$("<input />",{type:"text",class:"input-device"}).appendTo(n).val(a)}}),i.editableList("addItems",this.devices),Zt(this.outputProperties,{extraTypes:["eventData","tagId"]}),ai("tag")},oneditsave:function(){const e=$("#tags").editableList("items"),t=$("#devices").editableList("items"),i=new Set,n=new Set;e.each((function(){const e=$(this).find("select").val();i.add(e)})),t.each((function(){const e=$(this).find(".input-device").val();e.trim().replace(/\s/g,"").length&&n.add(e)})),this.tags=Array.from(i),this.devices=Array.from(n),this.outputProperties=Yt()}},Pn={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:0,outputs:1,icon:"font-awesome/fa-font",align:"left",paletteLabel:"text",label:function(){return this.name||"text"},labelStyle:St.labelStyle,defaults:{name:{value:""},version:{value:RED.settings.get("haTextVersion",0)},debugenabled:{value:!1},inputs:{value:0},outputs:{value:1},entityConfig:{value:"",type:s.EntityConfig,filter:e=>"text"===e.entityType,required:!0},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},mode:{value:r.Listen},value:{value:"payload"},valueType:{value:l.Message},outputProperties:{value:[{property:"payload",propertyType:l.Message,value:"",valueType:l.Value},{property:"previousValue",propertyType:l.Message,value:"",valueType:l.PreviousValue}],validate:Qt}},oneditprepare:function(){St.setup(this),H(this),bi(a.Text),bi(a.Switch,"exposeAsEntityConfig");const e=$("#node-input-value").parent();$("#node-input-mode").on("change",(function(){e.toggle(this.value===r.Set),$("#node-input-inputs").val(this.value===r.Listen?0:1)})),$("#node-input-value").typedInput({types:[l.Message,l.Flow,l.Global,l.JSONata,l.String],typeField:"#node-input-valueType",type:this.valueType}),Zt(this.outputProperties,{extraTypes:[l.Value,l.PreviousValue]}),ai("text")},oneditsave:function(){this.outputProperties=Yt()}},Ln={category:bt.HomeAssistant,color:Tt.HaBlue,outputs:1,icon:"font-awesome/fa-clock-o",paletteLabel:"time",label:function(){return this.name||(this.entityId?`${this.entityId}.${this.property||"state"}`:"time")},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haTimeVersion",0)},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},entityId:{value:"",required:!0},property:{value:""},offset:{value:"0"},offsetType:{value:"num"},offsetUnits:{value:"minutes"},randomOffset:{value:!1},repeatDaily:{value:!1},outputProperties:{value:[{property:"payload",propertyType:"msg",value:"",valueType:"entityState"},{property:"data",propertyType:"msg",value:"",valueType:"entity"},{property:"topic",propertyType:"msg",value:"",valueType:"triggerId"}],validate:Qt},sunday:{value:!0},monday:{value:!0},tuesday:{value:!0},wednesday:{value:!0},thursday:{value:!0},friday:{value:!0},saturday:{value:!0},ignorePastDate:{value:!0},debugenabled:{value:void 0},exposeToHomeAssistant:{value:void 0},haConfig:{value:void 0},payload:{value:void 0},payloadType:{value:void 0}},oneditprepare:function(){St.setup(this);const e=$("#node-input-server"),t=$("#node-input-entityId");rt(this,"#node-input-server"),H(this),bi(a.Switch,"exposeAsEntityConfig"),wi({root:"#node-input-entityId"}),$("#node-input-property").autocomplete({source:(i,n)=>{const a=function(e,t){if(!(e in g))return[];const i=t in g[e]?Object.keys(O(g[e][t])):Object.values(g[e]).map((e=>Object.keys(O(e))));return[...new Set([].concat(...i))].sort(((e,t)=>!e.includes(".")&&t.includes(".")?-1:e.includes(".")&&!t.includes(".")?1:e<t?-1:e>t?1:0))}(e.val(),t.val());n($.ui.autocomplete.filter(a,i.term))},minLength:0}),$("#node-input-offset").typedInput({types:["num","jsonata"],typeField:"#node-input-offsetType"}),$("#node-input-payload").typedInput({types:["str","num","bool","jsonata","date"],typeField:"#node-input-payloadType"}),$("#node-input-repeatDaily").on("change",(function(){$("#days-of-the-week").toggle($(this).is(":checked"))})).trigger("change"),Zt(this.outputProperties,{extraTypes:["entityState","entityId","entity"]}),ai("time")},oneditsave:function(){this.outputProperties=Yt()}},Nn={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:0,outputs:1,icon:"font-awesome/fa-clock-o",align:"left",paletteLabel:"time",label:function(){return this.name||"time entity"},labelStyle:St.labelStyle,defaults:{name:{value:""},version:{value:RED.settings.get("haTimeEntityVersion",0)},debugenabled:{value:!1},inputs:{value:0},outputs:{value:1},entityConfig:{value:"",type:s.EntityConfig,filter:e=>"time"===e.entityType,required:!0},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},mode:{value:r.Listen},value:{value:"payload"},valueType:{value:l.Message},outputProperties:{value:[{property:"payload",propertyType:l.Message,value:"",valueType:l.Value},{property:"previousValue",propertyType:l.Message,value:"",valueType:l.PreviousValue}],validate:Qt}},oneditprepare:function(){St.setup(this),H(this),bi(a.Time),bi(a.Switch,"exposeAsEntityConfig");const e=$("#node-input-value").parent();$("#node-input-mode").on("change",(function(){e.toggle(this.value===r.Set),$("#node-input-inputs").val(this.value===r.Listen?0:1)})),$("#node-input-value").typedInput({types:[l.Message,l.Flow,l.Global,l.JSONata,l.String],typeField:"#node-input-valueType",type:this.valueType}),Zt(this.outputProperties,{extraTypes:[l.Value,l.PreviousValue]}),ai("time-entity")},oneditsave:function(){this.outputProperties=Yt()}};var Bn,Hn,Vn,Mn;!function(e){e.ThisEntity="this_entity",e.EntityId="entity_id"}(Bn||(Bn={})),function(e){e.CurrentState="current_state",e.PreviousState="previous_state",e.Property="property"}(Hn||(Hn={})),function(e){e.Default="default",e.Custom="custom",e.Payload="payload"}(Vn||(Vn={})),function(e){e.Always="always",e.CurrentState="current_state",e.PreviousState="previous_state",e.Property="property"}(Mn||(Mn={}));const Fn={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:0,outputs:2,outputLabels:function(e){if(0===e)return"allowed";if(1===e)return"blocked";const t=this.customOutputs[e-2];let i;return i=t.comparatorPropertyType===Mn.Always?"always sent":`${t.comparatorPropertyType.replace("_"," ")} ${t.comparatorType.replace("_","")} ${t.comparatorValue}`,i},icon:"font-awesome/fa-map-signs",paletteLabel:"trigger: state",label:function(){let e=[];return this.entities&&Object.entries(this.entities).forEach((([,t])=>{Array.isArray(t)&&(null==t?void 0:t.length)&&(e=[...e,...t])})),this.name||`trigger-state: ${e}`},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("triggerStateVersion",0)},inputs:{value:0},outputs:{value:2},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},entities:{value:{[le.Entity]:[""],[le.Substring]:[],[le.Regex]:[]}},debugEnabled:{value:!1},constraints:{value:[{targetType:Bn.ThisEntity,targetValue:"",propertyType:Hn.CurrentState,propertyValue:"new_state.state",comparatorType:i.Is,comparatorValueDatatype:l.String,comparatorValue:""}]},customOutputs:{value:[]},outputInitially:{value:!1},stateType:{value:Qi.String},enableInput:{value:!1},entityId:{value:void 0},entityIdType:{value:void 0},exposeToHomeAssistant:{value:void 0},haConfig:{value:void 0},entityid:{value:void 0},entityidfiltertype:{value:void 0},debugenabled:{value:void 0},customoutputs:{value:void 0},outputinitially:{value:void 0},state_type:{value:void 0}},oneditprepare:function(){St.setup(this);const e=$("#constraint-list"),t=$("#output-list");rt(this,"#node-input-server",(()=>{i.refreshOptions()})),bi(a.Switch,"exposeAsEntityConfig");const i=new Ft({element:"#entity-list",types:[le.Entity,le.Substring,le.Regex],headerText:p("server-state-changed.label.entities")});Object.entries(this.entities).forEach((([e,t])=>{null==t||t.forEach((t=>{i.addId(e,t)}))}));let n=[],o=[],s=[];lt("entities",(e=>{n=e})),lt("properties",(e=>{o=e,s=[...e.map((e=>`new_state.${e}`)),...e.map((e=>`old_state.${e}`))].sort()})),H(this);const r=$("#node-input-outputs").val('{"0": 0, "1": 1}'),u=()=>JSON.parse(r.val()),d=e=>{r.val(JSON.stringify(e))},c=e=>{t.editableList("items").each((function(t){const i=$(this).data("data");e[Object.prototype.hasOwnProperty.call(i,"index")?i.index:i._index]=t+2}))};e.on("change",".target-type",(function(){const e=$(this),t=e.val()===Bn.ThisEntity,i=e.parent().parent(),n=e.next(),a=i.find(".property-type");t?n.attr("disabled","disabled").val(""):n.removeAttr("disabled"),a.find(`option[value=${Hn.PreviousState}]`).toggle(t),a.val()===Hn.PreviousState&&a.val(Hn.CurrentState).trigger("change")})),e.on("change",".property-type",(function(e){const t=e.target.value;[Hn.CurrentState,Hn.PreviousState].includes(t)?$(this).next().attr("disabled","disabled").val(""):$(this).next().removeAttr("disabled")})),t.on("change",".comparator-property-type",(function(e){const t=e.target.value,i=$(this).parent().parent(),n=i.find(".comparator-type"),a=i.find(".comparator-value"),o=i.find(".comparator-property-value");switch(t){case"always":o.attr("disabled","disabled"),n.attr("disabled","disabled"),a.attr("disabled","disabled"),o.val("");break;case"previous_state":case"current_state":o.attr("disabled","disabled"),n.removeAttr("disabled"),a.removeAttr("disabled"),o.val("");break;case"property":o.removeAttr("disabled"),n.removeAttr("disabled"),a.removeAttr("disabled")}}));e.editableList({addButton:!0,removable:!0,height:"auto",header:$("<div>").append(p("trigger-state.label.conditions")),addItem:(e,t,i)=>{if($("#constraint-template").children().clone().appendTo(e),e.find(".target-value").autocomplete({source:(e,t)=>{const i=e.term.toLowerCase(),a=n.filter((e=>e.includes(i)));t(a)},minLength:0}),e.find(".property-value").autocomplete({source:(t,i)=>{const n=t.term.toLowerCase();i((e.find(".target-type").val()===Bn.ThisEntity?s:o).filter((e=>e.includes(n))))},minLength:0}),e.find(".comparator-value").typedInput({default:"str",types:["str","num","bool","re","jsonata",{value:"entity",label:"entity."},{value:"prevEntity",label:"prev entity."}]}),$.isEmptyObject(i))return;e.find(".target-type").val(i.targetType).trigger("change"),e.find(".target-value").val(i.targetValue),e.find(".property-type").val(i.propertyType).trigger("change"),i.propertyType===Hn.Property&&e.find(".property-value").val(i.propertyValue),e.find(".comparator-type").val(i.comparatorType);const a=e.find(".comparator-value");a.typedInput("type",i.comparatorValueDatatype),a.typedInput("value",i.comparatorValue)}}),e.editableList("addItems",this.constraints.length?this.constraints:[]),t.on("change",".message-type",(function(e){const t=e.target.value;$(this).parent().find(".message-value").typedInput("default"===t?"hide":"show")})),t.on("change",".comparator-property-type",(function(e){const t=e.target.value,i=$(this).parent().parent(),n=i.find(".comparator-property-value"),a=i.find(".comparator-type"),o=i.find(".comparator-value");switch(t){case Mn.Always:n.attr("disabled","disabled"),a.attr("disabled","disabled"),o.typedInput("hide"),n.val("");break;case Mn.PreviousState:case Mn.CurrentState:n.attr("disabled","disabled"),a.removeAttr("disabled"),o.typedInput("show"),n.val("");break;case Mn.Property:n.removeAttr("disabled"),a.removeAttr("disabled"),o.typedInput("show")}})),t.editableList({addButton:!0,removable:!0,sortable:!0,height:"auto",header:$("<div>").append("Custom outputs"),addItem:function(e,t,i){i.hasOwnProperty("condition")||(i.condition={});const n=i.condition;i.hasOwnProperty("index")||(i._index=Math.floor(563609*Math.random()).toString()),$("#output-template").children().clone().appendTo(e),e.css({overflow:"hidden",whiteSpace:"nowrap"}),e.find(".message-value").typedInput({default:l.JSON,types:[l.String,l.Number,l.Boolean,l.JSON,l.JSONata]}),e.find(".comparator-property-value").autocomplete({source:(e,t)=>{const i=e.term.toLowerCase();t(s.filter((e=>e.includes(i))))},minLength:0}),e.find(".comparator-value").typedInput({default:l.String,types:[l.String,l.Number,l.Boolean,l.Regex,l.JSONata,{value:"entity",label:"entity."},{value:"prevEntity",label:"prev entity."}]});const a=u();if(a[i.hasOwnProperty("index")?i.index:i._index]=t+2,d(a),$.isEmptyObject(n))return void e.find(".message-type,.comparator-property-type").trigger("change");e.find(".message-type").val(n.messageType).trigger("change");const o=e.find(".message-value");o.typedInput("value",n.messageValue),o.typedInput("type",n.messageValueType),e.find(".comparator-property-type").val(n.comparatorPropertyType).trigger("change"),"property"===n.comparatorPropertyType&&e.find(".comparator-property-value").val(n.comparatorPropertyValue),e.find(".comparator-type").val(n.comparatorType);const r=e.find(".comparator-value");r.typedInput("value",n.comparatorValue),r.typedInput("type",n.comparatorValueDataType)},removeItem:function(e){const t=u();Object.prototype.hasOwnProperty.call(e,"index")?t[e.index]=-1:delete t[e._index],c(t),d(t)},sortItems:function(){const e=u();c(e),d(e)}}),this.customOutputs.forEach(((e,i)=>t.editableList("addItem",{condition:e,index:i+2}))),ai("trigger-state")},oneditsave:function(){const e=$("#constraint-list").editableList("items"),t=$("#output-list").editableList("items"),i=[],n=[];e.each((function(){const e=$(this),t=e.find(".comparator-value"),n={targetType:e.find(".target-type").val(),targetValue:e.find(".target-value").val(),propertyType:e.find(".property-type").val(),propertyValue:e.find(".property-value").val(),comparatorType:e.find(".comparator-type").val(),comparatorValueDatatype:t.typedInput("type"),comparatorValue:t.typedInput("value")};n.propertyType===Hn.CurrentState?n.propertyValue="new_state.state":n.propertyType===Hn.PreviousState&&(n.propertyValue="old_state.state"),i.push(n)})),t.each((function(){const e=$(this),t=e.find(".message-value"),i=e.find(".comparator-value"),a={messageType:e.find(".message-type").val(),messageValue:t.typedInput("value"),messageValueType:t.typedInput("type"),comparatorPropertyType:e.find(".comparator-property-type").val(),comparatorPropertyValue:e.find(".comparator-property-value").val(),comparatorType:e.find(".comparator-type").val(),comparatorValue:i.typedInput("value"),comparatorValueDataType:i.typedInput("type")};a.comparatorPropertyType===Mn.CurrentState?a.comparatorPropertyValue="new_state.state":a.comparatorPropertyType===Mn.PreviousState&&(a.comparatorPropertyValue="old_state.state"),n.push(a)})),$("#node-input-inputs").val($("#node-input-enableInput").is(":checked")?1:0),this.constraints=i,this.customOutputs=n;const a=Gt("#entity-list");this.entities={[le.Entity]:a[le.Entity],[le.Substring]:a[le.Substring],[le.Regex]:a[le.Regex]}}},qn={category:bt.HomeAssistantEntities,color:Tt.HaBlue,inputs:1,outputs:1,icon:"font-awesome/fa-asterisk",align:"right",paletteLabel:"update config",label:function(){return this.name||"update config"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},entityConfig:{value:"",type:s.EntityConfig,required:!1},version:{value:RED.settings.get("haSensorVersion",0)},outputProperties:{value:[],validate:Qt}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),"_ADD_"===this.entityConfig&&$("#node-input-entityConfig").val("_ADD_"),Zt(this.outputProperties),ai("update-config")},oneditsave:function(){this.outputProperties=Yt()}},Gn={category:bt.HomeAssistant,color:Tt.HaBlue,inputs:1,outputs:1,outputLabels:["","timed out"],icon:"ha-wait-until.svg",paletteLabel:"wait until",label:function(){return this.name||"wait until"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haWaitUntilVersion",0)},outputs:{value:1},entities:{value:{[le.Entity]:[""],[le.Substring]:[],[le.Regex]:[]}},property:{value:""},comparator:{value:i.Is},value:{value:""},valueType:{value:l.String},timeout:{value:"0"},timeoutType:{value:l.Number},timeoutUnits:{value:"seconds"},checkCurrentState:{value:!0},blockInputOverrides:{value:!0},outputProperties:{value:[]},entityId:{value:void 0},entityIdFilterType:{value:void 0},entityLocation:{value:void 0},entityLocationType:{value:void 0}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server",(()=>{e.refreshOptions()}));const e=new Ft({element:"#entity-list",types:[le.Entity,le.Substring,le.Regex],headerText:p("server-state-changed.label.entities")});Object.entries(this.entities).forEach((([t,i])=>{null==i||i.forEach((i=>{e.addId(t,i)}))}));let t=[];lt("properties",(e=>{t=e,$("#node-input-property").autocomplete({source:t,minLength:0})}));const n={value:"entity",label:"entity."},a=[l.String,l.Number,l.Boolean,l.Regex,l.JSONata,l.Message,l.Flow,l.Global,n];$("#node-input-value").typedInput({default:l.String,types:a,typeField:"#node-input-valueType"}),$("#node-input-comparator").on("change",(function(){let e=a;const t=$(this).val();switch($("#node-input-property").prop("disabled",t===l.JSONata),t){case i.Is:case i.IsNot:break;case i.IsLessThan:case i.IsLessThanOrEqual:case i.IsGreaterThan:case i.IsGreaterThanOrEqual:e=[l.Number,l.JSONata,l.Message,l.Flow,l.Global,n];break;case i.Includes:case i.DoesNotInclude:e=[l.String,l.JSONata,l.Message,l.Flow,l.Global];break;case i.JSONata:e=[l.JSONata]}$("#node-input-value").typedInput("types",e)})),$("#node-input-timeout").typedInput({default:l.Number,types:[l.Number,l.JSONata],typeField:"#node-input-timeoutType"});const s=$("#node-input-entityIdFilterType");s.on("change",(function(){$(".exact-only").toggle(s.val()===o.Exact)})),Zt(this.outputProperties,{extraTypes:["entity"]}),ai("wait-until")},oneditsave:function(){const e=Gt("#entity-list");this.entities={[le.Entity]:e[le.Entity],[le.Substring]:e[le.Substring],[le.Regex]:e[le.Regex]};const t=$("#node-input-timeoutType").val(),i=$("#node-input-timeout").val();this.outputs=t===l.JSONata||t===l.Number&&Number(i)>0?2:1,this.outputProperties=Yt()}};function Wn(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";return Array.from({length:e},(()=>t[Math.floor(62*Math.random())])).join("")}function Jn(){return["method_post","method_get","method_put","method_head"].some((e=>this[e]))}const zn={category:bt.HomeAssistant,color:Tt.HaBlue,outputs:1,outputLabels:"",icon:"ha-webhook.svg",paletteLabel:"webhook",label:function(){return this.name||"webhook"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haWebhookVersion",0)},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},outputs:{value:1},webhookId:{value:Wn(32),required:!0},method_get:{value:!1,validate:Jn},method_head:{value:!1,validate:Jn},method_post:{value:!0,validate:Jn},method_put:{value:!0,validate:Jn},outputProperties:{value:[{property:"topic",propertyType:"msg",value:"",valueType:"triggerId"},{property:"payload",propertyType:"msg",value:"",valueType:"data"}],validate:Qt},payloadLocation:{value:!1},payloadLocationType:{value:!1},headersLocation:{value:!1},headersLocationType:{value:!1}},oneditprepare:function(){St.setup(this),rt(this,"#node-input-server"),H(this);const e=$("#node-input-webhookId");bi(a.Switch,"exposeAsEntityConfig"),$("#copyId").on("click",(function(){const t=e.get(0),i=t.value;t.value=`https://<ip>:<port>/api/webhook/${i}`,t.select(),t.setSelectionRange(0,99999),document.execCommand("copy"),t.value=i})),$("#refresh").on("click",(function(){e.val(Wn(32))})),$("[id^=node-input-method_]").on("change",(function(){$("[id^=node-input-method_]").is(":checked")?$(this).closest("div").removeClass("input-error"):$(this).closest("div").addClass("input-error")})).trigger("change"),Zt(this.outputProperties,{extraTypes:["receivedData","headers","params","triggerId"]}),ai("webhook")},oneditsave:function(){this.outputProperties=Yt()}},Un={category:bt.HomeAssistant,color:Tt.HaBlue,outputs:1,icon:"font-awesome/fa-map-marker",paletteLabel:"zone",label:function(){return this.name||"zone"},labelStyle:St.labelStyle,defaults:{name:{value:""},server:{value:"",type:s.Server,required:!0},version:{value:RED.settings.get("haZoneVersion",0)},exposeAsEntityConfig:{value:"",type:s.EntityConfig,filter:e=>e.entityType===a.Switch,required:!1},entities:{value:[""],required:!0,validate:e=>!!e.length},event:{value:"enter"},zones:{value:[""],required:!0,validate:e=>!!e.length},exposeToHomeAssistant:{value:void 0},haConfig:{value:void 0}},oneditprepare:function(){St.setup(this);const e=$("#entities"),t=$("#zones");rt(this,"#node-input-server"),H(this),bi(a.Switch,"exposeAsEntityConfig"),e.editableList({addButton:!0,removable:!0,height:"auto",header:$("<div>").append("Entities"),addItem:function(e,t,i){const n=$("<div />").appendTo(e);$("<span />",{text:"Entity",style:"padding-right: 35px;"}).appendTo(n);const a=$.isEmptyObject(i)?"":i;wi({root:$("<input />",{type:"text",class:"input-entity"}).appendTo(n).val(a),options:{type:"trackers"}})}}),e.editableList("addItems",this.entities),t.editableList({addButton:!0,removable:!0,height:"auto",header:$("<div>").append("zones"),addItem:function(e,t,i){const n=$("<div />").appendTo(e);$("<span />",{text:"Zone",style:"padding-right: 35px;"}).appendTo(n);const a=$.isEmptyObject(i)?"":i;wi({root:$("<input />",{type:"text",class:"input-zone"}).appendTo(n).val(a),options:{type:"zones"}})}}),t.editableList("addItems",this.zones),ai("zone")},oneditsave:function(){const e=$("#entities").editableList("items"),t=$("#zones").editableList("items"),i=new Set,n=new Set;e.each((function(){const e=$(this).find(".input-entity").val().replace(/\s/g,"");e.length&&i.add(e)})),t.each((function(){const e=$(this).find(".input-zone").val().replace(/\s/g,"");e.length&&n.add(e)})),this.entities=Array.from(i),this.zones=Array.from(n)}},Kn={"homeassistant/areas/#":function(e,t){const i=T(e);v[i]=t},"homeassistant/devices/#":function(e,t){const i=T(e);y[i]=t},"homeassistant/entity/#":function(e,t){const i=T(e);g[i]||(g[i]={}),t.forEach((e=>{g[i][e.entity_id]=e}))},"homeassistant/entities/#":function(e,t){const i=T(e);g[i]=t},"homeassistant/floors/#":function(e,t){const i=T(e);h[i]=t},"homeassistant/labels/#":function(e,t){const i=T(e);f[i]=t},"homeassistant/integration/#":function(e,t){const i=e.split("/")[2];A[i]=t.version},"homeassistant/services/#":function(e,t){const i=T(e);m[i]=t},"homeassistant/entityRegistry/#":function(e,t){const i=T(e);b[i]=t},"homeassistant/issues":function(e,t){J=t,RED.events.emit(q.IssuesUpdated),z||(z=!0,function(){W=$(G({issuesCount:J.length}));const e=W.find("#notification-issues").on("click",(()=>{RED.events.emit(q.OpenIssues)}));RED.popover.tooltip(e,p("home-assistant.service.issue.tooltip_description")),W.prependTo(".red-ui-header-toolbar")}());const i=J.filter((e=>!e.hide)).length;W.toggle(i>0),W.find(".ha-issue-count").text(i)},"home-assistant-print-to-debug":function(e,t){RED.debug.handleDebugMessage(t)}};Object.entries(Kn).forEach((([e,t],i)=>{setTimeout((()=>{RED.comms.subscribe(e,t)}),150*i)})),function(){const e="home-assistant.ui.migrations",t=p(`${e}.title`),i=p(`${e}.warning`),n=p(`${e}.message`),a=p(`${e}.button_label`),o=p("home-assistant.ui.notifications.attention"),s=$.parseHTML(`<div id="ha-dialog-confirm" title="${t}">\n ${n}\n <div class="ui-state-error ha-alert-box"><strong>${o}:</strong> ${i}</div>\n </div>`),r=$.parseHTML(`<li><button id="upgrade-ha-node"><i class="fa fa-refresh"></i> ${a}</button></li>`);$("body").append(s),$("#red-ui-header .red-ui-header-toolbar").prepend(r)}(),Je=$("#upgrade-ha-node"),Je.hide(),Je.on("click",Ke),RED.editor.registerTypeEditor("ha_entity_filter",I),RED.events.on("nodes:add",(function(e){Xe(e)&&!Ze(e)&&Je.show()})),RED.events.on("nodes:remove",(function(e){Je.is(":visible")&&Xe(e)&&0===Qe()&&Je.hide()})),RED.events.on("editor:open",(function(){var e;const t=RED.view.selection(),i=null===(e=null==t?void 0:t.nodes)||void 0===e?void 0:e[0];i&&Xe(i)&&!Ze(i)&&(Ue(i),RED.nodes.dirty(!0),RED.notify(p("home-assistant.ui.migrations.node_schema_updated")))})),RED.events.on("runtime-state",(function e(){RED.events.off("runtime-state",e);const t=$($('script[data-template-name="ha_sidebar"]').i18n().html()),i=$($('script[data-template-name="ha_sidebar_toolbar"]').i18n().html());!function(e){const t=$("<div>",{id:"home-assistant-stack",class:"home-assistant-sidebar-stack"}).appendTo(e),i=RED.stack.create({container:t});ee=i.add({title:p("home-assistant.sidebar.stacks.server"),collapsible:!0}),te=i.add({title:p("home-assistant.sidebar.stacks.entity"),collapsible:!0}),ie=i.add({title:p("home-assistant.sidebar.stacks.device"),collapsible:!0}),ne=i.add({title:p("home-assistant.sidebar.stacks.issues"),collapsible:!0}),ae(),se(U()),RED.events.on(q.OpenIssues,(()=>{RED.sidebar.show("ha_sidebar"),ne.isExpanded()||ne.expand()})),RED.events.on(q.IssuesUpdated,(()=>{ne.content.find(".ha-issues-list").empty().append(re(U()))}))}(t),RED.sidebar.addTab({id:"ha_sidebar",label:"Home Assistant",name:"Home Assistant",content:t.get(0),closeable:!0,disableOnEdit:!0,iconClass:"fa fa-home",toolbar:i,onchange:()=>ae()}),$("#home-assistant-diagnostics-button").on("click",(function(e){e.preventDefault();const t=p("home-assistant.sidebar.diagnostics.fetching_data"),i=$(`\n <div id="home-assistant-diagnostics-dialog">\n <textarea id="home-assistant-diagnostics-textarea" style="width: 100%;resize: none;" rows="12" >${t}</textarea>\n </div>\n `);RED.keyboard.disable(),i.dialog({classes:{"ui-dialog":"red-ui-editor-dialog","ui-dialog-titlebar-close":"hide","ui-widget-overlay":"red-ui-editor-dialog"},modal:!0,closeOnEscape:!0,width:450,resizable:!1,draggable:!1,title:p("home-assistant.sidebar.diagnostics.environment_data"),close:function(){$("#home-assistant-diagnostics-dialog").dialog("destroy").remove(),RED.keyboard.enable()},buttons:[{text:p("home-assistant.sidebar.diagnostics.copy"),click:function(){const e=document.getElementById("home-assistant-diagnostics-textarea");K(e.value),RED.notify(p("home-assistant.sidebar.diagnostics.copied")),$(this).dialog("close")}},{text:p("home-assistant.sidebar.diagnostics.close"),click:function(){$(this).dialog("close")}}]}),$.get("homeassistant/diagnostics",(function(e){$("#home-assistant-diagnostics-textarea").val(e)})).fail((function(){$("#home-assistant-diagnostics-textarea").val(p("home-assistant.sidebar.diagnostics.failed_fetch"))}))}))})),RED.nodes.registerType(s.DeviceConfig,Vi),RED.nodes.registerType(s.EntityConfig,Zi),RED.nodes.registerType(s.Server,Ot),RED.nodes.registerType(s.API,gi),RED.nodes.registerType(s.Action,ci),RED.nodes.registerType(s.CurrentState,Oi),RED.nodes.registerType(s.Device,Hi),RED.nodes.registerType(s.Entity,Mi),RED.nodes.registerType(s.EventsAll,Xi),RED.nodes.registerType(s.EventsCalendar,Yi),RED.nodes.registerType(s.EventsState,en),RED.nodes.registerType(s.FireEvent,tn),RED.nodes.registerType(s.GetEntities,Tn),RED.nodes.registerType(s.GetHistory,Sn),RED.nodes.registerType(s.PollState,wn),RED.nodes.registerType(s.RenderTemplate,On),RED.nodes.registerType(s.Sentence,Rn),RED.nodes.registerType(s.Tag,An),RED.nodes.registerType(s.Time,Ln),RED.nodes.registerType(s.TriggerState,Fn),RED.nodes.registerType(s.WaitUntil,Gn),RED.nodes.registerType(s.Webhook,zn),RED.nodes.registerType(s.Zone,Un),RED.nodes.registerType(s.BinarySensor,$i),RED.nodes.registerType(s.Button,Si),RED.nodes.registerType(s.Number,En),RED.nodes.registerType(s.Select,xn),RED.nodes.registerType(s.Sensor,jn),RED.nodes.registerType(s.Switch,kn),RED.nodes.registerType(s.Text,Pn),RED.nodes.registerType(s.TimeEntity,Nn),RED.nodes.registerType(s.UpdateConfig,qn)}();</script>
<script type="text/html" data-help-name="api-call-service"><p>This node allows you to send a request to Home Assistant to perform specific actions. These actions could include tasks such as turning on a light (<code>light.turn_on</code>), selecting an option from a dropdown menu (<code>input_select.select_option</code>), or any other service call supported by Home Assistant. It serves as a bridge between Node-RED and Home Assistant, enabling automation flows to directly control devices or entities in your smart home setup.</p><div class="home-assistant-custom-block tip"><p class="custom-block-title">Helpful Examples</p><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/action.html" rel="noopener noreferrer">Action Tips and Tricks</a></p></div><h3>Configuration</h3><dl class="message-properties"><dt>Action <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a></li></ul><dd>Action to perform</dd><dt>Floor<span class="property-type">an array of floor ids</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a> for ids</li></ul><dd>A list of floor ids that will be used as targets for the action</dd><dt>Area<span class="property-type">an array of area ids</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a> for ids</li></ul><dd>A list of area ids that will be used as targets for the action</dd><dd>Custom ids can be inserted into the list by adding a <code>#</code> at the end of the id</dd><dt>Device<span class="property-type">an array of device ids</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a> for ids</li></ul><dd>A list of device ids that will be used as targets for the action</dd><dd>Custom ids can be inserted into the list by adding a <code>#</code> at the end of the id</dd><dt>Entity<span class="property-type">an array of entity ids</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a> for ids</li></ul><dd>A list of entity ids that will be used as targets for the action</dd><dt>Label<span class="property-type">an array of label ids</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a> for ids</li></ul><dd>A list of label ids that will be used as targets for the action</dd><dt>Data<span class="property-type">JSONata | JSON</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a> when data type is JSON</li></ul><dd>JSON object to pass along.</dd><dt>Merge Context<span class="property-type">string</span></dt><dd>If defined will attempt to merge the global and flow context variable into the config</dd><dt>Alternative Template Tags<span class="property-type">boolean</span></dt><dd>Will change the tags used for the mustache template to <code><%</code> and <code>%></code></dd><dt>Queue<span class="property-type">none | first | all | last</span></dt><dd>Will store the first, last, or all messages received while disconnected from Home Assistant and send them once connected again</dd><dt>Block Input Overrides<span class="property-type">boolean</span></dt><ul><li>Default: <code>true</code></li></ul><dd>Stop <code>msg.payload</code> values from overriding local config</dd></dl><h3>Input</h3><dl class="message-properties"><dd>All properties need to be under <code>msg.payload</code>.</dd><dd>Sample input</dd><pre><code class="language-JSON">{
"action": "homeassistant.turn_on",
"target": {
"floor_id": ["first_floor"],
"area_id": ["kitchen"],
"device_id": ["8932894082930482903"],
"entity_id": ["light.kitchen", "switch.garage_light"],
"label_id": ["outdoor_lights"]
}
"data": {
"brightness_pct": 50
}
}
</code></pre><h5>Merging</h5><dd>If the incoming message has a <code>payload</code> property with <code>action</code> set it will override any config values if set.</dd><dd>If the incoming message has a <code>payload.data</code> that is an object these properties will be <strong>merged</strong> with any config values set.</dd><dd>If the node has a property value in its config for <code>Merge Context</code> then the <code>flow</code> and <code>global</code> contexts will be checked for this property which should be an object that will also be merged into the data payload.</dd><h5>Merge Resolution</h5><dd>As seen above the <code>data</code> property has a lot going on in the way of data merging, in the end, all of these are optional and the rightmost will win if a property exists in multiple objects</dd><dd>Config Data, Global Data, Flow Data, Payload Data ( payload data property always wins if provided )</dd><dt>action<span class="property-type">string</span></dt><dd>Action to call</dd><dt>data<span class="property-type">JSON Object</span></dt><dd>Data to send with the action</dd><dt>target<span class="property-type">JSON Object with floor_id, area_id, device_id, entity_id, and label_id as array properties</span></dt><dd>Targets of the action</dd></dl><h3>Output</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>config</code>: config properties of the node</li><li><code>results</code>: response from Home Assistant</li><li><code>sent data</code>: data sent to Home Assistant</li></ul></dl><h3>References</h3><dl class="message-properties"><div><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/action.html" rel="noopener noreferrer">External Docs</a></p></div></dl></script>
<style>#version-update{margin-bottom:1em;padding:.5em}#version-update p{margin:0}#version-update strong{padding-right:5px}#version-update a,#version-update a:hover{color:var(--red-ui-primary-text-color)}.home-assistant .form-row.checkbox-option input{display:inline-block;margin-left:105px;margin-right:5px;vertical-align:top;width:auto}.home-assistant .form-row.checkbox-option label{width:auto}.home-assistant .form-row.checkbox-option-left input{display:inline-block;margin-right:5px;vertical-align:top;width:auto}.home-assistant .form-row.checkbox-option-left label{margin-right:20px;width:auto}.home-assistant .form-row.add-spacer{border-bottom:1px solid var(--red-ui-primary-text-color)}.home-assistant .form-row>select{width:70%}.home-assistant .form-row .ha-multi-item-row{display:inline-flex;gap:10px;width:70%}.home-assistant .form-row .ha-multi-item-row select{width:auto}.home-assistant .form-row .ha-multi-item-row .red-ui-typedInput-container{flex:1;width:auto}.home-assistant .editable-list-row{margin-bottom:4px}.home-assistant li span.property-type{color:var(--red-ui-primary-text-color);float:right;font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:11px;font-style:italic}.home-assistant .ha-alert-box,.home-assistant .ha-alpha-box,.home-assistant .ha-beta-box{border-radius:4px;margin-bottom:10px;padding:10px}.home-assistant .ha-alpha-box{background-color:#e78bb9;color:#702323}.home-assistant .ha-beta-box{background-color:#7d7;color:#853e3d}#constraint-list{min-width:446px}#constraint-list input{width:65%}#output-list input{width:62%}#clearIfState{margin-left:2px;position:absolute}.ha-node-label-legacy{fill:#fdfd96}.home-assistant-custom-block .custom-block-title{font-weight:600}.home-assistant-custom-block.danger,.home-assistant-custom-block.tip,.home-assistant-custom-block.warning{border-left-style:solid;border-left-width:.5rem;margin:1rem 0;padding:.1rem 1.5rem}.home-assistant-custom-block.tip{background-color:#f3f5f7;border-color:#42b983;color:#2c3e50}.home-assistant-custom-block.tip a{color:#3eaf7c}.home-assistant-custom-block.warning{background-color:#fff6c6;border-color:#e7c000;color:#6b5900}.home-assistant-custom-block.warning .custom-block-title{color:#b29400}.home-assistant-custom-block.warning a{color:#2c3e50}.home-assistant-custom-block.danger{background-color:#ffe6e6;border-color:#c00;color:#4d0000}.home-assistant-custom-block.danger .custom-block-title{color:#900}.home-assistant-custom-block.danger a{color:#2c3e50}.home-assisant-badge{border-radius:3px;color:#fff;display:inline-block;font-size:12px;height:16px;line-height:16px;padding:0 6px}.home-assisant-badge,.home-assisant-badge.green,.home-assisant-badge.tip{background-color:#42b983}.home-assisant-badge.error{background-color:#da5961}.home-assisant-badge.warn,.home-assisant-badge.warning,.home-assisant-badge.yellow{background-color:#e7c000}.home-assisant-badge+.home-assisant-badge{margin-left:5px}#upgrade-ha-node{background:#41bdf5;border:0;color:#eee;display:inline-block;font-size:14px;line-height:22px;margin:0;padding:4px 12px;text-decoration:none}.ui-autocomplete .ui-menu-item-wrapper .sublabel{color:var(--red-ui-secondary-text-color);font-size:smaller;margin:4px 0}</style>
<script type="text/html" data-help-name="ha-binary-sensor"><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><p>This node allows you to create a binary sensor entity within Home Assistant that can be controlled directly from Node-RED. A binary sensor is a type of entity that has only two possible states: typically "on" or "off". It can represent various real-world conditions, such as whether a door is open or closed, or if motion is detected.</p><h3>Configuration</h3><dl class="message-properties"><dt>State <span text="required" class="home-assistant-badge">required</span><span class="property-type">boolean</span></dt><dd>The state of the entity should be updated to</dd><dd>To set the Home Assistant state to <code>Unknown</code>, send a state with a js expression <code>null</code>.</dd><dt>Attributes<span class="property-type">Object</span></dt><dd>Key/Value pair of attributes to update. The key should be a string and the value can be a [string | number | boolean | object]</dd><dt>Input Override<span class="property-type">string</span></dt><ul><li>Values: <code>accept | merge | block</code></li></ul><dd>Determine how input values will be handled. When merge is selected the message object values will override the configuration values.</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>properties of <code>msg.payload</code></dd><dt>state<span class="property-type">string | number | boolean</span></dt><dd>The value of the entity state will be updated.</dd><dt>attributes<span class="property-type">Object</span></dt><dd>Key/Value pair of attributes to update. The key should be a string and the value can be a <code>[string | number | boolean | object]</code></dd></dl></script>
<style>.ha-entity-selector{align-items:flex-end;display:inline-flex;gap:10px;width:70%}.ha-entity-selector>input[type=text]{flex:1}.ha-entity-selector .select2-container{flex:1;width:auto}.ha-entity-selector .select2-container .select2-search--inline .select2-search__field{height:22px}#node-input-entityIdFilterType,#node-input-entityIdType,#node-input-entityidfiltertype{width:auto}.home-assistant .ha-entity-search-row{align-items:baseline;display:flex;margin-bottom:10px}.home-assistant .ha-entity-search-row label{display:inline;width:auto}.home-assistant .ha-entity-search-row input{background-color:var(--red-ui-form-input-background);border:1px solid var(--red-ui-form-input-border-color);border-radius:4px;box-sizing:border-box;color:var(--red-ui-primary-text-color);display:inline-block;flex:1;font-size:14px;height:34px;line-height:20px;margin-bottom:10px;margin-left:10px;padding:6px;vertical-align:middle}.home-assistant .ha-entity-search-row input:focus{border-color:var(--red-ui-form-input-border-color-focus);outline:0}.home-assistant .ha-entity-search-row ul{list-style:none;margin:0;overflow:hidden;overflow-y:auto;padding:0}</style>
<script type="text/html" data-help-name="ha-button"><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><p>The Button node creates a button entity within Home Assistant that, when pressed, triggers a flow in Node-RED. This is useful for manual triggers within automations, allowing users to start an automation sequence directly from the Home Assistant interface with a simple click.</p><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>entity</code>: complete entity object</li><li><code>entity id</code>: entity id of the pressed button</li><li><code>entity state</code>: entity state of the pressed button</li><li><code>config</code>: config properties of the node</li></ul></dl></script>
<script type="text/html" id="handlebars-sidebar-filter" data-template-name="x-tmpl-handlebars"><div class="ha-list-filter">
<select>
<option value="__all__"></option>
{{#each types}}
<option value="{{this}}">{{this}}</option>
{{/each}}
</select>
</div>
</script>
<style>.id-selector>li{padding-top:0}.id-selector>li .id-selector-row{font-size:.8em}.id-selector>li .id-selector-wrapper{display:flex;flex-direction:row}</style>
<script type="text/html" data-help-name="server"><p>The Server Config node is used for configuring the connection to Home Assistant. This node manages the details of how Node-RED communicates with your Home Assistant instance, including server URL, authentication, and other connection settings.</p><h3>Config</h3><dl class="message-properties"><dt>Name<span class="property-type">string</span></dt><dd>Label for this configuration, see details below for implications</dd><dt>Using the Home Assistant Add-on<span class="property-type">boolean</span></dt><dd>If you're running Node-RED as a Hass.io Add-on check this. No other information is needed.</dd><dt>Base URL<span class="property-type">string</span></dt><dd>The base URL and port of the Home Assistant instance can be reached at, for example: <code>http://192.168.0.100:8123</code> or <code>https://homeassistant.mysite.com</code></dd><dt>Access Token<span class="property-type">string</span></dt><dd>Long-lived Access Token used to contact the API</dd><dt>Unauthorized SSL Certificates<span class="property-type">boolean</span></dt><dd>This will allow you to use self-signed certificates. Only use this if you know what you're doing.</dd><dt>State Boolean<span class="property-type">string | delimited</span></dt><dd>A list of strings, not case sensitive, delimited by vertical pipe, |, that will return true for State Type Boolean.</dd><dt>Enable Heartbeat<span class="property-type">boolean</span></dt><dd>Heartbeat will send a ping message using the websocket connection to Home Assistant every X seconds. If a pong response is not received within 5 seconds Node-RED will attempt to reconnect to Home Assistant.</dd><dt>Heartbeat Interval<span class="property-type">number</span></dt><dd>The interval at which the ping message is sent to Home Assistant. The minimum value is 10 seconds.</dd><dt>Enable Global Context Store<span class="property-type">boolean</span></dt><dd>If enabled, the global context store will be used to store the Home Assistant connection, state, and service information. This allows you to use the information in other nodes using context functions.</dd><dd>Example below</dd></dl><h3>UI Settings</h3><dl class="message-properties"><dt>Cache Autocomplete Results<span class="property-type"></span></dt><dd>Enables the caching of the JSON autocomplete requests. Enabling or disabling this may require a restart of Node-RED for it to take effect.</dd><dt>ID Selector Display<span class="property-type"></span></dt><dd>Which text to show in the selector after the id has been chosen.</dd><dt>Status Date Format<span class="property-type"></span></dt><h5>Separator</h5><dd>A string that will appear in the status of an event node between the state and date string.</dd><h5>Other options</h5><dd>The other options are directly from <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options">DateTimeFormat Options</a>.</dd></dl><h3>Details</h3><dl class="message-properties"><dd>Every node requires a configuration attached to define how to contact Home Assistant, which is this config node's main purpose.</dd><dt>Context<span class="property-type"></span></dt><dd>Each config node will also make some data available in the global context, the <code>Name</code> value in this node is used as, camelcase, and the namespace for those values</dd><dd>Currently <code>states</code>, <code>services</code>, and <code>events</code> is made available in the global context. <code>states</code> is always set to all available states at startup and updated whenever state changes occur so it should be always up to date. <code>services</code> and <code>events</code> is only updated on initial deploy.</dd><dt>Context Example<span class="property-type"></span></dt><dd>Say we have a config node with the name <code>Home Assistant</code>, with an entity set up in Home Assistant as <code>switch.my_switch</code>. This state would be available within function nodes and you could fetch using something like the below code</dd><pre><code class="language-js">const haCtx = global.get("homeassistant");
const configCtx = haCtx.homeAssistant;
const entityState = configCtx.states["switch.my_switch"];
return entityState.state === "on" ? true : false;
</code></pre></dl><h3>Connection Issues</h3><dl class="message-properties"><dd>Communication with Home Assistant is accomplished via a combination of WebSocket and the REST API if you are having trouble communicating with home assistant make sure you can access the API outside of node-red, but from the same server node-red is running on, using a REST client, curl, or any number of other methods to validate the connection</dd></dl><h3>References</h3><dl class="message-properties"><dd><a href="https://home-assistant.io/developers/rest_api">Home Assistant REST API</a></dd></dl></script>
<script type="text/html" id="handlebars-sidebar-issues-list" data-template-name="x-tmpl-handlebars">{{#each issues}}
<li data-id="{{this.id}}" {{{ishidden this.hide}}}>
<div class="ha-issues-list-row" {{{backgroundcolor this.color}}}>
{{#if this.isFontAwesomeIcon}}
<i class="ha-icon fa fa-fw {{this.icon}}"></i>
{{else}}
<div class="ha-icon" style="background-image:url(icons/node-red-contrib-home-assistant-websocket/{{this.icon}})"></div>
{{/if}}
<span>{{this.name}}</span>
<button type="button" class="red-ui-button red-ui-button-small ha-edit-node">
<i class="fa fa-pencil"></i>
</button>
<button type="button" class="red-ui-button red-ui-button-small ha-find-node">
<i class="fa fa-search"></i>
</button>
<button type="button" class="red-ui-button red-ui-button-small ha-hidden-issue">
<i class="fa fa-eye"></i>
<i class="fa fa-eye-slash"></i>
</button>
</div>
<ul>
{{#each this.issues}}
<li>{{this}}</li>
{{/each}}
</ul>
</li>
{{else}}
<li>{{i18n "home-assistant.sidebar.stacks.no_issues"}}</li>
{{/each}}
</script>
<style>.red-ui-editableList-container li:last-child{border-bottom:none}</style>
<script type="text/html" data-help-name="api-current-state"><p>This node is used to fetch the last known state of any entity within Home Assistant when it receives an input. It’s useful for making decisions based on the current status of entities, such as checking if a light is already on before turning it off, or determining the temperature reading before adjusting the thermostat.</p><h3>Configuration</h3><dl class="message-properties"><dt>Entity ID <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a></li></ul><dd>The id of the entity to return.</dd><dt>If State<span class="property-type">string</span></dt><dd>If the conditional statement is evaluated as true send the message to the first output otherwise send it to the second output. If blank there will only be one output.</dd><dd><strong>Also see:</strong></dd><ul><li><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/conditionals.html" rel="noopener noreferrer">Conditionals</a></li></ul><dt>For<span class="property-type">number</span></dt><dd>The amount of time the entity state needs to have been constant for the "If state" to be <code>true</code></dd><dt>State Type<span class="property-type">string</span></dt><ul><li>Values: <code>string|number|boolean</code></li><li>Default: <code>string</code></li></ul><dd>Convert the state of the entity to the selected type. Boolean will be converted to true based on if the string is equal by default to (<code>y|yes|true|on|home|open</code>). Original value stored in <code>msg.data.original_state</code></dd><dt>Block Input Overrides<span class="property-type">boolean</span></dt><ul><li>Default: <code>false</code></li></ul><dd>Stop <code>msg.payload</code> values from overriding local config</dd></dl><h3>Inputs</h3><dl class="message-properties"><dt>payload.entityId<span class="property-type">string</span></dt></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>entity</code>: full entity object</li><li><code>entity id</code>: entity id of the triggered entity</li><li><code>entity state</code>: entity state of the triggered entity</li><li><code>config</code>: config properties of the node</li></ul></dl><h3>References</h3><dl class="message-properties"><ul><li><a href="https://home-assistant.io/docs/configuration/state_object/">Home Assistant State Objects</a></li></ul></dl></script>
<script type="text/html" id="handlebars-sidebar-issues" data-template-name="x-tmpl-handlebars"><div id="ha-issue-header">
<input type="checkbox" id="ha-issues-toggle-hidden" checked="checked">
<label for="ha-issues-toggle-hidden">{{i18n 'home-assistant.sidebar.issues.show_hidden'}}</label>
</div>
<ul class="ha-issues-list ha-show-hidden"></ul>
</script>
<style>#red-ui-header li.ha-notification{display:inline-block;height:100%;padding:0 10px;vertical-align:middle}#red-ui-header li.ha-notification svg{display:inline-block;line-height:1;vertical-align:middle}#red-ui-header li.ha-notification #notification-issues{color:var(--red-ui-text-color-warning);cursor:pointer;display:inline-block;padding-left:.3125rem}#red-ui-header li.ha-notification #notification-issues:hover{color:var(--red-ui-debug-message-border-warning)}#red-ui-header li.ha-notification #notification-issues .ha-issue-count{display:inline-block;font-size:1.5rem;line-height:1;vertical-align:middle}#red-ui-header li.ha-notification #notification-issues i{display:inline-block;font-size:1.25rem;line-height:1;padding-top:.125rem;vertical-align:middle}</style>
<script type="text/html" data-help-name="ha-device-config"><p>The Device Config node is used for configuring devices that have been added to Home Assistant. It allows you to set up and manage device-specific settings and options within Node-RED, ensuring that your automations can correctly interact with your devices.</p><h3>Configuration</h3><dl class="message-properties"><dt>Name<span class="property-type">string</span></dt><dd>The name of the device that will show in Home Assistant</dd><dt>Manufacturer<span class="property-type">string</span></dt><dd>The manufacturer of the device</dd><dt>Model<span class="property-type">string</span></dt><dd>The model of the device</dd><dt>Software Version<span class="property-type">string</span></dt><dd>The software version of the device</dd><dt>Hardware Version<span class="property-type">string</span></dt><dd>The hardware version of the device</dd></dl></script>
<script type="text/html" id="handlebars-sidebar-list" data-template-name="x-tmpl-handlebars"><ul class="ha-list">
{{#each list}}
<li class="ha-list-row" data-id="{{this.id}}" data-type="{{this.type}}">
<div class="ha-list-row-name">{{this.name}}</div>
<div class="ha-list-row-count">{{this.count}}</div>
</li>
{{/each}}
</ul>
</script>
<style>.home-assistant-sidebar-container{height:100%;position:relative}.home-assistant-sidebar-container .home-assistant-sidebar-stack{bottom:0;left:0;overflow-y:auto;position:absolute;right:0;top:0}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-list-filter{display:flex;justify-content:center;padding:10px}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-list{list-style:none;margin:0;padding:0}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-list-row{color:var(--red-ui-primary-text-color);display:flex;font-size:12px;justify-content:space-between;line-height:8px;margin-left:2px;padding-bottom:1px}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-list-row-name{cursor:pointer;flex:1;overflow:hidden;padding:10px;text-overflow:ellipsis;white-space:nowrap}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-list-row-count{background-color:var(--red-ui-node-icon-background-color);color:var(--red-ui-node-port-label-color);cursor:pointer;padding:10px;text-align:center;width:3ch}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-list li:nth-child(2n){background-color:var(--red-ui-form-input-background-disabled)}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list{list-style:none;margin:0;padding:0}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list-row{align-items:center;background-color:#41bdf5;color:var(--red-ui-node-label-color);display:flex;justify-content:space-between;margin:0 5px;padding:5px}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list-row span{flex:2;font-size:.9em;overflow:hidden;padding-left:5px;text-align:left;text-overflow:ellipsis;white-space:nowrap}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list-row button{margin-left:5px}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list-row .ha-hidden-issue i.fa-eye{display:inline-block}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list-row .ha-hidden-issue i.fa-eye-slash{display:none}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list.ha-show-hidden .ha-hidden{display:block}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list.ha-show-hidden .ha-hidden .ha-issues-list-row{background-color:var(--red-ui-list-item-background-disabled)!important;color:var(--red-ui-secondary-text-color)}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list.ha-show-hidden .ha-hidden .ha-hidden-issue i.fa-eye{display:none!important}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list.ha-show-hidden .ha-hidden .ha-hidden-issue i.fa-eye-slash{display:inline-block!important}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list .ha-hidden{display:none}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list ul{list-style:disc;margin:0 5px 0 20px;padding:3px 0}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list ul li{color:var(--red-ui-secondary-text-color);font-size:12px}.home-assistant-sidebar-container .home-assistant-sidebar-stack .ha-issues-list .ha-icon{background-position:50%;background-repeat:no-repeat;background-size:cover;color:#fff;font-size:1.3333333em;height:20px;width:20px}#home-assistant-stack-container{height:100%;position:relative}#ha-issue-header{align-items:start;display:flex;padding:5px}#ha-issue-header input{margin-right:5px}</style>
<script type="text/html" data-help-name="ha-device"><p>The Device node enables you to create device automations and call device actions within Home Assistant. This node interacts with devices connected to your Home Assistant instance, allowing you to perform tasks such as turning devices on or off, changing settings, or triggering specific device-related actions.</p><h3>Configuration</h3><dl class="message-properties"><dt>Type<span class="property-type">string</span></dt><ul><li>Values: <code>trigger | action</code></li></ul><dt>Device<span class="property-type">string</span></dt><dd>Id of the device</dd><dt>Trigger<span class="property-type">object</span></dt><dd>Home Assistant object of the trigger</dd><dt>Action<span class="property-type">object</span></dt><dd>Home Assistant object of the action</dd><dt>Capabilities<span class="property-type">object</span></dt><dt>Expose as<span class="property-type">string</span></dt><dd>When an entity is selected a switch entity will be created in Home Assistant. Turning on and off this switch will disable/enable the nodes in Node-RED.</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>config</code>: config properties of the node</li><li><code>device id</code>: device id that triggered the node</li><li><code>event data</code>: event data received from Home Assistant</li><li><code>sent data</code>: data sent to Home Assistant</li></ul></dl></script>
<style>#ha-social-bar{align-items:center;border-bottom:1px dashed var(--red-ui-primary-border-color);display:flex;font-size:.9em;justify-content:right;margin-bottom:8px;padding-bottom:2px}#ha-social-bar a{cursor:pointer;line-height:10px}#ha-social-bar span{padding:0 5px}</style>
<script type="text/html" data-help-name="ha-entity-config"><p>The Entity Config node provides configuration options for the different entity type nodes within Node-RED. It’s used to set up and manage the properties and settings for entities, ensuring they behave as expected within your automations and Home Assistant environment.</p><h3>Configuration</h3><dl class="message-properties"><dt>Name<span class="property-type">string</span></dt><dd>The name of the entity that will show in Node-RED</dd><dt>Device<span class="property-type">string</span></dt><ul><li><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/device-config.html" rel="noopener noreferrer">device config documentation</a></li></ul><dd>A list of devices the entity can be associated with. This is used to group entities together in the UI.</dd><div class="home-assistant-custom-block warning"><p class="custom-block-title">Caveat</p><p>If the entity has already been registered with Home Assistant when no device was selected. The device will not be added to the Home Assistant until after Home Assistant has been restarted.</p></div><dt>Type <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><ul><li>Values: <code>binary_sensor|button|sensor|switch</code></li></ul><dt>Resend state and attributes<span class="property-type">boolean</span></dt><dd>When the entity in Home Assistant is created the state and attributes will also be set. This is only applicable with certain entities nodes.</dd><dt>Other Properties<span class="property-type"></span></dt><dd>Configuration options are available for the selected entities</dd><dd><a href="https://developers.home-assistant.io/docs/core/entity">https://developers.home-assistant.io/docs/core/entity</a></dd></dl></script>
<style>.vscomp-wrapper{color:var(--red-ui-form-text-color);font-family:var(--red-ui-primary-font)}.vscomp-wrapper.focused .vscomp-toggle-button,.vscomp-wrapper:focus .vscomp-toggle-button{border-color:var(--red-ui-form-input-focus-color);box-shadow:none;outline:0;outline:thin dotted\9}.vscomp-wrapper .vscomp-toggle-button{background-color:var(--red-ui-form-input-background);border-color:var(--red-ui-form-input-border-color);border-radius:4px;height:34px;vertical-align:middle}.vscomp-wrapper .vscomp-value{color:var(--red-ui-primary-text-color)}.vscomp-wrapper .vscomp-arrow:after{border-bottom-color:var(--red-ui-form-text-color);border-right-color:var(--red-ui-form-text-color)}.vscomp-wrapper .vscomp-clear-icon:after,.vscomp-wrapper .vscomp-clear-icon:before{background-color:var(--red-ui-form-text-color)}.vscomp-wrapper .vscomp-clear-icon:hover:after,.vscomp-wrapper .vscomp-clear-icon:hover:before{background:var(--red-ui-form-input-background)}.vscomp-wrapper .vscomp-clear-button:hover{background:var(--red-ui-form-text-color)}.vscomp-wrapper .vscomp-clear-button:hover .vscomp-clear-icon:after,.vscomp-wrapper .vscomp-clear-button:hover .vscomp-clear-icon:before,.vscomp-wrapper .vscomp-dropbox{background-color:var(--red-ui-form-input-background)}.vscomp-wrapper .vscomp-dropbox{border:1px solid var(--red-ui-primary-border-color)}.vscomp-wrapper .vscomp-option.selected{background-color:var(--red-ui-secondary-background-selected)}.vscomp-wrapper .vscomp-option.focused{background-color:var(--red-ui-secondary-background-hover)}.vscomp-wrapper .vscomp-option .vscomp-option-description{color:var(--red-ui-form-placeholder-color);font-size:11px}.vscomp-wrapper .vscomp-search-container{border-bottom-color:var(--red-ui-form-input-border-color)}.vscomp-wrapper .vscomp-search-container>label.vscomp-search-label{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.vscomp-wrapper .vscomp-search-container>input.vscomp-search-input{background-color:transparent;border:0;color:inherit;font-size:15px;height:38px;padding:10px 0;width:calc(100% - 30px)}.vscomp-wrapper .pop-comp-wrapper{background-color:var(--red-ui-form-input-background);color:var(--red-ui-form-text-color)}</style>
<script type="text/html" data-help-name="ha-entity"><div class="home-assistant-custom-block danger"><p class="custom-block-title">DEPRECATED</p><p>This node has been deprecated in favor of the individual entity nodes. The individual entity nodes can be used in subflows and added to devices.</p></div><p>Creates an entity in Home Assistant which can be manipulated from this node.</p><p><code>binary sensor</code>, <code>sensor</code>, and <code>switch</code></p><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><h3>Configuration</h3><dl class="message-properties"><dt>Type <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><ul><li>Values <code>binary_sensor|sensor|switch</code></li><li>Default: <code>sensor</code></li></ul><dd>The state the entity should be updated to</dd><dt>Home Assistant Config<span class="property-type">Object</span></dt><dd>Configuration options available for the selected entity</dd><div class="home-assistant-custom-block danger"><p class="custom-block-title">WARNING</p><p>Entity nodes will not work in a subflow due to the way they register themselves with Home Assistant. After a Node-RED restart, a new entity will be created in Home Assistant.</p></div></dl><h3>Sensor Configuration</h3><dl class="message-properties"><dt>State <span text="required" class="home-assistant-badge">required</span><span class="property-type">string | number | boolean</span></dt><dd>The state the entity should be updated to</dd><dt>Attributes<span class="property-type">Object</span></dt><dd>Key/Value pair of attributes to update. The key should be a string and the value can be a [string | number | boolean | object]</dd><dt>Input Override<span class="property-type">string</span></dt><ul><li>Values: <code>accept | merge | block</code></li></ul><dd>Determine how input values will be handled. When merge is selected the message object values will override the configuration values.</dd><dt>Resend state and attributes<span class="property-type">boolean</span></dt><dd>When creating the entity in Home Assistant this will also send the last updated state and attributes then node sent to Home Assistant</dd></dl><h3>Switch Configuration</h3><dl class="message-properties"><dt>Output on state change<span class="property-type">boolean</span></dt><dd>When the state of the switch changes it will output to the top if the switch is on or to the bottom if it is in the off position.</dd><dt>Payload<span class="property-type">str | num | bool | JSONata | timestamp</span></dt><dd>Customizable output set to <code>msg.payload</code> if <code>Output on state change</code> is enabled.</dd></dl><h3>Sensors Inputs</h3><dl class="message-properties"><dd>properties of <code>msg.payload</code></dd><dt>state<span class="property-type">string | number | boolean</span></dt><dd>The state the entity should be updated to</dd><dt>attributes<span class="property-type">Object</span></dt><dd>Key/Value pair of attributes to update. The key should be a string and the value can be a <code>[string | number | boolean | object]</code></dd></dl><h3>Switch Inputs</h3><dl class="message-properties"><dt>msg.enable<span class="property-type">boolean</span></dt><dd>Set to <code>true</code> to turn on the switch and <code>false</code> to turn off. If the message has a property <code>enable</code> set to the type <code>boolean</code> the node will not have any output.</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd><strong>Status Color</strong></dd><ul><li>Green/Red: output from the node was due to input to the node</li><li>Blue: output from the node was due to the state of the node changing</li><li>Yellow: state of node changed but no output</li></ul></dl></script>
<style>#ha-action{margin-left:4px}</style>
<script type="text/html" data-help-name="server-events"><p>This node listens for all types of events from Home Assistant, with the ability to filter by event type. It’s a powerful tool for triggering automations based on specific events occurring within Home Assistant, such as state changes, sensor readings, or user interactions.</p><h3>Configuration</h3><dl class="message-properties"><dt>Name<span class="property-type">string</span></dt><dd>the name of the node</dd><dt>Event Type<span class="property-type">string</span></dt><dd>filter by event type or leave blank for all events</dd><div class="home-assistant-custom-block danger"><p class="custom-block-title">WARNING</p><p>Leaving this empty will listen for all events from Home Assistant which may overload the WebSocket message queue.</p><p><a href="https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/153#issuecomment-539290950">GitHub Issue #153</a></p></div><dt>Event data<span class="property-type">json</span></dt><dd>A JSON object that will be compared to the event data. If this JSON is a subset of the event data object, the event will be emitted.</dd><dt>Output only after Home Assistant is running<span class="property-type">boolean</span></dt><dd>What until Home Assistant has reported its state as <code>running</code> before outputting events. Client events will always output.</dd><dt>Expose as<span class="property-type">entity config</span></dt><dd>Creates a switch within Home Assistant to enable/disable this node. This feature requires <a href="https://github.com/zachowj/hass-node-red">Node-RED custom integration</a> to be installed in Home Assistant</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>event data</code>: event received from Home Assistant</li><li><code>config</code>: config properties of the node</li></ul></dl><h3>Client Events</h3><dl class="message-properties"><dd>Use <code>home_assistant_client</code> as the event type to receive events from the Websocket client.</dd><dd>Events sent from the client:</dd><ul><li><strong>connecting</strong> - when trying to connect to HA</li><li><strong>connected</strong> - after the authorization has been accepted</li><li><strong>disconnected</strong> - when the socket stops attempting to connect or disconnected after having been connected</li><li><strong>error</strong> - when a disconnect happens of the WebSocket with an error</li><li><strong>states_loaded</strong> - the first time all states are loaded from HA</li><li><strong>services_loaded</strong> - the first time all services are loaded from HA</li><li><strong>running</strong> - when HA is in a running state and states have been loaded</li></ul></dl></script>
<style>.home-assistant .form-row.status-options div{display:flex;margin-top:12px}.home-assistant .form-row.status-options div .spacer{display:inline-block;width:100px}.home-assistant .form-row.status-options div input,.home-assistant .form-row.status-options div select{flex:1}</style>
<script type="text/html" data-help-name="ha-events-calendar"><p>The Calendar node listens for events from Home Assistant's calendar integration. It triggers a flow in Node-RED when a calendar event starts or ends, allowing you to automate actions based on your calendar schedule.</p><h3>Configuration:</h3><dl class="message-properties"><dt>Entity ID <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><dd>The entity_id for the calendar that contains triggerable calendar items.</dd><dt>Relative To <span text="required" class="home-assistant-badge">required</span><span class="property-type">start | end</span></dt><ul><li>Default: <code>start</code></li></ul><dd>Whether to trigger an event at the start or end of each matching calendar item.</dd><dt>Offset <span text="required" class="home-assistant-badge">required</span><span class="property-type">number</span></dt><ul><li>Default: 0 seconds</li></ul><dd>A negative or positive amount of time to allow the event to be triggered before or after the calendar item's start/end time.</dd><dt>Conditions<span class="property-type"></span></dt><dd>This node has two default outputs "allowed" and "blocked". If all the conditions are true the calendar item will be sent to the output.</dd><dd><strong>See Also:</strong></dd><ul><li><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/conditionals.html" rel="noopener noreferrer">Conditionals</a></li></ul><dt>Expose to Home Assistant<span class="property-type">boolean</span></dt><dd>Creates a switch within Home Assistant to enable/disable this node. This feature requires <a href="https://github.com/zachowj/hass-node-red">Node-RED custom integration</a> to be installed in Home Assistant</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>calendar item</code>: the calendar item object as provided by the Home Assistant API</li></ul></dl></script>
<style>.deviceExtra>label{text-transform:capitalize}.deviceExtra>input[type=checkbox]{width:auto}.deviceExtra .range-row{align-items:center;display:inline-flex;width:70%}.deviceExtra .range-row input[type=checkbox]{width:auto}.deviceExtra .range-row input[type=range]{flex-grow:1;margin:0 10px}.deviceExtra .range-row input[type=text]{text-align:center;width:calc(3ch + 14px)}#ha-device{margin-left:4px}</style>
<script type="text/html" data-help-name="server-state-changed"><p>The Events: State node listens for state changes of entities within Home Assistant. It triggers a flow in Node-RED whenever an entity's state changes, allowing you to automate responses to various conditions, like turning on lights when motion is detected or sending a notification when a door is opened.</p><h3>Configuration:</h3><dl class="message-properties"><dt>Entity <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><dd>The entity ID is used to listen for state changes. This can be a entity ID, regex, or a substring. If a regex or substring is used, the node will listen for all entities that match.</dd><dd>Example:</dd><ul><li><code>light.kitchen</code> (entity) listens for state changes of the <code>light.kitchen</code> entity</li><li><code>^light.*</code> (regex) listens for state changes of all entities that start with <code>light.</code></li><li><code>light</code> (substring) listens for state changes of all entities that contain <code>light</code> in the entity ID</li></ul><dt>If State<span class="property-type">string</span></dt><dd>If the conditional is evaluated as true send the message to the first output otherwise send it to the second output. If blank there will only be one output.</dd><dd><strong>Also see:</strong></dd><ul><li><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/conditionals.html" rel="noopener noreferrer">Conditionals</a></li></ul><dt>For<span class="property-type">number</span></dt><dd>An amount of time an entity's state needs to be in that state before triggering.</dd><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p>Output on Connect state changes will not start a timer.</p></div><dt>State Type<span class="property-type">string</span></dt><ul><li>Values: <code>string|number|boolean</code></li><li>Default: <code>string</code></li></ul><dd>Convert the state of the entity to the selected type. Boolean will be converted to true based on if the string is equal by default to (<code>y|yes|true|on|home|open</code>). Original value stored in msg.data.original_state</dd><dt>Ignore state change event<span class="property-type">boolean</span></dt><dd>A list of possible states that will be ignored.</dd><dt>Output on Connect<span class="property-type">boolean</span></dt><dd>Output once on startup/deploy</dd><dt>Expose to Home Assistant<span class="property-type">boolean</span></dt><dd>Creates a switch within Home Assistant to enable/disable this node. This feature requires <a href="https://github.com/zachowj/hass-node-red">Node-RED custom integration</a> to be installed in Home Assistant</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>event data</code>: full event object</li><li><code>entity id</code>: entity id of the triggered entity</li><li><code>entity state</code>: entity state of the triggered entity</li><li><code>config</code>: config properties of the node</li></ul></dl></script>
<style>#haConfig label{margin-bottom:0;text-transform:none;width:100%}#haConfig span{display:inline-block;margin-right:5px;width:40%}#haConfig input[type=text]{margin-left:10px;width:55%}</style>
<script type="text/html" data-help-name="ha-fire-event"><p>The Fire Event node allows you to fire an event on the Home Assistant event bus. This can be used to trigger automations or notify other parts of the system about specific occurrences. It’s a way to programmatically generate events that other nodes or systems can listen to and react upon.</p><h3>Configuration</h3><dl class="message-properties"><dt>Event <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><dd>Event name to fire</dd><dt>data<span class="property-type">Object</span></dt><dd>JSON object to pass along</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>If the incoming message has a <code>payload</code> property with <code>event</code> set it will override any config values if set. If the incoming message has a <code>payload.data</code> that is an object or parsable into an object these properties will be <strong>merged</strong> with any config values set. If the node has a property value in its config for <code>Merge Context</code> then the <code>flow</code> and <code>global</code> contexts will be checked for this property which should be an object that will also be merged into the data payload.</dd><dt>payload.event<span class="property-type">string</span></dt><dd>Event to fire</dd><dt>payload.data<span class="property-type">Object</span></dt><dd>Event data to send</dd></dl><h3>Outputs</h3><dl class="message-properties"><dt>payload.event_type<span class="property-type">string</span></dt><dd>Event Type that was fired</dd><dt>payload.data<span class="property-type">Object</span></dt><dd>The event <code>data</code> sent if one was used</dd></dl><h3>References</h3><dl class="message-properties"><dd><a href="https://developers.home-assistant.io/docs/en/dev_101_events.html#firing-events">Home Assistant Events</a></dd></dl></script>
<style>.home-assistant ul.ha-ignore-state{list-style:none;margin-left:105px}.home-assistant ul.ha-ignore-state li input{display:inline-block;margin-right:5px;vertical-align:top;width:auto}.home-assistant ul.ha-ignore-state li label{width:auto}</style>
<script type="text/html" data-help-name="ha-get-entities"><p>The Get Entities node retrieves entities based on specific search criteria, with three different output options. This node is useful for filtering and finding entities that match certain conditions, such as all lights that are currently on, or sensors reporting a specific range of values.</p><h3>Configuration</h3><dl class="message-properties"><dt>Search Criteria<span class="property-type"></span></dt><dd>All specified criteria must be met for an entity to be considered valid.</dd><dt>Property<span class="property-type"></span></dt><dd>Autocomplete is available for all properties currently set on loaded entities.</dd></dl><h3>Inputs</h3><dl class="message-properties"><dt>Payload<span class="property-type">Object</span></dt><dd>Override the configuration values by passing in a property with a valid value.</dd><ul><li><code>rules</code> (array)<ul><li><code>condition</code>: string (e.g., <code>stateObject</code>, <code>labelRegistry</code>, <code>areaRegistry</code>, <code>deviceRegistry</code>, <code>floorRegistry</code>)</li><li><code>property</code>: string</li><li><code>logic</code>: string</li><li><code>value</code>: string</li><li><code>valueType</code>: string</li></ul></li><li><code>outputType</code>: string</li><li><code>outputEmptyResults</code>: boolean</li><li><code>outputLocationType</code>: string</li><li><code>outputLocation</code>: string</li><li><code>outputResultsCount</code>: number</li></ul><h5>Example</h5><dd>To retrieve all entities with the device class <code>battery</code> on the <code>First floor</code> that are not labeled <code>not replaceable</code>, include the following in the <code>payload</code> property of the message:</dd><pre><code class="language-json">{
"rules": [
{
"condition": "stateObject",
"property": "attributes.device_class",
"logic": "is",
"value": "battery",
"valueType": "str"
},
{
"condition": "floorRegistry",
"property": "name",
"logic": "is",
"value": "First floor",
"valueType": "str"
},
{
"condition": "labelRegistry",
"property": "name",
"logic": "is_not",
"value": "not replaceable",
"valueType": "str"
}
]
}
</code></pre></dl><h3>Outputs</h3><dl class="message-properties"><dt>Array<span class="property-type">Array</span></dt><dd>Returns an array of state objects based on the search criteria and sends them to the specified output location.</dd><dt>Count<span class="property-type">number</span></dt><dd>Returns the total count of valid entities.</dd><dt>Random<span class="property-type">Object | Array</span></dt><dd>Returns a random object or array from the available state objects. If <code>One Max Results</code> is selected, it will return a single object; otherwise, it will return an array of state objects.</dd><dt>Split<span class="property-type">msg.part</span></dt><dd>Sends a separate message for each state object, similar to the output of a split node.</dd></dl><h3>State Object Format</h3><dl class="message-properties"><dd>Sample output when the output type is an array:</dd><pre><code class="language-json">[
{
"entity_id": "light.kitchen",
"state": "on",
"attributes": {
"brightness": 243,
"friendly_name": "Kitchen Light",
"supported_features": 33,
"icon": "mdi:light-switch"
},
"last_changed": "2019-12-29T05:38:53.016984+00:00",
"last_updated": "2019-12-29T05:38:53.016984+00:00",
"context": {
"id": "6c16e348494c42fb8c8e8bda92b20fb2",
"parent_id": null,
"user_id": null
},
"timeSinceChangedMs": 3466747
}
]
</code></pre><dt>entity_id<span class="property-type">string</span></dt><dd>The entity to which this state belongs.</dd><dt>state<span class="property-type">string</span></dt><dd>The main attribute state value, such as 'on', 'off', 'home', 'open', 'closed', etc.</dd><dt>attributes<span class="property-type">Object</span></dt><dd>Supported attributes of the state as set by Home Assistant.</dd><dt>last_changed<span class="property-type">string</span></dt><dd>ISO Date string representing the last time the entity state changed.</dd><dt>timeSinceChangedMs<span class="property-type">number</span></dt><dd>Milliseconds since the last state change of the entity.</dd><dt>last_updated<span class="property-type">string</span></dt><dd>ISO Date string representing the last time the entity state was updated.</dd><dt>context<span class="property-type">Object</span></dt><dd>Information about who or what last changed the state of this entity.</dd></dl><h3>Examples</h3><dl class="message-properties"><div><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/get-entities.html#examples">link</a></p></div></dl><h3>References</h3><dl class="message-properties"><ul><li><a href="https://home-assistant.io/docs/configuration/state_object/">Home Assistant State Objects</a></li></ul></dl></script>
<style>#update-tag-list{margin-bottom:4px}#no-tags-found{display:none}</style>
<script type="text/html" data-help-name="api-get-history"><p>The Get History node fetches the history of Home Assistant entities based on input criteria. This can be used to analyze past states or events, such as tracking temperature changes over time or reviewing when a door was last opened. It’s useful for creating more complex automations based on historical data.</p><h3>Configuration</h3><dl class="message-properties"><dt>Entity ID<span class="property-type">string</span></dt><dd>The entity id to fetch history for. Can be a single entity id or a comma separated list of entity ids.</dd><dt>Entity ID Type<span class="property-type">string</span></dt><ul><li>Values: <code>==</code> | <code>regex</code></li></ul><dd>The type of entity id matching to use. <code>==</code> will do an exact match, <code>regex</code> will use a regular expression to match the entity ids.</dd><dt>Start Date<span class="property-type">string</span></dt><ul><li>Values: ISO Formattted Date</li><li>Default: 24 hours prior</li></ul><dd>Date to start fetching history from. Will override the configuration if passed in. If <code>relativetime</code> is used this will be ignored.</dd><dd><strong>Also See:</strong></dd><ul><li><a href="https://en.wikipedia.org/wiki/ISO_8601">https://en.wikipedia.org/wiki/ISO_8601</a></li></ul><dt>End Date<span class="property-type">string</span></dt><ul><li>Values: ISO Formattted Date</li><li>Default: 24 hours from start date</li></ul><dd>The end date to fetch history too. Will override the configuration if passed in. If <code>relativetime</code> is used this will be ignored.</dd><dd><strong>Also See:</strong></dd><ul><li><a href="https://en.wikipedia.org/wiki/ISO_8601">https://en.wikipedia.org/wiki/ISO_8601</a></li></ul><dt>Use Relative Time<span class="property-type">boolean</span></dt><dd>A checkbox to use relative time or not. If checked the <code>startdate</code> and <code>enddate</code> will be ignored and the <code>relativetime</code> will be used instead.</dd><dt>In the Last<span class="property-type">string</span></dt><dd>A time string that will be parsed the following keywords into time values.</dd><dd>Example: <code>4h 30m</code> = The last 4 hours and 30 minutes</dd><pre><code>ms, milli, millisecond, milliseconds - will parse to milliseconds
s, sec, secs, second, seconds - will parse to seconds
m, min, mins, minute, minutes - will parse to minutes
h, hr, hrs, hour, hours - will parse to hours
d, day, days - will parse to days
w, week, weeks - will parse to weeks
mon, mth, mths, month, months - will parse to months
y, yr, yrs, year, years - will parse to years
</code></pre><dt>Flatten Results<span class="property-type"></span></dt><dd>Instead of returning the data from home assistant ( array for each entity_id ) return one flattened array of one item per history entry</dd><dt>Output Types<span class="property-type">string</span></dt><ul><li>Values: <code>array</code> | <code>split</code></li><li>Default: <code>array</code></li></ul><dd>The type of output to return. <code>array</code> will return an array of history objects. <code>split</code> will return an array of history objects for each entity id.</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>All properties of <code>msg.payload</code></dd><dt>entityId<span class="property-type">string</span></dt><dt>entityIdType<span class="property-type">equalregex</span></dt><dt>startDate<span class="property-type">string</span></dt><ul><li>Values: ISO Formattted Date</li></ul><dt>endDate<span class="property-type">string</span></dt><ul><li>Values: ISO Formattted Date</li></ul><dt>relativeTime<span class="property-type">string</span></dt><dt>flatten<span class="property-type">boolean</span></dt></dl><h3>Outputs</h3><dl class="message-properties"><dt>payload<span class="property-type">array</span></dt><dd>The history returned by home-assistant, which is an array of arrays where each array entry contains history objects for one particular entity</dd><dd>Example output of <code>msg</code>:</dd><pre><code class="language-json">{
"payload": [
{
"attributes": {
"friendly_name": "Kitchen Light",
"icon": "mdi:light-switch",
},
"context": {
"id": "850e510e36fb494c9abc79e01e897d54",
"parent_id": null,
"user_id": null
},
"entity_id": "light.kitchen_light",
"last_changed": "2019-12-28T06:47:28.618000+00:00",
"last_updated": "2019-12-28T06:47:28.618000+00:00",
"state": "off"
},
{
"attributes": {
"brightness": 28,
"friendly_name": "Kitchen Light",
"icon": "mdi:light-switch",
},
"context": {
"id": "4d4abe29f2bc43dab39101193f1fefe4",
"parent_id": null,
"user_id": null
},
"entity_id": "light.kitchen_light",
"last_changed": "2019-12-28T07:48:11.514137+00:00",
"last_updated": "2019-12-28T07:48:11.514137+00:00",
"state": "on"
},
...
]
}
</code></pre></dl><h3>Examples</h3><dl class="message-properties"><dd><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket../cookbook/check-if-an-entity-was-turned-on-in-the-last-24-hours.html" rel="noopener noreferrer">Check if an entity was a certain state in the last 24 hours</a></dd></dl><h3>References</h3><dl class="message-properties"><ul><li><a href="https://www.home-assistant.io/integrations/history">Home Assistant History Component</a></li><li><a href="https://developers.home-assistant.io/docs/en/external_api_rest.html#get-apihistoryperiodlttimestamp">Home Assistant API: /api/history/period</a></li></ul></dl></script>
<style>#days-of-the-week{margin-left:30px}#days-of-the-week input{display:inline-block;margin-right:5px;vertical-align:top;width:auto}#days-of-the-week label{width:auto}</style>
<script type="text/html" data-help-name="ha-number"><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><p>The Number node creates a number entity in Home Assistant that can be manipulated from within Node-RED. This entity type is typically used to represent numeric values that can be adjusted, such as a thermostat setting or a brightness level for lights.</p><h3>Configuration</h3><dl class="message-properties"><dt>Mode <span text="required" class="home-assistant-badge">required</span><span class="property-type"></span></dt><dd>The mode of the node</dd><dt>Value <span text="required" class="home-assistant-badge">required</span><span class="property-type">number</span></dt><dd>The value of the entity should be updated to</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>properties of <code>msg.payload</code></dd><dt>value<span class="property-type">number</span></dt><dd>The value of the entity should be updated to</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>value</code>: The value of the entity</li><li><code>previous value</code>: The previous value of the entity</li><li><code>config</code>: The config properties of the node</li></ul></dl><h3>Examples</h3><dl class="message-properties"><div><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/number.html#examples">link</a></p></div></dl></script>
<style>div.property-selector{display:grid;grid-template-columns:120px 1fr;grid-template-rows:repeat(2,1fr);grid-column-gap:5px;grid-row-gap:5px;align-items:center}div.property-selector input,div.property-selector select{width:100%}div.property-selector .property-label{grid-area:1/1/2/2}div.property-selector .input-property{grid-area:1/2/2/3}div.property-selector .input-logic{grid-area:2/1/3/2;width:auto}div.property-selector .input-value-wrapper{grid-area:2/2/3/3}</style>
<script type="text/html" data-help-name="poll-state"><p>The Poll State node outputs the state of an entity at regular intervals. It can also be configured to trigger at startup and whenever the entity changes state, if desired. This node is useful for regularly checking the status of an entity, ensuring your automations stay up to date with the latest information.</p><h3>Configuration</h3><dl class="message-properties"><dt>Entity ID <span text="required" class="home-assistant-badge">required</span><span class="property-type"></span></dt><dd>The entity id of the entity to poll for.</dd><dt>Update Interval<span class="property-type">number</span></dt><dd>The amount of time between checking/sending updates.</dd><dt>If State<span class="property-type">string</span></dt><dd>If the conditional statement is evaluated as true send the message to the first output otherwise send it to the second output. If blank there will only be one output.</dd><dd><strong>Also see:</strong></dd><ul><li><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/conditionals.html" rel="noopener noreferrer">Conditionals</a></li></ul><dt>State Type<span class="property-type">string</span></dt><dd>Convert the state of the entity to the selected type. Boolean will be converted to true based on if the string is equal by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd><dt>Output Initially<span class="property-type">boolean</span></dt><dd>Output once on startup/deploy then on each interval</dd><dt>Expose to Home Assistant<span class="property-type">boolean</span></dt><dd>Creates a switch within Home Assistant to enable/disable this node. This feature requires <a href="https://github.com/zachowj/hass-node-red">Node-RED custom integration</a> to be installed in Home Assistant</dd></dl><h3>Outputs</h3><dl class="message-properties"><dt>topic<span class="property-type">string</span></dt><dd>entity_id of changed entity</dd><dt>payload<span class="property-type">object</span></dt><dd>The last known state of the entity</dd><dt>data.timeSinceChanged<span class="property-type">string</span></dt><dd>Human readable format string of time since last updated, example "1 hour ago"</dd><dt>data.timeSinceChangedMs<span class="property-type">number</span></dt><dd>Number of milliseconds since last changed</dd></dl><h3>References</h3><dl class="message-properties"><ul><li><a href="https://home-assistant.io/docs/configuration/state_object/">Home Assistant State Objects</a></li></ul></dl></script>
<script type="text/html" data-help-name="api-render-template"><p>The Render Template node allows you to render templates based on input data. Templates in Home Assistant are powerful tools for dynamically generating text or values based on the state of entities or other variables. This node sends the template to Home Assistant for rendering and outputs the result.</p><div class="home-assistant-custom-block tip"><p class="custom-block-title">NOTE:</p><p>The node will output any Home Assistant API errors for catching with the 'catch-all' node</p></div><h3>Configuration</h3><dl class="message-properties"><dt>template<span class="property-type">string</span></dt><dd>Jinja template to be rendered, discarded if <code>msg.template</code> is provided via input msg</dd><dt>Template Location<span class="property-type"></span></dt><dd>Customizable location to output original template</dd><dt>Results<span class="property-type"></span></dt><dd>Customizable location to output rendered template</dd></dl><h3>Inputs</h3><dl class="message-properties"><dt>template<span class="property-type">string</span></dt><dd>Jinja template to be rendered</dd></dl><h3>Outputs</h3><dl class="message-properties"><dt>template<span class="property-type">string</span></dt><dd>The original template sent to Home Assistant for rendering</dd><dt>payload<span class="property-type">string</span></dt><dd>The rendered template</dd></dl><h3>References</h3><dl class="message-properties"><ul><li><a href="https://home-assistant.io/docs/configuration/templating/">Home Assistant Template Docs</a></li><li><a href="http://jinja.pocoo.org/docs/dev/templates/">Jinja Docs</a></li></ul></dl></script>
<script type="text/html" data-help-name="ha-select"><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><p>The Select node creates a select entity in Home Assistant that can be manipulated from Node-RED. This type of entity typically represents a dropdown menu or a list of options from which the user can choose, and it can be used to control or adjust settings within your automations.</p><h3>Configuration</h3><dl class="message-properties"><dt>Mode <span text="required" class="home-assistant-badge">required</span><span class="property-type"></span></dt><dd>The mode of the node</dd><dt>value <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><dd>A string to the set current value of the select entity</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>properties of <code>msg.payload</code></dd><dt>Value<span class="property-type">string</span></dt><dd>The string of the text entity should be updated to</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>value</code>: The text string of the entity</li><li><code>previous value</code>: The previous text string of the entity</li><li><code>config</code>: The config properties of the node</li></ul></dl><h3>Examples</h3><dl class="message-properties"><div><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/select.html#examples">link</a></p></div></dl></script>
<script type="text/html" data-help-name="ha-sensor"><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><p>The Sensor node creates a sensor entity within Home Assistant that is controlled from Node-RED. Sensors are entities that report data from various sources, such as temperature, humidity, or motion detection. This node allows you to create and manage such sensors directly from your Node-RED flows.</p><h3>Configuration</h3><dl class="message-properties"><dt>State <span text="required" class="home-assistant-badge">required</span><span class="property-type">string | number | boolean</span></dt><dd>The state the entity should be updated to</dd><dd>To set the Home Assistant state to <code>Unknown</code>, send a state with a js expression <code>null</code>.</dd><dt>Attributes<span class="property-type">Object</span></dt><dd>Key/Value pair of attributes to update. The key should be a string and the value can be a [string | number | boolean | object]</dd><dt>Input Override<span class="property-type">string</span></dt><ul><li>Values: <code>accept | merge | block</code></li></ul><dd>Determine how input values will be handled. When merge is selected the message object values will override the configuration values.</dd><dt>Resend state and attributes<span class="property-type">boolean</span></dt><dd>When creating the entity in Home Assistant this will also send the last updated state and attributes then node sent to Home Assistant</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>properties of <code>msg.payload</code></dd><dt>state<span class="property-type">string | number | boolean</span></dt><dd>The state the entity should be updated to</dd><dt>attributes<span class="property-type">Object</span></dt><dd>Key/Value pair of attributes to update. The key should be a string and the value can be a <code>[string | number | boolean | object]</code></dd></dl></script>
<script type="text/html" data-help-name="ha-sentence"><p>The <strong>Sentence</strong> node is triggered when the Home Assistant <a href="https://www.home-assistant.io/voice_control/">Assist</a> feature matches a sentence from a voice assistant using the default <a href="https://www.home-assistant.io/integrations/conversation/">conversation agent</a>. This node enables voice control integrations, allowing specific voice commands to trigger automations within Node-RED.</p><p>Sentences support basic template syntax. Refer to the Home Assistant <a href="https://www.home-assistant.io/docs/automation/trigger/#sentence-trigger">documentation</a> for more details.</p><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p>This node requires the <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> to be installed in Home Assistant.</p></div><h3>Configuration Options</h3><dl class="message-properties"><dt>Mode<span class="property-type">string</span></dt><ul><li><strong>Options</strong>:<ul><li><code>trigger</code></li><li><code>response</code></li></ul></li></ul><dd>Defines the node’s function.<br>If set to <strong>trigger</strong>, the node activates when a sentence is matched.<br>If set to <strong>response</strong>, the node sends a dynamic response back to Home Assistant.</dd><dt>Sentences<span class="property-type">string</span></dt><dd>A list of sentences to match. Supports basic template syntax. For more details, see the Home Assistant <a href="https://www.home-assistant.io/docs/automation/trigger/#sentence-trigger">documentation</a>.</dd><dt>Response Type<span class="property-type">string</span></dt><ul><li><strong>Options</strong>:<ul><li><code>dynamic</code></li><li><code>fixed</code></li></ul></li></ul><dd>Specifies the type of response sent to Home Assistant:</dd><ul><li><strong>Fixed</strong>: The same response is sent for all matched sentences.</li><li><strong>Dynamic</strong>: The response is determined by the node set to response mode.</li></ul><dt>Response<span class="property-type">string</span></dt><dd>The message sent to Home Assistant when a sentence is matched. This option is used only if the <strong>Response Type</strong> is set to <code>fixed</code>.</dd><dt>Fallback Response<span class="property-type">string</span></dt><dd>The message sent to Home Assistant when a timeout occurs. This is used when the <strong>Response Type</strong> is set to <code>dynamic</code>.</dd><dt>Response Timeout<span class="property-type">number</span></dt><dd>Specifies the time in milliseconds to wait for a response before sending the <strong>Fallback Response</strong>. This option is used only when the <strong>Response Type</strong> is set to <code>dynamic</code>.</dd><dt>Expose As<span class="property-type">string</span></dt><dd>Select an entity to create a switch in Home Assistant. Turning the switch on or off will enable or disable this node in Node-RED.</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>All properties must be provided in <code>msg.payload</code>.</dd><dd>Example input:</dd><pre><code class="language-json">{
"response": "The light is now on"
}
</code></pre><dt>Response<span class="property-type">string</span></dt><dd>The response sent to Home Assistant when a sentence is matched. This is used only when the <strong>Response Type</strong> is set to <code>dynamic</code>.</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>trigger id</code>: The sentence that triggered the flow.</li><li><code>config</code>: The node's configuration properties.</li></ul></dl><h3>Examples</h3><dl class="message-properties"><div><p>For detailed usage examples, see the <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/sentence.html#examples">Examples</a> section.</p></div></dl></script>
<script type="text/html" data-help-name="ha-switch"><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><p>The Switch node creates a switch entity within Home Assistant that can be controlled from Node-RED. This node also allows a flow to be started from a service call, making it a versatile tool for both controlling devices and triggering automations.</p><h3>Configuration</h3><dl class="message-properties"><dt>Enable input<span class="property-type"></span></dt><dd>Input is disabled by default. It can be enabled by checking this option.</dd><dt>Output on state change<span class="property-type">boolean</span></dt><dd>When the state of the switch changes it will output to the top if the switch is on or to the bottom if it is in the off position.</dd></dl><h3>Inputs</h3><dl class="message-properties"><dt>msg.enable<span class="property-type">boolean</span></dt><dd>Set to <code>true</code> to turn on the switch and <code>false</code> to turn it off. If the message has a property <code>enable</code> defined and set to a <code>boolean</code> the node will not have any output.</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd><strong>Status Color</strong></dd><ul><li>Green/Red: output from the node was due to input to the node</li><li>Blue: output from the node was due to the state of the node changing</li><li>Yellow: state of node changed but no output</li></ul></dl><h3>Examples</h3><dl class="message-properties"><div><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/switch.html#examples">link</a></p></div></dl></script>
<script type="text/html" data-help-name="ha-tag"><p>The Tag node outputs data when Home Assistant receives a tag scanned event for a configured tag ID. This node is useful for creating automations based on NFC tags or other scannable identifiers, allowing specific actions to be triggered when a tag is scanned.</p><h3>Configuration</h3><dl class="message-properties"><dt>Tags<span class="property-type">array</span></dt><dd>An array of tag ids to monitor for tag scanned events.</dd><dt>Devices<span class="property-type">array</span></dt><dd>An array of device ids to check when a configured tag is scanned.</dd><dt>Expose as<span class="property-type">string</span></dt><dd>When an entity is selected a switch entity will be created in Home Assistant. Turning on and off this switch will disable/enable the nodes in Node-RED.</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>event data</code>: full event object</li><li><code>tag id</code>: tag id of the tag that was scanned.</li><li><code>config</code>: config properties of the node</li></ul><dt>event object<span class="property-type">object</span></dt><table><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td>device_id</td><td>ID of the device that scanned the tag</td></tr><tr><td>tag_id</td><td>ID of the tag that was scanned</td></tr><tr><td>tag_name</td><td>Home Assistant name of the tag that was scanned</td></tr><tr><td>user_id</td><td>Home Assistant user ID on device that scanned the tag</td></tr></tbody></table></dl></script>
<script type="text/html" data-help-name="ha-text"><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><p>The Text node creates a text entity within Home Assistant that can be manipulated from Node-RED. Text entities are used to store and display text values, and this node allows you to dynamically update and control these values within your automations.</p><h3>Configuration</h3><dl class="message-properties"><dt>Mode <span text="required" class="home-assistant-badge">required</span><span class="property-type"></span></dt><dd>The mode of the node</dd><dt>Text <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><dd>The string of the entity should be updated to</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>properties of <code>msg.payload</code></dd><dt>Text<span class="property-type">string</span></dt><dd>The string of the text entity should be updated to</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>value</code>: The text string of the entity</li><li><code>previous value</code>: The previous text string of the entity</li><li><code>config</code>: The config properties of the node</li></ul></dl><h3>Examples</h3><dl class="message-properties"><div><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/text.html#examples">link</a></p></div></dl></script>
<script type="text/html" data-help-name="ha-time-entity"><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><p>The Time Entity node creates a time entity within Home Assistant that can be controlled from Node-RED. This entity type is used to represent time values, such as a specific time of day or a duration, and can be used to trigger automations based on time-related conditions.</p><h3>Configuration</h3><dl class="message-properties"><dt>Mode <span text="required" class="home-assistant-badge">required</span><span class="property-type"></span></dt><dd>The mode of the node</dd><dt>Value <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><ul><li>Format: <code>HH:mm:ss</code> | <code>HH:mm</code></li></ul><dd>The value of the entity should be updated to</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>properties of <code>msg.payload</code></dd><dt>value<span class="property-type">string</span></dt><ul><li>Format: <code>HH:mm:ss</code> | <code>HH:mm</code></li></ul><dd>The value of the entity should be updated to</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>value</code>: The value of the entity</li><li><code>previous value</code>: The previous value of the entity</li><li><code>config</code>: The config properties of the node</li></ul></dl><h3>Examples</h3><dl class="message-properties"><div><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/time-entity.html#examples">link</a></p></div></dl></script>
<script type="text/html" data-help-name="ha-time"><p>The Time node can be scheduled to trigger at a specific future date and time, based on a Home Assistant entity. This node is useful for creating time-based automations, such as triggering a notification or alarm at a specific hour.</p><h3>Configuration</h3><dl class="message-properties"><dt>Entity Id<span class="property-type">string</span></dt><dd>A Home Assistant entity to be used when scheduling the node.</dd><dt>Property<span class="property-type">string</span></dt><dd>Which property of the entity object to use to schedule the node.</dd><dd>example properties:</dd><ul><li><code>entity_id</code></li><li><code>state</code></li><li><code>attributes.date</code></li><li><code>last_updated</code></li></ul><dd>example values for the property:</dd><ul><li><code>2020-12-31T02:47:54.837Z</code></li><li><code>1609382842709</code></li><li><code>13:40</code></li><li><code>23:59:02</code></li></ul><dt>Offset<span class="property-type">number</span></dt><dd>A negative or positive number that will be added to the scheduled time.</dd><dt>Randomize time within the offset<span class="property-type">boolean</span></dt><dd>When selected the time to trigger will be random selected from the scheduled time to the +/- offset.</dd><dt>Payload<span class="property-type">string | number | boolean | object</span></dt><dd>The payload is fully customizable. The default will be a JSONata expression that outputs the entity state.</dd><dt>Repeat Daily<span class="property-type">boolean</span></dt><dd>If selected the node will only use the time portion of the date string to schedule the node and will trigger at that time each day. Otherwise, the node will only trigger once at the given day and time.</dd><dt>Expose as<span class="property-type">string</span></dt><dd>When an entity is selected a switch entity will be created in Home Assistant. Turning on and off this switch will disable/enable the nodes in Node-RED.</dd></dl><h3>Outputs</h3><dl class="message-properties"><dt>topic<span class="property-type">string</span></dt><dd>The entity id in the configuration.</dd><dt>payload<span class="property-type">string | number | boolean | object</span></dt><dt>data<span class="property-type">object</span></dt><dd>The entity object of the entity in the configuration.</dd></dl></script>
<script type="text/html" data-help-name="trigger-state"><p>The Trigger: State node functions similarly to the State Changed Node but provides advanced functionality for common automation use cases. This node allows for more complex conditions and actions based on entity state changes, making it a powerful tool for creating detailed and nuanced automations.</p><h3>Configuration</h3><dl class="message-properties"><dt>Entity <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><dd>Example:</dd><ul><li><code>light.kitchen</code> (entity) listens for state changes of the <code>light.kitchen</code> entity</li><li><code>^light.*</code> (regex) listens for state changes of all entities that start with <code>light.</code></li><li><code>light</code> (substring) listens for state changes of all entities that contain <code>light</code> in the entity ID</li></ul><dt>State Type<span class="property-type">string</span></dt><ul><li>Values: <code>string|number|boolean</code></li><li>Default: <code>string</code></li></ul><dd>Convert the state of the entity to the selected type. Boolean will be converted to true based on if the string is equal by default to (<code>y|yes|true|on|home|open</code>). Original value stored in msg.data.original_state</dd><dt>Conditions<span class="property-type"></span></dt><dd>This node has two default outputs "allowed" and "blocked". If all the conditions are true the default message will be sent to the "allowed" output otherwise, it will be sent to the "blocked" output.</dd><dd><strong>See Also:</strong></dd><ul><li><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/conditionals.html" rel="noopener noreferrer">Conditionals</a></li></ul><dt>Custom Outputs<span class="property-type"></span></dt><dd>All the above conditions need to be true for any custom outputs to be sent, having zero conditions is a valid option. Each custom output can send the default message or a custom message. Also, each one can have its constraint on whether or not to be sent.</dd><dt>Output on connect<span class="property-type">boolean</span></dt><dd>Output once on startup/deployment.</dd><dt>Enable input<span class="property-type">boolean</span></dt><dd>Enable the input to be used to send a message to the node.</dd><dt>Output debug information<span class="property-type">boolean</span></dt><dd>Output debug information to the debug tab.</dd><dt>Expose to Home Assistant<span class="property-type">boolean</span></dt><dd>Expose the node to Home Assistant.</dd></dl><h3>Input</h3><dl class="message-properties"><dd>Input is disabled by default. It can be enabled using the <code>Enable Input</code> option. Input can be used to enable/disable the node or for testing.</dd><dt>Enable / Disable<span class="property-type">string</span></dt><dd>If the incoming payload or message is a string and equal to <code>enable</code> or <code>disable</code> then set the node accordingly. Saves over restarts.</dd></dl><h3>Output</h3><dl class="message-properties"><dt>topic<span class="property-type">string</span></dt><dd>The entity_id that triggered the node</dd><dt>payload<span class="property-type">string</span></dt><dd>The state as sent by home assistant</dd><dt>data<span class="property-type">object</span></dt><dd>The original home assistant event containing <code>entity_id</code> <code>new_state</code> and <code>old_state</code> properties</dd></dl><h3>Testing</h3><dl class="message-properties"><dd>To test automation without having to manually change the state in home assistant send an input <code>payload</code> as an object which contains <code>entity_id</code>, <code>new_state</code>, and <code>old_state</code> properties. This will trigger the node as if the event came from Home Assistant.</dd><pre><code class="language-json">{
"entity_id": "test_entity",
"old_state": {
"state": "on"
},
"new_state": {
"state": "off"
}
}
</code></pre></dl><h3>References</h3><dl class="message-properties"><ul><li><a href="https://home-assistant.io/docs/configuration/state_object">HA State Object</a></li></ul></dl></script>
<script type="text/html" data-help-name="ha-update-config"><p>The Update Config node allows you to update the configuration of entities within Home Assistant. This node is used for dynamically adjusting the settings of entities, ensuring they stay in sync with your automation requirements.</p><h3>Configuration</h3><dl class="message-properties"><dt>Name<span class="property-type">string</span></dt><dd>A name for the node.</dd><dt>Server<span class="property-type">string</span></dt><dd>The node id of a <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/config-server.html" rel="noopener noreferrer">Server Config</a> node.</dd><dt>Entity Config<span class="property-type">string</span></dt><dd>The node id of an <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/entity-config.html" rel="noopener noreferrer">entity config</a>. This can be overridden by the <code>payload.id</code> property on the msg object.</dd></dl><h3>Inputs</h3><dl class="message-properties"><dd>All properties must be under <code>msg.payload</code> and will be ignored if not.</dd><dt>Example input<span class="property-type"></span></dt><dd>Example of the <code>msg.payload</code> object.</dd><pre><code class="language-json">{
"id": "d9d27ac6b4ebf78f",
"icon": "mdi:lightbulb",
"name": "My Light",
"entityPicture": "/local/images/my_light.png"
}
</code></pre><dt>id<span class="property-type">string</span></dt><dd>The node id of an entity config.</dd><dt>icon<span class="property-type">string</span></dt><dd>The icon to use for the entity.</dd><dt>name<span class="property-type">string</span></dt><dd>The friendly name to use for the entity.</dd><dt>entityPicture<span class="property-type">string</span></dt><dd>The entity picture to use for the entity.</dd></dl><h3>Examples</h3><dl class="message-properties"><div><p><a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/update-config.html#examples">link</a></p></div></dl>```</script>
<script type="text/html" data-help-name="ha-wait-until"><p>The Wait Until node waits for a specific condition to be met or for a timeout to occur before passing on the last received message. This node is useful for pausing the flow of automation until certain criteria are met, such as waiting for a door to close before turning off the lights.</p><h3>Configuration</h3><dl class="message-properties"><dt>Entities <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><ul><li>Accepts <a href="https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html" rel="noopener noreferrer">Mustache Templates</a> only for entity type</li></ul><dd>A list of entities to wait for the condition to be met. The node will wait for any of the entities to meet the condition. If the entity is not found it will be ignored.</dd><dd>The types that can be used are: entity id, substring, and regex.</dd><h5>Examples</h5><ul><li><code>light.living_room</code> - Will wait for the entity with the id <code>light.living_room</code></li><li><code>motion</code> - Will wait for any entity that has <code>motion</code> in the entity id</li><li><code>^light\..*</code> - Will wait for any entity that starts with <code>light.</code></li></ul><dt>Wait Until <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><dd>The <code>property</code> field will be checked against the <code>value</code> field using the comparator.</dd><dt>Timeout<span class="property-type">number</span></dt><dd>The amount of time to wait for the condition to become true before deactivating the node and passing the message object to the second output. If the timeout is equal to zero the node will wait indefinitely for the condition to be met.</dd><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p>If using a Node-RED global or flow context variable in the timeout field it will not update the timeout value if the context value changes after the node has been deployed.</p></div><dt>Check against the current state<span class="property-type">boolean</span></dt><dd>When an input is received it will check the comparator against the current state instead of waiting for a state change.</dd><div class="home-assistant-custom-block tip"><p class="custom-block-title">INFO</p><p>This is only available when there is only one entity selected</p></div></dl><h3>Input</h3><dl class="message-properties"><dt>reset<span class="property-type"></span></dt><dd>If the received message has this property set to any value the node will be set to inactive and the timeout cleared.</dd><dt>payload<span class="property-type">object</span></dt><dt>Example<span class="property-type"></span></dt><dt>Full Payload<span class="property-type"></span></dt><pre><code class="language-json">{
"entities": {
"entity": ["light.living_room", "light.bedroom"],
"substring": ["light."],
"regex": ["light.*"]
},
"property": "state",
"comparator": "is",
"value": "on",
"valueType": "str",
"timeout": 10,
"timeoutUnits": "seconds",
"checkCurrentState": false
}
</code></pre><h5>Override with a Single Entity</h5><pre><code class="language-json">{
"entities": "light.living_room"
}
</code></pre><h5>Override with a Several Entities</h5><pre><code class="language-json">{
"entities": ["light.living_room", "light.bedroom"]
}
</code></pre></dl><h3>Output</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>entity</code>: entity data of the triggered entity. Will be <code>undefined</code> if multiple entities are selected and the timeout occurs.</li><li><code>config</code>: config properties of the node</li></ul></dl></script>
<script type="text/html" data-help-name="ha-webhook"><p>The Webhook node outputs data received from a created webhook in Home Assistant. Webhooks are a way to receive data or trigger automations from external sources, and this node allows you to integrate those triggers into your Node-RED flows.</p><div class="home-assistant-custom-block warning"><p class="custom-block-title">WARNING</p><p><em>Needs <a href="https://github.com/zachowj/hass-node-red">Custom Integration</a> installed in Home Assistant for this node to function</em></p></div><h3>Configuration</h3><dl class="message-properties"><dt>ID <span text="required" class="home-assistant-badge">required</span><span class="property-type">string</span></dt><dd>A string to be used for the webhook URL in Home Assistant.</dd><dt>Allowed Methods <span text="required" class="home-assistant-badge">required</span><span class="property-type">list</span></dt><dd>A list of allowed methods that Home Assistant will accept for the webhook. At least one method must be selected.</dd><dt>Expose as<span class="property-type">string</span></dt><dd>When an entity is selected a switch entity will be created in Home Assistant. Turning on and off this switch will disable/enable the nodes in Node-RED.</dd></dl><h3>Outputs</h3><dl class="message-properties"><dd>Value types:</dd><ul><li><code>received data</code>: The parsed body from the webhook request</li><li><code>trigger id</code>: webhook id</li><li><code>headers</code>: entity state of the triggered entity</li><li><code>params</code>: Query string parameters</li><li><code>config</code>: config properties of the node</li></ul></dl></script>
<script type="text/html" data-help-name="ha-zone"><p>The Zone node outputs data when a configured entity enters or leaves one of the defined zones in Home Assistant. Zones are geographical areas you define in Home Assistant, and this node can trigger automations based on whether entities (like phones or trackers) enter or exit these zones.</p><h3>Configuration</h3><dl class="message-properties"><dt>Entities<span class="property-type">array</span></dt><dd>An array of entity ids to monitor for zone changes.</dd><dt>Event<span class="property-type">string</span></dt><dd>Set when to check an entity. Either entering or leaving a zone.</dd><dt>Zones<span class="property-type">array</span></dt><dd>An array of zone ids to check when a configured entity updates.</dd></dl><h3>Outputs</h3><dl class="message-properties"><dt>topic<span class="property-type">string</span></dt><dd>The entity id of the device/person that triggered the update.</dd><dt>payload<span class="property-type">string</span></dt><dd>The state of the device/person entity that triggered the update.</dd><dt>data<span class="property-type">object</span></dt><dd>The entity object of the device/person that triggered the update.</dd><dt>zones<span class="property-type">array</span></dt><dd>An array of zone entities where the device/person entity entered/left after an update of location.</dd></dl></script>
<script type="text/html" data-template-name="api-call-service"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-action.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-action.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label data-i18n="ha-action.label.action"></label><div id="ha-action"></div></div><div class="form-row"><ol id="target-list"></ol></div><div class="form-row"><label for="node-input-data" data-i18n="ha-action.label.data"></label> <input type="text" id="node-input-data" style="width:70%"> <input type="hidden" id="node-input-dataType"></div><div class="form-row checkbox-option" id="mustacheAltTags"><input type="checkbox" id="node-input-mustacheAltTags"> <label for="node-input-mustacheAltTags" data-i18n="ha-action.label.alternate_tags"></label></div><div class="form-row"><label for="node-input-mergeContext" data-i18n="ha-action.label.merge_context"></label> <input type="text" id="node-input-mergeContext" placeholder="lightOptions"></div><div class="form-row"><label for="node-input-queue" data-i18n="ha-action.label.queue"></label> <select type="text" id="node-input-queue"><option value="none" data-i18n="ha-action.label.queue_option.queue_none"></option><option value="first" data-i18n="ha-action.label.queue_option.queue_first"></option><option value="all" data-i18n="ha-action.label.queue_option.queue_all"></option><option value="last" data-i18n="ha-action.label.queue_option.queue_last"></option></select></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-debugenabled"> <label for="node-input-debugenabled" data-i18n="ha-action.label.show_debug"></label></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-blockInputOverrides"> <label for="node-input-blockInputOverrides" data-i18n="ha-action.label.block_input_overrides"></label></div><div id="service-data-desc" class="form-row"><button id="example-data" style="float:right" class="red-ui-button red-ui-button-small" data-i18n="ha-action.label.load_example_data"></button><h4><span data-i18n="ha-action.label.action"></span>: <span class="title"></span></h4><div class="unknown-service" data-i18n="ha-action.label.unknown_action"></div><div class="known-service"><p class="service-description"></p><table id="service-data-table" class="red-ui-info-table"><thead><tr><th>Property</th><th>Desc</th><th>Example</th></tr></thead><tbody></tbody></table></div></div></script>
<script type="text/html" data-template-name="ha-api"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-api.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-api.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-protocol" data-i18n="ha-api.label.protocol"></label> <select type="text" id="node-input-protocol" style="width:70%"><option value="websocket" data-i18n="ha-api.label.protocol_option.websocket"></option><option value="http" data-i18n="ha-api.label.protocol_option.http"></option></select></div><div class="form-row http"><label for="node-input-method" data-i18n="ha-api.label.method"></label> <select type="text" id="node-input-method" style="width:70%"><option value="get" data-i18n="ha-api.label.method_option.get"></option><option value="post" data-i18n="ha-api.label.method_option.post"></option><option value="put" data-i18n="ha-api.label.method_option.put"></option><option value="delete" data-i18n="ha-api.label.method_option.delete"></option></select></div><div class="form-row http"><label for="node-input-path" data-i18n="ha-api.label.path"></label> <input type="text" id="node-input-path" placeholder="config"></div><div class="form-row"><label id="data-label" for="node-input-data" data-i18n="ha-api.label.data"></label> <input type="text" id="node-input-data" style="width:70%"> <input type="hidden" id="node-input-dataType"></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row http"><label for="node-input-responseType" data-i18n="ha-api.label.response_type"></label> <select id="node-input-responseType" style="width:70%"><option value="text" data-i18n="ha-api.label.response_type_option.text"></option><option value="arraybuffer" data-i18n="ha-api.label.response_type_option.arraybuffer"></option><option value="json" data-i18n="ha-api.label.response_type_option.json"></option></select></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-debugenabled"> <label for="node-input-debugenabled" data-i18n="ha-api.label.show_debug"></label></div></script>
<script type="text/html" data-template-name="ha-binary-sensor"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name"><span data-i18n="ha-binary-sensor.label.name"></span></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-entityConfig"><span data-i18n="ha-binary-sensor.label.entity_config"></span></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row"><label for="node-input-state"><span data-i18n="ha-binary-sensor.label.state"></span></label> <input type="text" id="node-input-state" style="width:70%"> <input type="hidden" id="node-input-stateType"></div><div class="form-row"><ol id="attributes"></ol></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row"><label for="node-input-inputOverride"><span data-i18n="ha-binary-sensor.label.input_override"></span></label> <select id="node-input-inputOverride" style="width:68%"><option value="allow" data-i18n="ha-binary-sensor.label.input_override_option.allow"></option><option value="merge" data-i18n="ha-binary-sensor.label.input_override_option.merge"></option><option value="block" data-i18n="ha-binary-sensor.label.input_override_option.block"></option></select></div></script>
<script type="text/html" data-template-name="ha-button"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name"><span data-i18n="ha-button.label.name"></span></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-entityConfig"><span data-i18n="ha-button.label.entity_config"></span></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row"><ol id="custom-outputs"></ol></div></script>
<script type="text/html" data-template-name="server"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-config-input-name" data-i18n="config-server.label.name"></label> <input type="text" id="node-config-input-name"></div><div class="form-row checkbox-option"><input type="checkbox" id="node-config-input-addon"> <label for="node-config-input-addon" data-i18n="config-server.label.using_add_on"></label></div><div class="form-row addon checkbox-option"><input type="checkbox" id="node-config-input-connectionDelay"> <label for="node-config-input-connectionDelay" data-i18n="config-server.label.delay_connection_attempts"></label></div><div id="server-info"><div class="form-row"><label for="node-config-input-host" data-i18n="config-server.label.base_url"></label><div style="width:70%;display:inline-flex"><input type="text" id="node-config-input-host" placeholder="http://localhost:8123" style="flex-grow:1"> <a id="discoverInstances" class="red-ui-button" style="margin-left:10px"><i class="fa fa-search"></i></a></div></div><div class="form-row"><label id="access-token-label" for="node-config-input-access_token" data-i18n="config-server.label.access_token"></label> <input type="text" id="node-config-input-access_token" placeholder="access token"></div><div class="form-row checkbox-option"><input type="checkbox" id="accept_unauthorized_certs"> <label for="accept_unauthorized_certs" data-i18n="config-server.label.accept_all_certs"></label></div></div><div class="form-row"><label for="node-config-input-ha_boolean" data-i18n="config-server.label.state_boolean_list"></label> <input type="text" id="node-config-input-ha_boolean" placeholder="y|yes|true|on|home|open"></div><div class="form-row checkbox-option"><input type="checkbox" id="node-config-input-heartbeat"> <label for="node-config-input-heartbeat" data-i18n="config-server.label.enable_heartbeat"></label></div><div class="form-row" id="heartbeatIntervalRow"><label for="node-config-input-heartbeatInterval" data-i18n="config-server.label.heartbeat_interval"></label><div style="vertical-align:text-bottom;width:70%;display:inline-block"><input type="number" id="node-config-input-heartbeatInterval" style="width:30%" min="10"> <span data-i18n="config-server.label.seconds"></span></div></div><div class="form-row checkbox-option"><input type="checkbox" id="node-config-input-enableGlobalContextStore"> <label for="node-config-input-enableGlobalContextStore" data-i18n="config-server.label.enable_global_context_store"></label></div><hr><div class="form-row" data-i18n="config-server.label.ui_settings"></div><div class="form-row checkbox-option"><input type="checkbox" id="node-config-input-cacheJson"> <label for="node-config-input-cacheJson" data-i18n="config-server.label.cache_autocomplete_results"></label></div><div class="form-row"><span data-i18n="config-server.label.id_selector"></span></div><div class="form-row"><label for="node-config-input-areaSelector" data-i18n="config-server.label.area_selector"></label> <select id="node-config-input-areaSelector"><option value="id" data-i18n="config-server.label.selector_option.id"></option><option value="friendlyName" data-i18n="config-server.label.selector_option.friendly_name"></option></select></div><div class="form-row"><label for="node-config-input-deviceSelector" data-i18n="config-server.label.device_selector"></label> <select id="node-config-input-deviceSelector"><option value="id" data-i18n="config-server.label.selector_option.id"></option><option value="friendlyName" data-i18n="config-server.label.selector_option.friendly_name"></option></select></div><div class="form-row"><label for="node-config-input-entitySelector" data-i18n="config-server.label.entity_selector"></label> <select id="node-config-input-entitySelector"><option value="id" data-i18n="config-server.label.selector_option.id"></option><option value="friendlyName" data-i18n="config-server.label.selector_option.friendly_name"></option></select></div><div class="form-row"><span data-i18n="config-server.label.status_title"></span></div><div class="form-row"><label data-i18n="config-server.label.separator"></label> <input id="node-config-input-statusSeparator" type="text"></div><div class="form-row"><label data-i18n="config-server.label.year"></label> <select id="node-config-input-statusYear"><option value="hidden" data-i18n="config-server.label.date_option.hidden"></option><option value="numeric" data-i18n="config-server.label.date_option.numeric"></option><option value="2-digit" data-i18n="config-server.label.date_option.two_digit"></option></select></div><div class="form-row"><label data-i18n="config-server.label.month"></label> <select id="node-config-input-statusMonth"><option value="hidden" data-i18n="config-server.label.date_option.hidden"></option><option value="numeric" data-i18n="config-server.label.date_option.numeric"></option><option value="2-digit" data-i18n="config-server.label.date_option.two_digit"></option><option value="long" data-i18n="config-server.label.date_option.long"></option><option value="short" data-i18n="config-server.label.date_option.short"></option></select></div><div class="form-row"><label data-i18n="config-server.label.day"></label> <select id="node-config-input-statusDay"><option value="hidden" data-i18n="config-server.label.date_option.hidden"></option><option value="numeric" data-i18n="config-server.label.date_option.numeric"></option><option value="2-digit" data-i18n="config-server.label.date_option.two_digit"></option></select></div><div class="form-row"><label data-i18n="config-server.label.hour_cycle"></label> <select id="node-config-input-statusHourCycle"><option value="default" data-i18n="config-server.label.hour_cycle_option.default"></option><option value="h12" data-i18n="config-server.label.hour_cycle_option.12_hour_format"></option><option value="h23" data-i18n="config-server.label.hour_cycle_option.24_hour_format"></option></select></div><div class="form-row"><label data-i18n="config-server.label.time_format"></label> <select id="node-config-input-statusTimeFormat"><option value="h:m" data-i18n="config-server.label.time_format_option.hour_min"></option><option value="h:m:s" data-i18n="config-server.label.time_format_option.hour_min_sec"></option><option value="h:m:s.ms" data-i18n="config-server.label.time_format_option.hour_min_sec_ms"></option></select></div></script>
<script type="text/html" data-template-name="api-current-state"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-outputs"><div class="form-row"><label for="node-input-name" data-i18n="api-current-state.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="api-current-state.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-entity_id" data-i18n="api-current-state.label.entity_id"></label> <input type="text" id="node-input-entity_id"></div><div class="form-row"><label for="node-input-halt_if_compare" data-i18n="api-current-state.label.if_state"></label> <select type="text" id="node-input-halt_if_compare" style="width:20%"><option value="is" data-i18n="api-current-state.label.if_state_option.is"></option><option value="is_not" data-i18n="api-current-state.label.if_state_option.is_not"></option><option value="lt" data-i18n="api-current-state.label.if_state_option.less_than"></option><option value="lte" data-i18n="api-current-state.label.if_state_option.less_than_or_equal_to"></option><option value="gt" data-i18n="api-current-state.label.if_state_option.greater_than"></option><option value="gte" data-i18n="api-current-state.label.if_state_option.greater_than_or_equal_to"></option><option value="includes" data-i18n="api-current-state.label.if_state_option.includes"></option><option value="does_not_include" data-i18n="api-current-state.label.if_state_option.does_not_include"></option><option value="jsonata" data-i18n="api-current-state.label.if_state_option.jsonata"></option></select> <input type="text" id="node-input-halt_if" style="width:50%"> <input type="hidden" id="node-input-halt_if_type"></div><div class="form-row" id="for-row"><label for="node-input-for" data-i18n="api-current-state.label.for"></label> <input type="text" id="node-input-for" style="width:45%"> <input type="hidden" id="node-input-forType"> <select id="node-input-forUnits" style="width:25%"><option value="milliseconds" data-i18n="api-current-state.label.for_option.milliseconds"></option><option value="seconds" data-i18n="api-current-state.label.for_option.seconds"></option><option value="minutes" data-i18n="api-current-state.label.for_option.minutes"></option><option value="hours" data-i18n="api-current-state.label.for_option.hours"></option><option value="days" data-i18n="api-current-state.label.for_option.days"></option></select></div><div class="form-row"><label for="node-input-state_type" data-i18n="api-current-state.label.state_type"></label> <select type="text" id="node-input-state_type" style="width:auto"><option value="str" data-i18n="api-current-state.label.state_type_option.string"></option><option value="num" data-i18n="api-current-state.label.state_type_option.number"></option><option value="habool" data-i18n="api-current-state.label.state_type_option.boolean"></option></select></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-blockInputOverrides"> <label for="node-input-blockInputOverrides" data-i18n="api-current-state.label.block_input_overrides"></label></div></script>
<script type="text/html" data-template-name="ha-device"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-device.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-device.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-deviceType"><span data-i18n="ha-device.label.type"></span></label> <select id="node-input-deviceType" style="width:70%"><option value="trigger" data-i18n="ha-device.label.trigger"></option><option value="action" data-i18n="ha-device.label.action"></option></select></div><div class="form-row"><label for="node-input-device" data-i18n="ha-device.label.device"></label><div id="ha-device"></div></div><div class="form-row"><label for="event" data-i18n="ha-device.label.trigger" style="text-transform:capitalize"></label> <select id="event" style="width:70%" disabled="disabled"></select></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-device-config"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-config-input-name" data-i18n="ha-device-config.label.name"></label> <input type="text" id="node-config-input-name"></div><div class="form-row"><label for="node-config-input-manufacturer" data-i18n="ha-device-config.label.manufacturer"></label> <input type="text" id="node-config-input-manufacturer"></div><div class="form-row"><label for="node-config-input-model" data-i18n="ha-device-config.label.model"></label> <input type="text" id="node-config-input-model"></div><div class="form-row"><label for="node-config-input-swVersion" data-i18n="ha-device-config.label.sw_version"></label> <input type="text" id="node-config-input-swVersion"></div><div class="form-row"><label for="node-config-input-hwVersion" data-i18n="ha-device-config.label.hw_version"></label> <input type="text" id="node-config-input-hwVersion"></div></script>
<script type="text/html" data-template-name="ha-entity">This node has been deperacated in favor of the indivdual entity nodes.</script>
<script type="text/html" data-template-name="ha-entity-config"><input type="hidden" id="node-config-input-version"><div class="form-row"><label for="node-config-input-name"><span data-i18n="ha-entity-config.label.name"></span></label> <input type="text" id="node-config-input-name"></div><div class="form-row"><label for="node-config-input-server"><span data-i18n="ha-entity-config.label.server"></span></label> <input type="text" id="node-config-input-server"></div><div class="form-row"><label for="node-config-input-deviceConfig"><span data-i18n="ha-entity-config.label.device"></span></label> <input type="text" id="node-config-input-deviceConfig"></div><div class="form-row"><label for="node-config-input-entityType"><span data-i18n="ha-entity-config.label.type"></span></label> <select id="node-config-input-entityType" style="width:70%"><option value="binary_sensor" data-i18n="ha-entity-config.label.type_option.binary_sensor"></option><option value="button" data-i18n="ha-entity-config.label.type_option.button"></option><option value="number" data-i18n="ha-entity-config.label.type_option.number"></option><option value="select" data-i18n="ha-entity-config.label.type_option.select"></option><option value="sensor" data-i18n="ha-entity-config.label.type_option.sensor"></option><option value="switch" data-i18n="ha-entity-config.label.type_option.switch"></option><option value="text" data-i18n="ha-entity-config.label.type_option.text"></option><option value="time" data-i18n="ha-entity-config.label.type_option.time"></option></select></div><hr><div id="ha-config-rows"></div><div id="resend-row" class="form-row ha-optional-row checkbox-option"><input type="checkbox" id="node-config-input-resend"> <label for="node-config-input-resend"><span data-i18n="ha-entity-config.label.resend"></span></label></div><div class="form-row checkbox-option"><input type="checkbox" id="node-config-input-debugEnabled"> <label for="node-config-input-debugEnabled"><span data-i18n="ha-entity-config.label.show_debug"></span></label></div></script>
<script type="text/html" data-template-name="server-events"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="server-events.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="server-events.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-eventType" data-i18n="server-events.label.event_type"></label> <input type="text" id="node-input-eventType" data-i18n="[placeholder]server-events.placeholder.all_events"></div><div id="eventAlert" class="ui-state-error ha-alert-box"><strong data-i18n="server-events.alert"></strong>: <span data-i18n="server-events.alert_message"></span></div><div class="form-row"><label for="node-input-eventData" data-i18n="server-events.label.event_data"></label> <input type="text" id="node-input-eventData" style="width:70%"></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-waitForRunning"> <label for="node-input-waitForRunning" data-i18n="server-events.label.output_only_after_running"></label></div></script>
<script type="text/html" data-template-name="ha-events-calendar"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-events-calendar.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-events-calendar.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-entityId"><i class="fa fa-cube"></i> <span data-i18n="ha-events-calendar.label.entityId"></span></label> <input type="text" id="node-input-entityId"></div><div class="form-row"><label for="node-input-eventType" data-i18n="ha-events-calendar.label.eventType"></label> <select type="text" id="node-input-eventType"><option value="start" data-i18n="ha-events-calendar.label.start"></option><option value="end" data-i18n="ha-events-calendar.label.end"></option></select></div><div class="form-row"><label for="node-input-offset" data-i18n="ha-events-calendar.label.offset"></label> <input type="text" id="node-input-offset" style="width:43%"> <input type="hidden" id="node-input-offsetType"> <select id="node-input-offsetUnits" style="width:27%"><option value="seconds" data-i18n="ha-events-calendar.label.seconds"></option><option value="minutes" data-i18n="ha-events-calendar.label.minutes"></option><option value="hours" data-i18n="ha-events-calendar.label.hours"></option></select></div><div class="form-row"><label for="node-input-filter" data-i18n="ha-events-calendar.label.filter"></label> <input type="text" id="node-input-filter"> <input type="hidden" id="node-input-filterType"></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="server-state-changed"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-outputs"><div class="form-row"><label for="node-input-name" data-i18n="server-state-changed.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="server-state-changed.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><div id="entity-list"></div></div><div class="form-row"><label for="node-input-ifState" data-i18n="server-state-changed.label.if_state"></label> <select id="node-input-ifStateOperator" style="width:20%"><option value="is" data-i18n="server-state-changed.label.if_state_option.is"></option><option value="is_not" data-i18n="server-state-changed.label.if_state_option.is_not"></option><option value="lt" data-i18n="server-state-changed.label.if_state_option.less_than"></option><option value="lte" data-i18n="server-state-changed.label.if_state_option.less_than_or_equal_to"></option><option value="gt" data-i18n="server-state-changed.label.if_state_option.greater_than"></option><option value="gte" data-i18n="server-state-changed.label.if_state_option.greater_than_or_equal_to"></option><option value="includes" data-i18n="server-state-changed.label.if_state_option.includes"></option><option value="does_not_include" data-i18n="server-state-changed.label.if_state_option.does_not_include"></option><option value="jsonata" data-i18n="server-state-changed.label.if_state_option.jsonata"></option></select> <input type="text" id="node-input-ifState" style="width:50%"> <input type="hidden" id="node-input-ifStateType"></div><div class="form-row"><label for="node-input-for" data-i18n="server-state-changed.label.for"></label> <div class="ha-multi-item-row"><input type="text" id="node-input-for"> <input type="hidden" id="node-input-forType"> <select id="node-input-forUnits"><option value="milliseconds" data-i18n="server-state-changed.label.for_option.milliseconds"></option><option value="seconds" data-i18n="server-state-changed.label.for_option.seconds"></option><option value="minutes" data-i18n="server-state-changed.label.for_option.minutes"></option><option value="hours" data-i18n="server-state-changed.label.for_option.hours"></option><option value="days" data-i18n="server-state-changed.label.for_option.days"></option></select></div></div><div class="form-row"><label for="node-input-stateType" data-i18n="server-state-changed.label.state_type"></label> <select type="text" id="node-input-stateType"><option value="str" data-i18n="server-state-changed.label.state_type_option.string"></option><option value="num" data-i18n="server-state-changed.label.state_type_option.number"></option><option value="habool" data-i18n="server-state-changed.label.state_type_option.boolean"></option></select></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-outputInitially"> <label for="node-input-outputInitially" data-i18n="server-state-changed.label.output_on_connect"></label></div><div class="form-row"><p data-i18n="server-state-changed.label.ignore_state_change_event_when"></p><ul class="ha-ignore-state"><li><input type="checkbox" id="node-input-ignorePrevStateNull"> <label for="node-input-ignorePrevStateNull" data-i18n="server-state-changed.label.ignore_prev_state_null"></label></li><li><input type="checkbox" id="node-input-ignorePrevStateUnknown"> <label for="node-input-ignorePrevStateUnknown" data-i18n="server-state-changed.label.ignore_prev_state_unknown"></label></li><li><input type="checkbox" id="node-input-ignorePrevStateUnavailable"> <label for="node-input-ignorePrevStateUnavailable" data-i18n="server-state-changed.label.ignore_prev_state_unavailable"></label></li><li><input type="checkbox" id="node-input-ignoreCurrentStateUnknown"> <label for="node-input-ignoreCurrentStateUnknown" data-i18n="server-state-changed.label.ignore_current_state_unknown"></label></li><li><input type="checkbox" id="node-input-ignoreCurrentStateUnavailable"> <label for="node-input-ignoreCurrentStateUnavailable" data-i18n="server-state-changed.label.ignore_current_state_unavailable"></label></li><li><input type="checkbox" id="node-input-outputOnlyOnStateChange"> <label for="node-input-outputOnlyOnStateChange" data-i18n="server-state-changed.label.output_only_on_state_change"></label></li></ul></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-fire-event"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-fire-event.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-fire-event.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-event" data-i18n="ha-fire-event.label.event"></label> <input type="text" id="node-input-event"></div><div class="form-row"><label for="node-input-data" data-i18n="ha-fire-event.label.data"></label> <input type="text" id="node-input-data" style="width:70%"> <input type="hidden" id="node-input-dataType"></div></script>
<script type="text/html" data-template-name="ha-get-entities"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-get-entities.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-get-entities.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><ol id="conditions-list"></ol></div><div class="form-row"><label for="node-input-outputType" data-i18n="ha-get-entities.label.output_type"></label> <select id="node-input-outputType" style="width:70%"><option value="array" data-i18n="ha-get-entities.label.output_type_option.array"></option><option value="count" data-i18n="ha-get-entities.label.output_type_option.count"></option><option value="random" data-i18n="ha-get-entities.label.output_type_option.random"></option><option value="split" data-i18n="ha-get-entities.label.output_type_option.split"></option></select></div><div class="form-row checkbox-option output-option" id="output_empty_results"><input type="checkbox" id="node-input-outputEmptyResults"> <label for="node-input-outputEmptyResults" data-i18n="ha-get-entities.label.send_empty_results"></label></div><div class="form-row output-option" id="output_results_count"><label for="node-input-outputResultsCount" style="width:160px" data-i18n="ha-get-entities.label.max_results"></label> <input type="text" id="node-input-outputResultsCount" style="width:150px"></div><div class="form-row output-option" id="output_location"><label for="node-input-outputLocation" data-i18n="ha-get-entities.label.output_location"></label> <input type="hidden" id="node-input-outputLocationType"> <input type="text" id="node-input-outputLocation" style="width:70%"></div></script>
<script type="text/html" data-template-name="api-get-history"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="api-get-history.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="api-get-history.label.server"></label> <input type="text" id="node-input-server"></div><!-- Comparator Selection --><div class="form-row"><label for="node-input-entityId" data-i18n="api-get-history.label.entity_id"></label> <select type="text" id="node-input-entityIdType" style="width:18%"><option value="equals" data-i18n="api-get-history.label.entity_id_option.equal"></option><option value="regex" data-i18n="api-get-history.label.entity_id_option.regex"></option></select> <input type="text" id="node-input-entityId" style="width:52%"></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-useRelativeTime"> <label for="node-input-useRelativeTime" data-i18n="api-get-history.label.use_relative_time"></label></div><div class="form-row relative_row"><label for="node-input-relativeTime" data-i18n="api-get-history.label.in_the_last"></label> <input type="text" id="node-input-relativeTime" data-i18n="[placeholder]api-get-history.placeholder.relative_time" .></div><div class="form-row date_row"><label for="node-input-startDate" data-i18n="api-get-history.label.start_date"></label> <input type="datetime-local" id="node-input-startDate"></div><div class="form-row date_row"><label for="node-input-endDate" data-i18n="api-get-history.label.end_date"></label> <input type="datetime-local" id="node-input-endDate"></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-flatten"> <label for="node-input-flatten" data-i18n="api-get-history.label.flatten_results"></label></div><div class="form-row"><label for="node-input-outputType" data-i18n="api-get-history.label.output_type"></label> <select id="node-input-outputType" style="width:70%"><option value="array" data-i18n="api-get-history.label.output_type_option.array"></option><option value="split" data-i18n="api-get-history.label.output_type_option.split"></option></select></div><div class="form-row output-option" id="output_location"><label for="node-input-outputLocation" data-i18n="api-get-history.label.output_location"></label> <input type="hidden" id="node-input-outputLocationType"> <input type="text" id="node-input-outputLocation" style="width:70%"></div></script>
<script type="text/html" data-template-name="ha-number"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-inputs"><div class="form-row"><label for="node-input-name"><span data-i18n="ha-number.label.name"></span></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-entityConfig"><span data-i18n="ha-number.label.entity_config"></span></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row"><label for="node-input-mode"><span data-i18n="ha-number.label.mode"></span></label> <select id="node-input-mode"><option value="listen" data-i18n="ha-text.label.mode_option.listen"></option><option value="get" data-i18n="ha-text.label.mode_option.get"></option><option value="set" data-i18n="ha-text.label.mode_option.set"></option></select></div><div class="form-row"><label for="node-input-value"><span data-i18n="ha-number.label.value"></span></label> <input type="text" id="node-input-value" style="width:70%"> <input type="hidden" id="node-input-valueType"></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="poll-state"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-outputs"><div class="form-row"><label for="node-input-name" data-i18n="poll-state.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="poll-state.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-entityId" data-i18n="poll-state.label.entity_id"></label> <input type="text" id="node-input-entityId"></div><div class="form-row"><label for="node-input-updateinterval" data-i18n="poll-state.label.update_interval"></label> <input type="text" id="node-input-updateInterval" style="width:43%"> <input type="hidden" id="node-input-updateIntervalType"> <select id="node-input-updateIntervalUnits" style="width:27%"><option value="seconds" data-i18n="poll-state.label.update_interval_option.seconds"></option><option value="minutes" data-i18n="poll-state.label.update_interval_option.minutes"></option><option value="hours" data-i18n="poll-state.label.update_interval_option.hours"></option></select></div><div class="form-row"><label for="node-input-ifStateOperator" data-i18n="poll-state.label.if_state"></label> <select type="text" id="node-input-ifStateOperator" style="width:20%"><option value="is" data-i18n="poll-state.label.if_state_option.is"></option><option value="is_not" data-i18n="poll-state.label.if_state_option.is_not"></option><option value="lt" data-i18n="poll-state.label.if_state_option.less_than"></option><option value="lte" data-i18n="poll-state.label.if_state_option.less_than_or_equal_to"></option><option value="gt" data-i18n="poll-state.label.if_state_option.greater_than"></option><option value="gte" data-i18n="poll-state.label.if_state_option.greater_than_or_equal_to"></option><option value="includes" data-i18n="poll-state.label.if_state_option.includes"></option><option value="does_not_include" data-i18n="poll-state.label.if_state_option.does_not_include"></option><option value="jsonata" data-i18n="poll-state.label.if_state_option.jsonata"></option></select> <input type="text" id="node-input-ifState" style="width:50%"> <input type="hidden" id="node-input-ifStateType"></div><div class="form-row"><label for="node-input-stateType" data-i18n="poll-state.label.state_type"></label> <select type="text" id="node-input-stateType" style="width:auto"><option value="str" data-i18n="poll-state.label.state_type_option.string"></option><option value="num" data-i18n="poll-state.label.state_type_option.number"></option><option value="habool" data-i18n="poll-state.label.state_type_option.boolean"></option></select></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-outputOnChanged"> <label for="node-input-outputOnChanged" data-i18n="poll-state.label.output_on_change"></label></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-outputInitially"> <label for="node-input-outputInitially" data-i18n="poll-state.label.output_on_connect"></label></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="api-render-template"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="api-render-template.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="api-render-template.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row" style="position:relative;margin-bottom:0"><label for="node-input-template" data-i18n="api-render-template.label.template"></label> <input type="hidden" id="node-input-template" autofocus="autofocus"></div><div class="form-row node-text-editor-row"><div style="height:250px;min-height:150px" class="node-text-editor" id="node-input-template-editor"></div></div><div class="form-row"><label for="node-input-templateLocation" data-i18n="api-render-template.label.template"></label> <input type="text" id="node-input-templateLocation" style="width:70%"> <input type="hidden" id="node-input-templateLocationType"></div><div class="form-row"><label for="node-input-resultsLocation" data-i18n="api-render-template.label.results"></label> <input type="text" id="node-input-resultsLocation" style="width:70%"> <input type="hidden" id="node-input-resultsLocationType"></div></script>
<script type="text/html" data-template-name="ha-select"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-inputs"><div class="form-row"><label for="node-input-name"><span data-i18n="ha-select.label.name"></span></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-entityConfig"><span data-i18n="ha-select.label.entity_config"></span></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row"><label for="node-input-mode"><span data-i18n="ha-select.label.mode"></span></label> <select id="node-input-mode"><option value="listen" data-i18n="ha-text.label.mode_option.listen"></option><option value="get" data-i18n="ha-text.label.mode_option.get"></option><option value="set" data-i18n="ha-text.label.mode_option.set"></option></select></div><div class="form-row"><label for="node-input-value"><span data-i18n="ha-select.label.value"></span></label> <input type="text" id="node-input-value" style="width:70%"> <input type="hidden" id="node-input-valueType"></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-sensor"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name"><span data-i18n="ha-sensor.label.name"></span></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-entityConfig"><span data-i18n="ha-sensor.label.entity_config"></span></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row"><label for="node-input-state"><span data-i18n="ha-sensor.label.state"></span></label> <input type="text" id="node-input-state" style="width:70%"> <input type="hidden" id="node-input-stateType"></div><div class="form-row"><ol id="attributes"></ol></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row"><label for="node-input-inputOverride"><span data-i18n="ha-sensor.label.input_override"></span></label> <select id="node-input-inputOverride" style="width:68%"><option value="allow" data-i18n="ha-sensor.label.input_override_option.allow"></option><option value="merge" data-i18n="ha-sensor.label.input_override_option.merge"></option><option value="block" data-i18n="ha-sensor.label.input_override_option.block"></option></select></div></script>
<script type="text/html" data-template-name="ha-sentence"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-inputs"><div class="form-row"><label for="node-input-name" data-i18n="ha-sentence.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-sentence.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-mode"><span data-i18n="ha-select.label.mode"></span></label> <select id="node-input-mode"><option value="trigger" data-i18n="ha-sentence.label.mode_option.trigger"></option><option value="response" data-i18n="ha-sentence.label.mode_option.response"></option></select></div><div class="form-row sentence-trigger"><ol id="node-input-sentences-container"></ol></div><div class="form-row sentence-trigger"><label for="node-input-triggerResponseType"><span data-i18n="ha-sentence.label.response_type"></span></label> <select id="node-input-triggerResponseType"><option value="fixed" data-i18n="ha-sentence.label.response_type_option.fixed"></option><option value="dynamic" data-i18n="ha-sentence.label.response_type_option.dynamic"></option></select></div><div class="form-row sentence-response"><label for="node-input-response" data-i18n="ha-sentence.label.response"></label> <input type="text" id="node-input-response" style="width:70%"> <input type="hidden" id="node-input-responseType"></div><div class="form-row sentence-trigger"><label for="node-input-triggerResponse" data-i18n="ha-sentence.label.response"></label> <input type="text" id="node-input-triggerResponse" placeholder="Done"></div><div class="form-row sentence-trigger"><label for="node-input-responseTimeout" data-i18n="ha-sentence.label.timeout"></label> <input type="text" id="node-input-responseTimeout" value="1000"></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row sentence-trigger" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-switch"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-inputs"><div class="form-row"><label for="node-input-name"><span data-i18n="ha-switch.label.name"></span></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-entityConfig"><span data-i18n="ha-switch.label.entity_config"></span></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-enableInput"> <label for="node-input-enableInput"><span data-i18n="ha-switch.label.enable_input"></span></label></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-outputOnStateChange"> <label for="node-input-outputOnStateChange"><span data-i18n="ha-switch.label.output_on_state_change"></span></label></div><div id="ha-custom-ouputs" class="form-row"><ol id="custom-outputs"></ol></div></script>
<script type="text/html" data-template-name="ha-tag"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-tag.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-tag.label.server"></label> <input type="text" id="node-input-server"></div><div id="no-tags-found" class="ui-state-error ha-alert-box" data-i18n="ha-tag.errors.no_tags_found"></div><div class="form-row"><ol id="tags"></ol></div><div class="form-row"><ol id="devices"></ol></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-text"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-inputs"><div class="form-row"><label for="node-input-name"><span data-i18n="ha-text.label.name"></span></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-entityConfig"><span data-i18n="ha-text.label.entity_config"></span></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row"><label for="node-input-mode"><span data-i18n="ha-text.label.mode"></span></label> <select id="node-input-mode"><option value="listen" data-i18n="ha-text.label.mode_option.listen"></option><option value="get" data-i18n="ha-text.label.mode_option.get"></option><option value="set" data-i18n="ha-text.label.mode_option.set"></option></select></div><div class="form-row"><label for="node-input-text"><span data-i18n="ha-text.label.text"></span></label> <input type="text" id="node-input-value" style="width:70%"> <input type="hidden" id="node-input-valueType"></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-time"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-time.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-time.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-entityId" data-i18n="ha-time.label.entity_id"></label> <input type="text" id="node-input-entityId"></div><div class="form-row"><label for="node-input-property" data-i18n="ha-time.label.property"></label> <input type="text" id="node-input-property" placeholder="state"></div><div class="form-row"><label for="node-input-offset" data-i18n="ha-time.label.offset"></label> <input type="text" id="node-input-offset" style="width:43%"> <input type="hidden" id="node-input-offsetType"> <select id="node-input-offsetUnits" style="width:27%"><option value="seconds" data-i18n="ha-time.label.offset_unit_option.seconds"></option><option value="minutes" data-i18n="ha-time.label.offset_unit_option.minutes"></option><option value="hours" data-i18n="ha-time.label.offset_unit_option.hours"></option></select></div><div class="form-row checkbox-option"><label><input type="checkbox" id="node-input-randomOffset"> <span data-i18n="ha-time.label.randomize_offset"></span></label></div><div class="form-row" id="entitiesFound"></div><div class="form-row checkbox-option"><label><input type="checkbox" id="node-input-repeatDaily"> <span data-i18n="ha-time.label.repeat_daily"></span></label><div id="days-of-the-week"><div><input type="checkbox" checked="checked" id="node-input-sunday"> <label for="node-input-sunday" data-i18n="ha-time.label.sunday"></label></div><div><input type="checkbox" checked="checked" id="node-input-monday"> <label for="node-input-monday" data-i18n="ha-time.label.monday"></label></div><div><input type="checkbox" checked="checked" id="node-input-tuesday"> <label for="node-input-tuesday" data-i18n="ha-time.label.tuesday"></label></div><div><input type="checkbox" checked="checked" id="node-input-wednesday"> <label for="node-input-wednesday" data-i18n="ha-time.label.wednesday"></label></div><div><input type="checkbox" checked="checked" id="node-input-thursday"> <label for="node-input-thursday" data-i18n="ha-time.label.thursday"></label></div><div><input type="checkbox" checked="checked" id="node-input-friday"> <label for="node-input-friday" data-i18n="ha-time.label.friday"></label></div><div><input type="checkbox" checked="checked" id="node-input-saturday"> <label for="node-input-saturday" data-i18n="ha-time.label.saturday"></label></div></div></div><div class="form-row checkbox-option"><label><input type="checkbox" id="node-input-ignorePastDate"> <span data-i18n="ha-time.label.ignore_past_date"></span></label></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-time-entity"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-inputs"><div class="form-row"><label for="node-input-name"><span data-i18n="ha-time-entity.label.name"></span></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-entityConfig"><span data-i18n="ha-time-entity.label.entity_config"></span></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row"><label for="node-input-mode"><span data-i18n="ha-time-entity.label.mode"></span></label> <select id="node-input-mode"><option value="listen" data-i18n="ha-time-entity.label.mode_option.listen"></option><option value="get" data-i18n="ha-time-entity.label.mode_option.get"></option><option value="set" data-i18n="ha-time-entity.label.mode_option.set"></option></select></div><div class="form-row"><label for="node-input-value"><span data-i18n="ha-time-entity.label.value"></span></label> <input type="text" id="node-input-value" style="width:70%"> <input type="hidden" id="node-input-valueType"></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="trigger-state"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-inputs"> <input type="hidden" id="node-input-outputs"><!-- Name --><div class="form-row"><label for="node-input-name" data-i18n="trigger-state.label.name"></label> <input type="text" id="node-input-name"></div><!-- Server --><div class="form-row"><label for="node-input-server" data-i18n="trigger-state.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><div id="entity-list"></div></div><div class="form-row"><label for="node-input-stateType" data-i18n="trigger-state.label.state_type"></label> <select type="text" id="node-input-stateType"><option value="str" data-i18n="trigger-state.label.state_type_option.string"></option><option value="num" data-i18n="trigger-state.label.state_type_option.number"></option><option value="habool" data-i18n="trigger-state.label.state_type_option.boolean"></option></select></div><!-- Constraints List --><div class="form-row"><ol id="constraint-list"></ol></div><!-- Output List --><div class="form-row"><ol id="output-list"></ol></div><div class="form-row checkbox-option-left"><input type="checkbox" id="node-input-outputInitially"> <label for="node-input-outputInitially" data-i18n="trigger-state.label.output_on_connect"></label></div><div class="form-row checkbox-option-left"><input type="checkbox" id="node-input-enableInput"> <label for="node-input-enableInput" data-i18n="trigger-state.label.enable_input"></label></div><div class="form-row checkbox-option-left"><input type="checkbox" id="node-input-debugEnabled"> <label for="node-input-debugEnabled" data-i18n="trigger-state.label.show_debug"></label></div><div id="constraint-template" style="display:none"><!-- Target Selection --><div class="editable-list-row"><!-- Type --> <select type="text" class="target-type" style="width:140px"><option value="this_entity" data-i18n="trigger-state.label.target_value_option.this_entity"></option><option value="entity_id" data-i18n="trigger-state.label.target_value_option.entity_id"></option></select><!-- Value --> <input type="text" class="target-value" disabled="disabled"></div><!-- Property Selection --><div class="editable-list-row"><!-- Type --> <select type="text" class="property-type" style="width:140px"><option value="current_state" data-i18n="trigger-state.label.target_type_option.current_state"></option><option value="previous_state" data-i18n="trigger-state.label.target_type_option.previous_state"></option><option value="property" data-i18n="trigger-state.label.target_type_option.property"></option></select><!-- Value --> <input type="text" class="property-value" disabled="disabled"></div><!-- Comparator Selection --><div class="editable-list-row"><!-- Type --> <select type="text" class="comparator-type" style="width:140px"><option value="is" data-i18n="trigger-state.label.comparator_option.is"></option><option value="is_not" data-i18n="trigger-state.label.comparator_option.is_not"></option><option value=">" data-i18n="trigger-state.label.comparator_option.greater_than"></option><option value=">=" data-i18n="trigger-state.label.comparator_option.greater_than_or_equal_to"></option><option value="<" data-i18n="trigger-state.label.comparator_option.less_than"></option><option value="<=" data-i18n="trigger-state.label.comparator_option.less_than_or_equal_to"></option><option value="includes" data-i18n="trigger-state.label.comparator_option.includes"></option><option value="does_not_include" data-i18n="trigger-state.label.comparator_option.does_not_include"></option></select><!-- Value --> <input type="text" class="comparator-value" style="width:65%"></div></div><div id="output-template" style="display:none"><div class="editable-list-row"><!-- Type --> <select type="text" class="message-type" style="width:140px"><option value="default" data-i18n="trigger-state.label.message_value_option.default"></option><option value="custom" data-i18n="trigger-state.label.message_value_option.custom"></option><option value="payload" data-i18n="trigger-state.label.message_value_option.custom_payload"></option></select> <input type="text" class="message-value" style="width:62%"></div><!-- Output Comparator Selection --><div class="editable-list-row"><select type="text" class="comparator-property-type" style="width:140px"><option value="always" data-i18n="trigger-state.label.comparator_property_value_option.always"></option><option value="current_state" data-i18n="trigger-state.label.comparator_property_value_option.if_state"></option><option value="previous_state" data-i18n="trigger-state.label.comparator_property_value_option.if_prev_state"></option><option value="property" data-i18n="trigger-state.label.comparator_property_value_option.if_property"></option></select> <input type="text" class="comparator-property-value" disabled="disabled"></div><div class="editable-list-row"><!-- Type --> <select type="text" class="comparator-type" style="width:140px" disabled="disabled"><option value="is" data-i18n="trigger-state.label.comparator_option.is"></option><option value="is_not" data-i18n="trigger-state.label.comparator_option.is_not"></option><option value=">" data-i18n="trigger-state.label.comparator_option.greater_than"></option><option value=">=" data-i18n="trigger-state.label.comparator_option.greater_than_or_equal_to"></option><option value="<" data-i18n="trigger-state.label.comparator_option.less_than"></option><option value="<=" data-i18n="trigger-state.label.comparator_option.less_than_or_equal_to"></option><option value="includes" data-i18n="trigger-state.label.comparator_option.includes"></option><option value="does_not_include" data-i18n="trigger-state.label.comparator_option.does_not_include"></option></select> <input type="text" class="comparator-value" style="width:62%"></div></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-update-config"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-update-config.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-update-config.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-entityConfig" data-i18n="ha-update-config.label.entity_config"></label> <input type="text" id="node-input-entityConfig"></div><div class="form-row"><ol id="custom-outputs"></ol></div></script>
<script type="text/html" data-template-name="ha-wait-until"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-wait-until.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-wait-until.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><div id="entity-list"></div></div><div class="form-row"><label for="node-input-property" data-i18n="ha-wait-until.label.wait_until"></label> <input type="text" id="node-input-property" data-i18n="[placeholder]ha-wait-until.placeholder.property"></div><div class="form-row"><label></label> <div class="ha-multi-item-row"><select id="node-input-comparator"><option value="is" data-i18n="ha-wait-until.label.comparator_option.is"></option><option value="is_not" data-i18n="ha-wait-until.label.comparator_option.is_not"></option><option value="lt" data-i18n="ha-wait-until.label.comparator_option.less_than"></option><option value="lte" data-i18n="ha-wait-until.label.comparator_option.less_than_or_equal_to"></option><option value="gt" data-i18n="ha-wait-until.label.comparator_option.greater_than"></option><option value="gte" data-i18n="ha-wait-until.label.comparator_option.greater_than_or_equal_to"></option><option value="includes" data-i18n="ha-wait-until.label.comparator_option.includes"></option><option value="does_not_include" data-i18n="ha-wait-until.label.comparator_option.does_not_include"></option><option value="jsonata" data-i18n="ha-wait-until.label.comparator_option.jsonata"></option></select> <input id="node-input-valueType" type="hidden"> <input id="node-input-value" type="text" data-i18n="[placeholder]ha-wait-until.placeholder.value"></div></div><div class="form-row"><label for="node-input-timeout" data-i18n="ha-wait-until.label.timeout"></label> <div class="ha-multi-item-row"><input type="text" id="node-input-timeout"> <input type="hidden" id="node-input-timeoutType"> <select id="node-input-timeoutUnits"><option value="milliseconds" data-i18n="ha-wait-until.label.timeout_units_option.milliseconds"></option><option value="seconds" data-i18n="ha-wait-until.label.timeout_units_option.seconds"></option><option value="minutes" data-i18n="ha-wait-until.label.timeout_units_option.minutes"></option><option value="hours" data-i18n="ha-wait-until.label.timeout_units_option.hours"></option><option value="days" data-i18n="ha-wait-until.label.timeout_units_option.days"></option></select></div></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row exact-only checkbox-option"><input type="checkbox" id="node-input-checkCurrentState" checked="checked"> <label for="node-input-checkCurrentState" data-i18n="ha-wait-until.label.check_current_state"></label></div><div class="form-row checkbox-option"><input type="checkbox" id="node-input-blockInputOverrides"> <label for="node-input-blockInputOverrides" data-i18n="ha-wait-until.label.block_input_overrides"></label></div></script>
<script type="text/html" data-template-name="ha-webhook"><input type="hidden" id="node-input-version"> <input type="hidden" id="node-input-outputs"><div class="form-row"><label for="node-input-name" data-i18n="ha-webhook.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-webhook.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><label for="node-input-webhookId" data-i18n="ha-webhook.label.id"></label> <div style="display:inline-flex;width:70%"><input type="text" id="node-input-webhookId" style="flex-grow:1"> <a id="copyId" class="editor-button" style="margin-left:10px"><i class="fa fa-copy"></i> </a><a id="refresh" class="editor-button" style="margin-left:10px"><i class="fa fa-refresh"></i></a></div></div><div class="form-row"><p data-i18n="ha-webhook.label.allowed_methods"></p><ul class="ha-ignore-state"><li><input type="checkbox" id="node-input-method_post"> <label for="node-input-method_post" data-i18n="ha-webhook.label.post"></label></li><li><input type="checkbox" id="node-input-method_put"> <label for="node-input-method_put" data-i18n="ha-webhook.label.put"></label></li><li><input type="checkbox" id="node-input-method_get"> <label for="node-input-method_get" data-i18n="ha-webhook.label.get"></label></li><li><input type="checkbox" id="node-input-method_head"> <label for="node-input-method_head" data-i18n="ha-webhook.label.head"></label></li></ul></div><div class="form-row"><ol id="custom-outputs"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>
<script type="text/html" data-template-name="ha-zone"><input type="hidden" id="node-input-version"><div class="form-row"><label for="node-input-name" data-i18n="ha-zone.label.name"></label> <input type="text" id="node-input-name"></div><div class="form-row"><label for="node-input-server" data-i18n="ha-zone.label.server"></label> <input type="text" id="node-input-server"></div><div class="form-row"><ol id="entities"></ol></div><div class="form-row"><label for="node-input-event" data-i18n="ha-zone.label.event"></label> <select id="node-input-event"><option value="enter" data-i18n="ha-zone.label.option.enter"></option><option value="leave" data-i18n="ha-zone.label.option.leave"></option><option value="enter_leave" data-i18n="ha-zone.label.option.enter_or_leave"></option></select></div><div class="form-row"><ol id="zones"></ol></div><div class="form-row" id="exposed-as-row"><label for="node-input-exposeAsEntityConfig" data-i18n="ha-tag.label.expose_as"></label> <input type="text" id="node-input-exposeAsEntityConfig"></div></script>