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

ui_text doesn't works if there is no msg.payload #459

Closed
3 tasks
stephjj opened this issue Dec 17, 2018 · 2 comments
Closed
3 tasks

ui_text doesn't works if there is no msg.payload #459

stephjj opened this issue Dec 17, 2018 · 2 comments

Comments

@stephjj
Copy link

stephjj commented Dec 17, 2018

On a ui_text node, if the incoming message don't have a msg.payload property, there is an error:
TypeError: Cannot read property 'toString' of undefined
And the value is not updated.

My workaround is to copy the message property (ex. msg.humidity) to msg.payload. Event if the node doesn't use payload but msg.humidity in the Value format configuration property.

  • Node-RED-Dashboard version: 2.12.2
  • Node-RED version: 0.19.5
  • On blueMix

BTW, it could be useful that if the incoming message don't have the configured Value format, the display should not be erased.

@dceejay
Copy link
Member

dceejay commented Dec 17, 2018

when you say it doesn't have the property... is it actually not there ? or defined but blank ?

This simple test works for me...

[{"id":"2fe6cbc5.023d24","type":"ui_text","z":"68704546.3d0e0c","group":"8c6774a4.06e158","order":5,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":470,"y":40,"wires":[]},{"id":"edc9571c.ec2bf8","type":"inject","z":"68704546.3d0e0c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"hide":false,"x":120,"y":40,"wires":[["2fe6cbc5.023d24"]]},{"id":"30a49bb6.f57d04","type":"inject","z":"68704546.3d0e0c","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"hide":false,"x":110,"y":80,"wires":[["3f857d5a.d30512"]]},{"id":"3f857d5a.d30512","type":"change","z":"68704546.3d0e0c","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":80,"wires":[["2fe6cbc5.023d24"]]},{"id":"ebc97482.ea2078","type":"inject","z":"68704546.3d0e0c","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"hide":false,"x":110,"y":120,"wires":[["e458ae1d.ac8b8"]]},{"id":"e458ae1d.ac8b8","type":"change","z":"68704546.3d0e0c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":120,"wires":[["2fe6cbc5.023d24"]]},{"id":"8c6774a4.06e158","type":"ui_group","z":"","name":"Default","tab":"3df105b2.37ac4a","disp":true,"width":"6","collapse":false},{"id":"3df105b2.37ac4a","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

(yes it does produce the error - so will be fixed)

@stephjj
Copy link
Author

stephjj commented Dec 17, 2018

Not there.
And ui_text configured to use another property
[{"id":"4ebacd29.a16c4c","type":"ui_text","z":"852c7287.f6dab8","group":"2577c5bf.2b8f0a","order":0,"width":0,"height":0,"name":"","label":"payload","format":"{{msg.payload}}","layout":"row-spread","x":920,"y":100,"wires":[]},{"id":"552408d3.d0733","type":"inject","z":"852c7287.f6dab8","name":"","topic":"payload","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":100,"wires":[["4ebacd29.a16c4c"]]},{"id":"8869df5.a10cda","type":"ui_text","z":"852c7287.f6dab8","group":"2577c5bf.2b8f0a","order":1,"width":0,"height":0,"name":"","label":"humidity","format":"{{msg.humidity}}","layout":"row-spread","x":920,"y":160,"wires":[]},{"id":"5d14fc87.ac1544","type":"inject","z":"852c7287.f6dab8","name":"","topic":"humidity","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":160,"wires":[["c2836428.8c411"]]},{"id":"c2836428.8c411","type":"change","z":"852c7287.f6dab8","name":"","rules":[{"t":"set","p":"humidity","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":160,"wires":[["8869df5.a10cda"]]},{"id":"d2ff7f27.08ed6","type":"ui_text","z":"852c7287.f6dab8","group":"2577c5bf.2b8f0a","order":1,"width":0,"height":0,"name":"","label":"humidity+payload","format":"{{msg.humidity}}","layout":"row-spread","x":950,"y":240,"wires":[]},{"id":"a5215508.0db65","type":"inject","z":"852c7287.f6dab8","name":"","topic":"humidity","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":240,"wires":[["4424200f.765bd8"]]},{"id":"4424200f.765bd8","type":"change","z":"852c7287.f6dab8","name":"","rules":[{"t":"set","p":"humidity","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":240,"wires":[["d2ff7f27.08ed6"]]},{"id":"2577c5bf.2b8f0a","type":"ui_group","z":"","name":"Default","tab":"c7595ff7.e99d","disp":true,"width":"6","collapse":false},{"id":"c7595ff7.e99d","type":"ui_tab","z":"","name":"Main","icon":"dashboard"}]

I use Firefox, but I can check with a other browser

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

2 participants