Giter Club home page Giter Club logo

Comments (8)

codmpm avatar codmpm commented on August 17, 2024

Hey Max,

thank's for your testing. Sadly this seems to depent on io.Broker.
I've just updated my test environment and can connect to the miniserver without any problems.

21 May 08:15:22 - [info] [loxone-miniserver:640a19c6.12bc7] Miniserver connected (<hostname-of-miniserver>:80) using Token-Enc
21 May 08:15:22 - [info] [loxone-miniserver:640a19c6.12bc7] got structure file 2019-05-02 16:52:48
21 May 08:14:39 - [info] Node-RED version: v0.20.5
21 May 08:14:39 - [info] Node.js  version: v8.15.1
21 May 08:14:39 - [info] Linux 4.14.98-v7+ arm LE

It seems that io.Broker is expecting something in msg.payload and does not exist in node-red-contrib-loxone.

I will open up a thread on the io.Broker forums.
https://forum.iobroker.net/topic/22614/node-red-contrib-loxone-uncaught-exception - german

from node-red-contrib-loxone.

codmpm avatar codmpm commented on August 17, 2024

Hey again,

could you please empty your complete flows and try to install node-red-contrib-loxone again?
As discussed in the io.Broker-Forum this seems to be a problem dependant on an empty msg.payload in your flow.

If you can, please try to describe your setup as detailed as possible.

Cheers,
Patrik

from node-red-contrib-loxone.

maximaljan avatar maximaljan commented on August 17, 2024

Hey,

thanks. You are challenging me...
i will try the following:

  • disabling all flows
  • upgrade
    -check
    if still nok than i will try with empty all flows via renaming flows.json.

give me a coupple of minutes...

Greets
Jan

from node-red-contrib-loxone.

maximaljan avatar maximaljan commented on August 17, 2024

Got it and make sense, what they wrote in IOBroker forum.

So... it happens as soon as i bring the following in place and i do a restart.
The control in LoxoneConfig is a RadioButton Control (see screenshot of Unbenannt.jpg).

Unbenannt

Here is the flow...
[
{
"id": "ffa04f7b.b4713",
"type": "loxone-control-in",
"z": "a1893c5a.5a371",
"name": "Sender",
"miniserver": "cf239d7b.eb1fa",
"control": "120a9980-02ea-063f-ffffeee000a8003c",
"state": "120a9980-02ea-063e-ffffc268664af80e",
"x": 1990,
"y": 440,
"wires": [
[
"cb48e103.87156"
]
]
},
{
"id": "cb48e103.87156",
"type": "function",
"z": "a1893c5a.5a371",
"name": "",
"func": "msg.payload=msg.details.outputs[msg.payload];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 2150,
"y": 440,
"wires": [
[
"4d08061.6b982f8"
]
]
},
{
"id": "4d08061.6b982f8",
"type": "ioBroker out",
"z": "a1893c5a.5a371",
"name": "TuneIn-Station",
"topic": "alexa2.0.Echo-Devices.xxxx.Player.TuneIn-Station",
"ack": "false",
"autoCreate": "false",
"x": 2320,
"y": 440,
"wires": []
},
{
"id": "cf239d7b.eb1fa",
"type": "loxone-miniserver",
"z": 0,
"host": "loxone.xxxx.lan",
"port": "80",
"enctype": "0",
"active": true
}
]

So changeing ioBroker Out with debug nodes brings me an undfined on startup.
Unbenannt1

As soon as i change to an value of the radio button in loxone i got an fine payload inside.
Unbenannt2

And HURRAAA i got an undefined again as soon as i press "Alles Aus"
Unbenannt3

So now i reconnect IoBroker Out again. Changed to a Radio Button Value in Loxone everything is fine and "Alles Aus" is killing the instance because it got an undefined on the payload for the IoBroker Node.
I will catch this in the script in between and for me its fine.

I dont know if you can build something that brings an NULL instead of an undefined in case of RadioButton AllesAus function. As far as i got it this is than handled be recieving nodes as nothing and it will not kill the instance.

Thanks
Jan

from node-red-contrib-loxone.

maximaljan avatar maximaljan commented on August 17, 2024

Im actually see that it all happenson the little funtion where i like to pick the value. In case of AllesAus i got a 0 in msg.payload. In the function i try to read the array with the msg.payload as index.

THATS what i do wrong because in the array of outputs there is nothing with index 0 so i got the undefined.

I - with my basic knowleage changed into

if(msg.payload===0){
    msg.payload=1;
}
msg.payload=msg.details.outputs[msg.payload];
return msg;

And i will never get an undefined again...

So at the end Patrik it's your dessision if yout want to change someting inside. For example put the "Alles Aus" into the Array of Outputs - if this is possible.

Unbenannt4

Vielen Dank nochmal für den perfekten Support...
Gruss Jan

from node-red-contrib-loxone.

codmpm avatar codmpm commented on August 17, 2024

Hey Jan,

thank you for that detailed analysis of the situation. 👍

I think this issue has to be resolved on the io.Broker-side as it can happen anytime that a node delivers an undefined payload. This is what crashes io.Broker as it tries to "read" the value to pass it through it's event handler (correct me if I'm wrong).

The solution should be exactly where the Exception happens: https://github.com/ioBroker/ioBroker.node-red/blob/master/nodes/ioBroker.js#L282:
node.status({fill: 'green', shape: 'dot', text: msg.payload.toString() });
Not just call .toString on msg.payload but check first if msg.payload is not undefined in the first place. In detail they should check if toString is a valid method on the given data.

Or did I miss something? Should there some better solution to work with the radio buttons from Loxone?

Cheers and much thanks!

from node-red-contrib-loxone.

maximaljan avatar maximaljan commented on August 17, 2024

Hi Patrik,

of cause i also think i would help if the colleagues from iobroker first checking if it is an string before the try to convert. Good Idea.

Regarding the better solution for radio button. Hmm i dont know if it is worth to implement a different solution?
I think it could help to have the current selected id (as plain number) in one msg object (as it is today) and to have in another msg object the actual selected plain text in addition to the actual array object. In case of "Alles Aus" this plaintext object could be empty. It hopefully makes it more easy to pick the actual selected value for the user.

I my case i try to realise a predefined Music Channel switch. In case of Alexa to switch to the desired channel i need an text to forward to alexa. In another case (Squeezebox Server) i'm needing the selected id to switch to the desired channel. So for my usecases i need both (plain text and id).

Grüße
Jan

from node-red-contrib-loxone.

codmpm avatar codmpm commented on August 17, 2024

Hey Jan,

I think I understand what you try to achieve. Is the needed data present in your structure file? Only data given on the event in the websocket or while parsing the structure file can be parsed and returend.
You can find it here: http:///data/LoxAPP3.json

Documentation: https://www.loxone.com/dede/wp-content/uploads/sites/2/2018/10/1000_Structure-File.pdf

from node-red-contrib-loxone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.