Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 1
matrix:
node: [20, 22, 23, 24]
node: [18, 20, 22, 23, 24]

steps:
- uses: actions/checkout@v5
Expand Down
23 changes: 16 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: local
hooks:
- id: npm-test
name: Run npm test
entry: npm test
language: system
pass_filenames: false
files: ^(test|alexa)/.*$
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Signed-off-by: Martin Buchleitner <[email protected]>

* feat: use nodered http endpoint for alexa as option if nodered runs on port80

* include pr #108 -
* include pr #108 -

BREAKING CHANGE: API v1 conform implementation breaks detection of nodes - so there will be duplicates if you do not remove the previous ones!
```
Expand Down Expand Up @@ -422,7 +422,7 @@ BREAKING CHANGE: API v1 conform implementation breaks detection of nodes - so th
<a id="1.1.3"></a>
# [Fix detection of gen3 devices (1.1.3)](https://github.com/mabunixda/node-red-contrib-alexa-home/releases/tag/1.1.3) - 2019-09-02

Thanks to [@nepee](https://github.com/nepee) for the input to fix some json stuff within the detection process.
Thanks to [@nepee](https://github.com/nepee) for the input to fix some json stuff within the detection process.


[Changes][1.1.3]
Expand All @@ -431,9 +431,9 @@ Thanks to [@nepee](https://github.com/nepee) for the input to fix some json stuf
<a id="1.1.2"></a>
# [Codecleanup + Registration fix for gen3 devices (1.1.2)](https://github.com/mabunixda/node-red-contrib-alexa-home/releases/tag/1.1.2) - 2019-08-29

Internal Code cleanup because of introduction of linting the Code... but
Internal Code cleanup because of introduction of linting the Code... but

Also take fix from [derSebbl](https://github.com/mabunixda/node-red-contrib-alexa-home/issues/16#issuecomment-526085758) to get Alexa Gen3 devices to work and hopefully fix [#16](https://github.com/mabunixda/node-red-contrib-alexa-home/issues/16)
Also take fix from [derSebbl](https://github.com/mabunixda/node-red-contrib-alexa-home/issues/16#issuecomment-526085758) to get Alexa Gen3 devices to work and hopefully fix [#16](https://github.com/mabunixda/node-red-contrib-alexa-home/issues/16)

The change of the port is not made per default, because i expect not everybody to have port 80 open and available. It might also cause permissions problems, because that port might not be used by a default linux user e.g.

Expand Down Expand Up @@ -476,7 +476,7 @@ Also a finding was that alexa does not support endless response bodies. To get a
<a id="1.0.3"></a>
# [fix ssdp location announcement (1.0.3)](https://github.com/mabunixda/node-red-contrib-alexa-home/releases/tag/1.0.3) - 2019-06-10

fix [#16](https://github.com/mabunixda/node-red-contrib-alexa-home/issues/16)
fix [#16](https://github.com/mabunixda/node-red-contrib-alexa-home/issues/16)

[Changes][1.0.3]

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
- [GitHub Repository](https://github.com/mabunixda/node-red-contrib-alexa-home)
- [Node-RED Community](https://discourse.nodered.org/)
- [Issue Tracker](https://github.com/mabunixda/node-red-contrib-alexa-home/issues)
# Test comment
20 changes: 20 additions & 0 deletions alexa/hue-api-v2-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ class HueApiV2Handler {
"Color light": "hue_bulb",
"Extended color light": "hue_bulb",
"Color temperature light": "white_and_color_ambiance_bulb",
"Window covering": "window_covering_device",
"Temperature sensor": "temperature_sensor",
};
return mapping[deviceType] || "sultan_bulb";
}
Expand All @@ -498,6 +500,8 @@ class HueApiV2Handler {
"Color light": "LCT015",
"Extended color light": "LCT015",
"Color temperature light": "LTW011",
"Window covering": "WC001",
"Temperature sensor": "TS001",
};
return mapping[deviceType] || "LTW011";
}
Expand All @@ -511,6 +515,8 @@ class HueApiV2Handler {
"Color light": "Hue color lamp",
"Extended color light": "Hue color lamp",
"Color temperature light": "Hue white ambiance lamp",
"Window covering": "Smart blinds",
"Temperature sensor": "Temperature sensor",
};
return mapping[deviceType] || "Hue white lamp";
}
Expand All @@ -534,6 +540,20 @@ class HueApiV2Handler {
);
}

/**
* Check if device is a window covering (blinds)
*/
isWindowCovering(deviceType) {
return deviceType === "Window covering";
}

/**
* Check if device is a temperature sensor
*/
isTemperatureSensor(deviceType) {
return deviceType === "Temperature sensor";
}

/**
* Handle room resource (placeholder for future implementation)
*/
Expand Down
123 changes: 123 additions & 0 deletions alexa/nodes/alexa-blinds.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<script type="text/javascript">
RED.nodes.registerType('alexa-blinds', {
category: 'alexa',
color: '#4B8BBA',
defaults: {
devicename: { value: '', required: true },
brightness: { value: '254' },
inputtrigger: { value: false }
},
inputs: 1,
outputs: 1,
icon: 'alexa-home.png',
label: function () {
return this.devicename || 'alexa blinds';
},
labelStyle: function () {
return this.devicename ? 'node_label_italic' : '';
},
oneditprepare: function () {
// Set up device name field
$('#node-input-devicename').focus();

// Set up brightness slider
$('#node-input-brightness').on('input', function () {
const value = $(this).val();
const percentage = Math.round((value / 254) * 100);
$('#brightness-display').text(percentage + '%');
});

// Initial brightness display
const initialBrightness = $('#node-input-brightness').val() || 254;
const initialPercentage = Math.round((initialBrightness / 254) * 100);
$('#brightness-display').text(initialPercentage + '%');
}
});
</script>

<script type="text/html" data-template-name="alexa-blinds">
<div class="form-row">
<label for="node-input-devicename"><i class="fa fa-tag"></i> Device Name</label>
<input type="text" id="node-input-devicename" placeholder="e.g., Living Room Blinds">
</div>

<div class="form-row">
<label for="node-input-brightness"><i class="fa fa-adjust"></i> Initial Position</label>
<input type="range" id="node-input-brightness" min="0" max="254" step="1" style="width: 70%;">
<span id="brightness-display" style="margin-left: 10px; font-weight: bold;">100%</span>
</div>

<div class="form-row">
<label for="node-input-inputtrigger" style="width: auto;">
<input type="checkbox" id="node-input-inputtrigger" style="display: inline-block; width: auto; vertical-align: top;">
Only respond to Alexa commands (ignore input messages)
</label>
</div>
</script>

<script type="text/html" data-help-name="alexa-blinds">
<p>A Node-RED node for controlling window coverings and blinds through Amazon Alexa.</p>

<h3>Configuration</h3>
<dl class="message-properties">
<dt>Device Name <span class="property-type">string</span></dt>
<dd>The name Alexa will use to identify your blinds (e.g., "Living Room Blinds")</dd>

<dt>Initial Position <span class="property-type">number</span></dt>
<dd>The initial position of the blinds (0-100%, where 100% = fully open)</dd>

<dt>Input Trigger <span class="property-type">boolean</span></dt>
<dd>When checked, the node only responds to Alexa commands and ignores input messages unless they have <code>msg.output = true</code></dd>
</dl>

<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload.position <span class="property-type">number</span></dt>
<dd>Set blinds position (0-100, where 0=closed, 100=fully open)</dd>

<dt>payload.bri <span class="property-type">number</span></dt>
<dd>Set position using brightness value (0-254, automatically converted to percentage)</dd>

<dt>payload.on <span class="property-type">boolean</span></dt>
<dd>Open (true) or close (false) the blinds completely</dd>

<dt>output <span class="property-type">boolean</span></dt>
<dd>When input trigger is enabled, set to true to force output</dd>
</dl>

<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload.position <span class="property-type">number</span></dt>
<dd>Current blinds position (0-100%)</dd>

<dt>payload.bri <span class="property-type">number</span></dt>
<dd>Current brightness value (0-254)</dd>

<dt>payload.on <span class="property-type">boolean</span></dt>
<dd>Always true (blinds are always "available")</dd>

<dt>payload.command <span class="property-type">string</span></dt>
<dd>The type of command: "position" or "switch"</dd>

<dt>device_name <span class="property-type">string</span></dt>
<dd>The name of the device</dd>

<dt>device_type <span class="property-type">string</span></dt>
<dd>Always "Window covering"</dd>
</dl>

<h3>Voice Commands</h3>
<p>Example voice commands for Alexa:</p>
<ul>
<li>"Alexa, set [device name] to 75 percent"</li>
<li>"Alexa, open the [device name]"</li>
<li>"Alexa, close the [device name]"</li>
<li>"Alexa, set [device name] to 50 percent open"</li>
</ul>

<h3>Details</h3>
<p>This node provides window covering control through Amazon Alexa using the Philips Hue bridge emulation.
Blinds position is controlled using a percentage scale where 0% means fully closed and 100% means fully open.</p>

<p>The node maps Alexa brightness commands to position percentages, allowing natural voice control of blind positions.</p>
</script>
Loading
Loading