node-red-contrib-fritzapi
Version:
Home automation node for Fritz!Box, Fritz!DECT and FRITZ!Powerline devices.
551 lines (497 loc) • 18.6 kB
HTML
<script type="text/javascript">
RED.nodes.registerType("fritz-api", {
category: "config",
defaults: {
name: {
value: "",
required: false
},
host: {
value: "http://fritz.box",
required: true
},
strictSSL: {
value: true,
required: true
}
},
credentials: {
username: {
type: "text"
},
password: {
type: "password"
}
},
label: function () {
return this.name || "FRITZ!Box";
}
});
</script>
<script type="text/x-red" data-template-name="fritz-api">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name"/>
</div>
<div class="form-row">
<label for="node-config-input-host"><i class="fa fa-globe"></i> Host</label>
<input type="text" id="node-config-input-host" style="width: 70%;" />
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-config-input-strictSSL" placeholder="" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-config-input-strictSSL" style="width: 70%;">Check SSL certificate?</label>
</div>
<div class="form-row">
<label for="node-config-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-config-input-username" />
</div>
<div class="form-row">
<label for="node-config-input-password"><i class="fa fa-key"></i> Password</label>
<input type="password" id="node-config-input-password" />
</div>
</script>
<script type="text/x-red" data-help-name="fritz-api">
<p>FRITZ!Box connection information</p>
<h3>Settings</h3>
<dl class="message-properties">
<dt>Host
<span class="property-type">string</span>
</dt>
<dd>Host name or IP (with http://), defaults to <code>fritz.box</code>.</dd>
<dt class="optional">Username
<span class="property-type"string</span>
</dt>
<dd>User name. Leave empty if the FRITZ!Box only requires a password to log in.</dd>
<dt>Password
<span class="property-type"string</span>
</dt>
<dd>Admin or user password.</dd>
</dl>
</script>
<script type="text/javascript">
RED.nodes.registerType( "fritz-thermostat", {
category: "advanced",
paletteLabel: "thermostat",
color: "#2E90DD",
defaults: {
connection: {
type: "fritz-api",
required: true
},
name: {
value: "",
required: false
},
action: {
required: false
},
},
inputs: 1,
outputs: 1,
icon: "thermostat.png",
label: function () {
return this.name || "thermostat";
},
});
</script>
<script type="text/x-red" data-template-name="fritz-thermostat">
<div class="form-row">
<label for="node-input-connection"><i class="fa fa-globe"></i> Connection</label>
<input type="text" id="node-input-connection">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" />
</div>
<div class="form-row">
<label for="node-input-action"><i class="fa fa-thermometer-half"></i> Action</label>
<select id="node-input-action" id="node-input-action">
<option></option>
<option value="getTemperature">Get current temperature</option>
<option value="getTempTarget">Get target temperature</option>
<option value="setTempTarget">Set target temperature</option>
<option value="adjustTempTarget">Adjust target temperature</option>
<option value="getTempComfort">Get day temperature</option>
<option value="setTempComfort">Adjust the temperature to day level</option>
<option value="getTempNight">Get night temperature</option>
<option value="setTempNight">Adjust the temperature to night level</option>
<option value="setHkrBoost">Set boost mode for the given number of minutes</option>
<option value="setHkrWindowOpen">Set "Window open" mode for the given number of minutes</option>
<option value="getBatteryCharge">Get battery charge</option>
<option value="getWindowOpen">Get window open</option>
<option value="getOSVersion">Get the FritzOS version</option>
<option value="getDeviceList">Get device list</option>
<!-- <option value="getDeviceListFiltered">Get device list with filter criteria applied</option> -->
<option value="getDevice">Get device</option>
<option value="getPresence">Get presence</option>
<option value="getTemplateList">Get template list</option>
<option value="applyTemplate">Apply template</option>
<option value="getThermostatList">Get list of thermostats</option>
<option value="getBasicDeviceStats">Get basic device stats as XML</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="fritz-thermostat">
<p>A DECT thermostat controlled via a FRITZ!Box.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>ain
<span class="property-type">string</span>
</dt>
<dd> Device identification (AIN). If both <code>ain</code> and <code>topic</code> are provided, <code>ain</code> has precedence.</dd>
<dt>topic
<span class="property-type">string</span>
</dt>
<dd> Device identification (AIN). If both <code>ain</code> and <code>topic</code> are provided, <code>ain</code> has precedence.</dd>
<dt class="optional">action
<span class="property-type">string</span>
</dt>
<dd> Overwrite action to execute.</dd>
<dt class="optional">payload
<span class="property-type">number | any</span>
</dt>
<dd>Target or adjustment temperature, time offset in minutes, or anything for lookup actions.</dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>The requested or new temperature in degrees Celsius.</dd>
</dl>
</script>
<script type="text/javascript">
RED.nodes.registerType( "fritz-outlet", {
category: "advanced",
paletteLabel: "outlet",
color: "#2E90DD",
defaults: {
connection: {
type: "fritz-api",
required: true
},
name: {
value: "",
required: false
},
action: {
required: false
},
},
inputs: 1,
outputs: 1,
icon: "power.png",
label: function () {
return this.name || "outlet";
},
});
</script>
<script type="text/x-red" data-template-name="fritz-outlet">
<div class="form-row">
<label for="node-input-connection"><i class="fa fa-globe"></i> Connection</label>
<input type="text" id="node-input-connection">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" />
</div>
<div class="form-row">
<label for="node-input-action"><i class="fa fa-power-off"></i> Action</label>
<select id="node-input-action" id="node-input-action">
<option></option>
<option value="getSwitchState">Get state</option>
<option value="setSwitchState">Set state</option>
<option value="setSwitchToggle">Toggle</option>
<option value="getSwitchPower">Get power</option>
<option value="getSwitchEnergy">Get energy</option>
<option value="getSwitchPresence">Get presence status</option>
<option value="getTemperature">Get temperature</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="fritz-outlet">
<p>A DECT outlet controlled via a FRITZ!Box.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>ain
<span class="property-type">string</span>
</dt>
<dd> Device identification (AIN). If both <code>ain</code> and <code>topic</code> are provided, <code>ain</code> has precedence.</dd>
<dt>topic
<span class="property-type">string</span>
</dt>
<dd> Device identification (AIN). If both <code>ain</code> and <code>topic</code> are provided, <code>ain</code> has precedence.</dd>
<dt class="optional">action
<span class="property-type">string</span>
</dt>
<dd> Overwrite action to execute.</dd>
<dt class="optional">payload
<span class="property-type">number | any</span>
</dt>
<dd><code>true</code> or <code>false</code> for <code>SetSwitchState</code>, or anything for lookup actions.</dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">boolean | number</span></dt>
<dd>The outlet switch state (boolean), energy or power (number), or presence (boolean).</dd>
</dl>
</script>
<script type="text/javascript">
RED.nodes.registerType( "fritz-bulb", {
category: "advanced",
paletteLabel: "bulb",
color: "#2E90DD",
defaults: {
connection: {
type: "fritz-api",
required: true
},
name: {
value: "",
required: false
},
action: {
required: false
},
},
inputs: 1,
outputs: 1,
icon: "power.png",
label: function () {
return this.name || "bulb";
},
});
</script>
<script type="text/x-red" data-template-name="fritz-bulb">
<div class="form-row">
<label for="node-input-connection"><i class="fa fa-globe"></i> Connection</label>
<input type="text" id="node-input-connection">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" />
</div>
<div class="form-row">
<label for="node-input-action"><i class="fa fa-power-off"></i> Action</label>
<select id="node-input-action" id="node-input-action">
<option></option>
<option value="getDevice">Get device state</option>
<option value="getBulbList">Get bulbs list</option>
<option value="getDimmableBulbList">Get dimmable bulbs list</option>
<option value="getColorBulbList">Get colored bulbs list</option>
<option value="setSimpleOnOff">Set simple on/off</option>
<option value="setLevel">Set dimm level</option>
<option value="setLevelPercentage">Set dimm level percentage</option>
<option value="setColor">Set color</option>
<option value="setColorTemperature">Set color temperature</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="fritz-bulb">
<p>A DECT bulb controlled via a FRITZ!Box.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>ain
<span class="property-type">string</span>
</dt>
<dd> Device identification (AIN). If both <code>ain</code> and <code>topic</code> are provided, <code>ain</code> has precedence.</dd>
<dt>topic
<span class="property-type">string</span>
</dt>
<dd> Device identification (AIN). If both <code>ain</code> and <code>topic</code> are provided, <code>ain</code> has precedence.</dd>
<dt class="optional">action
<span class="property-type">string</span>
</dt>
<dd> Overwrite action to execute.</dd>
<dt class="optional">payload
<span class="property-type">string | number | any</span>
</dt>
<dd>None for <code>get*</code>-actions, for <code>set*</code>-actions see below for per-action details.</dd>
</dl>
<h3>Payloads</h3>
<dl class="message-properties">
<dt>setSimpleOnOff
<span class="property-type">action</span>
</dt>
<dd>Payload is <code>true</code> or <code>false</code></dd>
<dt>setLevel
<span class="property-type">action</span>
</dt>
<dd>Payload is <code>0 - 255</code></dd>
<dt>setLevelPercentage
<span class="property-type">action</span>
</dt>
<dd>Payload is <code>0 - 100</code></dd>
<dt>setColor
<span class="property-type">action</span>
</dt>
<dd><ul><li><code>payload.color</code> from a list of:
<code>red</code>, <code>orange</code>, <code>yellow</code>, <code>lime</code>, <code>green</code>, <code>turquoise</code>, <code>cyan</code>, <code>lightblue</code>, <code>blue</code> (default), <code>purple</code>, <code>magenta</code>, and <code>pink</code></li>
<li><code>payload.saturation</code> from a list of:
<code>0</code>, <code>1</code>, and <code>2</code> (default)</li>
<li><code>payload.duration</code> transition duration in ms. Default is 200.</li>
</ul></dd>
<dt>setColorTemperature
<span class="property-type">action</span>
</dt>
<dd><ul><li><code>payload.color</code> from a list of:
<code>2700</code>, <code>3000</code>, <code>3400</code>, <code>3800</code>, <code>4200</code>, <code>4700</code> (default), <code>5300</code>, <code>5900</code>, and <code>6500</code>. Other values are adjusted by fritzapi to one of the above values.</li>
<li><code>payload.duration</code> transition duration in ms. Default is 200.</li>
</ul></dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">any</span></dt>
<dd>The bulb list content, device state, or reply from the set method.</dd>
</dl>
</script>
<script type="text/javascript">
RED.nodes.registerType( "fritz-blind", {
category: "advanced",
paletteLabel: "blind",
color: "#2E90DD",
defaults: {
connection: {
type: "fritz-api",
required: true
},
name: {
value: "",
required: false
},
action: {
required: false
},
},
inputs: 1,
outputs: 1,
icon: "blind.png",
label: function () {
return this.name || "blind";
},
});
</script>
<script type="text/x-red" data-template-name="fritz-blind">
<div class="form-row">
<label for="node-input-connection"><i class="fa fa-globe"></i> Connection</label>
<input type="text" id="node-input-connection">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" />
</div>
<div class="form-row">
<label for="node-input-action"><i class="fa fa-power-off"></i> Action</label>
<select id="node-input-action" id="node-input-action">
<option></option>
<option value="getDevice">Get device state</option>
<option value="setBlind">Set simple open/close/stop</option>
<option value="setLevel">Set blind level</option>
<option value="setLevelPercentage">Set blind level percentage</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="fritz-blind">
<p>A DECT blind controlled via a FRITZ!Box.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>ain
<span class="property-type">string</span>
</dt>
<dd> Device identification (AIN). If both <code>ain</code> and <code>topic</code> are provided, <code>ain</code> has precedence.</dd>
<dt>topic
<span class="property-type">string</span>
</dt>
<dd> Device identification (AIN). If both <code>ain</code> and <code>topic</code> are provided, <code>ain</code> has precedence.</dd>
<dt class="optional">action
<span class="property-type">string</span>
</dt>
<dd> Overwrite action to execute.</dd>
<dt class="optional">payload
<span class="property-type">string | number | any</span>
</dt>
<dd>None for <code>get*</code>-actions, for <code>set*</code>-actions see below for per-action details.</dd>
</dl>
<h3>Payloads</h3>
<dl class="message-properties">
<dt>setBlind
<span class="property-type">action</span>
</dt>
<dd>Payload is <code>open</code> <code>close</code> or <code>stop</code></dd>
<dt>setLevel
<span class="property-type">action</span>
</dt>
<dd>Payload is <code>0 - 255</code></dd>
<dt>setLevelPercentage
<span class="property-type">action</span>
</dt>
<dd>Payload is <code>0 - 100</code></dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">any</span></dt>
<dd>The blind list content, device state, or reply from the set method.</dd>
</dl>
</script>
<!-- script type="text/javascript">
RED.nodes.registerType( "fritz-guestwifi", {
category: "advanced",
paletteLabel: "guest wifi",
color: "#2E90DD",
defaults: {
connection: {
type: "fritz-api",
required: true
},
name: {
value: "",
required: false
},
action: {
required: false
},
},
inputs: 1,
outputs: 1,
icon: "wifi.png",
label: function () {
return this.name || "guest wifi";
},
});
</script>
<script type="text/x-red" data-template-name="fritz-guestwifi">
<div class="form-row">
<label for="node-input-connection"><i class="fa fa-globe"></i> Connection</label>
<input type="text" id="node-input-connection">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" />
</div>
<div class="form-row">
<label for="node-input-action"><i class="fa fa-wifi"></i> Action</label>
<select id="node-input-action" id="node-input-action">
<option></option>
<option value="getGuestWlan">Get guest Wifi status</option>
<option value="setGuestWlan">Set guest Wifi status</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="fritz-guestwifi">
<p>Enable / disable guest Wifi of the FRITZ!Box.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">action
<span class="property-type">string</span>
</dt>
<dd> Overwrite action to execute.</dd>
<dt class="optional">payload
<span class="property-type">boolean</span>
</dt>
<dd><code>true</code> or <code>false</code> to enable / disable guest Wifi, or anything for status lookup.</dd>
</dl>
<h3>Output</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">boolean</span></dt>
<dd>Whether guest Wifi is enabled</dd>
</dl>
</script -->