Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Enter On / Off Payload by flow or global variable #30

Open
nicedevil007 opened this issue Apr 13, 2020 · 3 comments
Open

Comments

@nicedevil007
Copy link

Hey biddster,

first I want to thank you for all your work!

I'm on a testrun with your nodes right now and I'm wondering if you would be able to allow as to enter a flow or global variable as the on or off payload.

Why?

We can set a slider for brightness of a lamp or the temperature of a room on the node-red dashboard.
This chosen value will be saved to a flow variable and if I input this as the On or Off payload in your node it would be possible to get semi automatic local alexa node for newer devices (echo dot 3 f.e.).

Thank you in advance!

@biddster
Copy link
Owner

It's a good idea, I'll add it to the list. Fancy submitting a PR?

@vepman
Copy link

vepman commented Oct 26, 2020

Hey biddster,

first I want to thank you for all your work!

I'm on a testrun with your nodes right now and I'm wondering if you would be able to allow as to enter a flow or global variable as the on or off payload.

Why?

We can set a slider for brightness of a lamp or the temperature of a room on the node-red dashboard.
This chosen value will be saved to a flow variable and if I input this as the On or Off payload in your node it would be possible to get semi automatic local alexa node for newer devices (echo dot 3 f.e.).

Thank you in advance!

Good idea

@kravarka
Copy link

kravarka commented Sep 22, 2023

Hi,

I am using the node for couple of days, and found that missing such a feature limits automation process a lot. For example, if I turn on manually my lamp, the node does not report that change in Alexa app.

So, it turns out that the code for an input that can change the internal status of the node is rather simple.

I am not a close friend to pull requests, so I am giving my code modifications here, hoping that someone will update them in the main branch or at least use them to modify their local version of the node.

The first change is in index.html, inputs on line 55, has to become 1 from 0.

And the second change is index.js,

the following code has to be inserted at the end, right above the node.on('close', () => { line

node.on('input', function(msg) {
if (connection) {
if (msg.payload.toLowerCase() == "on") {
connection.binaryState = 1;
node.status({
fill: 'green',
shape: 'dot',
text: 'on',
});
}
if (msg.payload.toLowerCase() == "off") {
connection.binaryState = 0;
node.status({
fill: 'green',
shape: 'circle',
text: 'off',
});
}
}
});

With this modification the node will have input and will change its internal state according to the msg.payload.

Input payload should be on or off and the visual status of the module will change accordingly.

I hope this will help someone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants