Comments (12)
Thanks a lot Dave, i think i'll mantain my mod for now, btw will test like you explained... And congratulations your node is amazing!!
from node-red-contrib-tasmota.
Hi,
to use the single output mode you set in the configuration "1 Channel (or all merged)"
from node-red-contrib-tasmota.
Sorry for deleted messages i will describe better below...
I my tasmota i have this setup:
When I click in button 1 for exemple i got this at the tasmota console:
21:26:13.431 MQT: stat/tasmota_44D83C/RESULT = {"Button1":{"Action":"SINGLE"}}
When I click in button 2 for exemple i got this at the tasmota console:
21:27:16.369 MQT: stat/tasmota_44D83C/RESULT = {"Button2":{"Action":"SINGLE"}}
At the node i have three test setups, the first one is setup with a one channel or merge:
This way work with all channels merged, like espected for this setup.
The second one i setup with three channels:
Works fine too, each out channel represent a button, and it works fine.
So I have the thirdy scenary.. where i need only one node and get only the button 3 (single, double and hold status) i'm not know how configure correctly because i got offline status when i try especify the topic/button3 for exemple:
I got offline
Sorry i know it probably is a noob configure question, but if your can help me i'm so glad...
from node-red-contrib-tasmota.
To resume the doubt is how to setup 1 channel to got the click events of a button3 for exemple....
from node-red-contrib-tasmota.
i made this exemple what i’m thinking
for example if in channels field set 1 and put “3” in channel number the node listen only button3 events….
Ofcourse i made only a change in the html file to exemplify what i’m thinking… i don’t know if have some way to do this..
from node-red-contrib-tasmota.
I don't know if have the some way most easyer than this, but i make some changes em button.html, button.js and base_tasmota.js to implement this function, now fits in my necessity 100%...
from node-red-contrib-tasmota.
If you need only button 3 events you should setup as you have done in your second image:
Just remove the two wires from output1 and output2 and leave only the wire connected to output3,
your debug node will now receive only the events from button3
from node-red-contrib-tasmota.
I don't know if you have interrest but i made some changes to i select what channel i want to listen when configured a single channel.. not is be amazing code but works .
in base_tasmota:
I add channelNumberId at const TASMOTA_DEFAULTS:
const TASMOTA_DEFAULTS = {
// basic
broker: '', // mandatory
device: '', // mandatory
name: '',
outputs: 1,
channelNumberId: '',
uidisabler: false,
// advanced
fullTopic: '%prefix%/%topic%/',
cmndPrefix: 'cmnd',
statPrefix: 'stat',
telePrefix: 'tele',
qos: 1,
retain: false
}
in button.html i add a field below combobox of channels:
div class="form-row">
label for="node-input-outputs"> Channel Number
input type="text" id="node-input-channelNumberId" placeholder="put 0(zero) to merge all channels">
/div>
and add channelNumberId: { value: 1}, in defaults of the script session:
defaults: {
// common basic
broker: { type: "tasmota-mqtt-broker", required: true },
device: { value: "", required: true },
name: { value: "" },
outputs: { value: 1 },
channelNumberId: { value: 1},
uidisabler: { value: false },
// common advanced
fullTopic: { value: "" },
cmndPrefix: { value: "" },
statPrefix: { value: "" },
telePrefix: { value: "" },
qos: { value: 1 },
retain: { value: false }
// node specific
},
in button.js i change this:
// update status icon and label
this.setNodeStatus('green', `${action} (${channel})`)
// build and send the new string message for topic 'buttonX'
const msg = { topic: 'button' + channel, payload: action }
if (this.config.outputs === 1 || this.config.outputs === '1') {
// everything to the same (single) output
this.send(msg)
} else {
// or send to the correct output
const msgList = Array(this.config.outputs).fill(null)
msgList[channel - 1] = msg
this.send(msgList)
}
to this:
// update status icon and label
if(parseInt(this.config.channelNumberId, 10) === 0 || parseInt(this.config.channelNumberId, 10) === channel){
this.setNodeStatus('green', `${action} (${channel})`)
}
// build and send the new string message for topic 'buttonX'
const msg = { topic: 'button' + channel, payload: action }
if (this.config.outputs === 1 || this.config.outputs === '1') {
// everything to the same (single) output
if(parseInt(this.config.channelNumberId, 10) === 0 || parseInt(this.config.channelNumberId, 10) === channel){
this.send(msg)
}
} else {
// or send to the correct output
const msgList = Array(this.config.outputs).fill(null)
msgList[channel - 1] = msg
this.send(msgList)
}
Works great maybe need some improvements but already works perctly to my scenario....
from node-red-contrib-tasmota.
here is my changed files
from node-red-contrib-tasmota.
before looking at the implementation details:
I really don't understand why you need those changes, I already explained how to make what you need (without changing the code), and a new config option seems to me overkill and can confuse other users.
from node-red-contrib-tasmota.
For example i have a tasmota with 16 buttons and will use one node in one flow where i will use the button16 only…. I don’t like to use one node with 16outputs and use only the 16th with 15 empty output….
I know this is a so much personal, but i think more users will like it.
By the way, sorry for any inconvenance…
from node-red-contrib-tasmota.
Ah, 16 buttons, you did non say that before, your use case start to make sense now :-)
Btw, still think the new option is a bit overkill, and then we should also implement a more complex selection, fe: someone may want to just use button 4 and 12... that start to become more complex.
In this situation I suggest to use the Button node configured as "1 Channel (or all merged)" and then attach a standard nodered "switch" node, that you can configure with a filter like: msg.topic == "button16"
from node-red-contrib-tasmota.
Related Issues (20)
- migration / upgrade from previously working installation is overloading (?) MQTT HOT 9
- problems with node-red 2.0.5 HOT 13
- How to request updated value in Switch Node HOT 9
- Light node send wrong values when in json output mode HOT 10
- I am seeing this message quite a lot. HOT 2
- Injects for 2 channels relay HOT 2
- "Input messages are NOT forwarded to the output." Except they are. HOT 8
- "close timed out" error when performing full deploy or modifying broker node HOT 3
- Power "blink" option HOT 3
- Devices show "Offline" when referenced in multiple flows HOT 14
- Not receiving full MQTT message
- quiet tasmota nodes on flow deploy HOT 1
- Switch node sends a topic when multiple outputs are enabled HOT 3
- Multiple executions when triggered by hass entity HOT 2
- Nodes no longer report or forward device status in flows, instead show offline, BUT still control devices HOT 3
- switch node channels HOT 2
- tasmota sensor node with multi outputs gives warning with node-red version 3.1.0 (Sept. 2023) HOT 4
- Sensor node emits all topics HOT 5
- Error on Node-Red 3.1.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-red-contrib-tasmota.