Sending/changing a text via node red to a widget

Hi @all out there!

I am using node red to make my rules. As I haven’t yet found how to do so in OH (different story…) I want to stick to this.

What I want to do:
Prepare a message “on the fly” (done)
Send it to an html page on my Raspberry (done)
Show html-page in a widget (done)
Update widget when the message changes (open)

So the “only” thing to do is a refresh on the widget/page/dashboard after the message changed. I saw that I can do an update every second/minute. But then the page will permanently flickr, although there is no new message.

I would also change a Text in a widget directly if pssible. Using an html file was just the first idea…

And: Searching the web didn’t give me an answer. But it seemed to me, that there are others also searching to do something like this.

Thanks fro reading and have a good time!

Dirk

Is there some reason you don’t post the message to a simple String Item, maybe it’s long?

No, but.

Sorry: OH2, raspberry 4, Noder Red 1.2.6.

Up to now I am not able to set up a string item in openHab so that I can trigger it from node red. Up to now, maybe that is my fault…, I can only setup items in OH2 via paperUI. Tried to do it via .items and .things file. But they didn’t show up in paperUI nor in openHab Panel. Have you done this? Then I would like this method and I would try to do so. Seems much easier…

You can create Items in PaperUI (Configuration >Items > +)
You can create Items from xxx.items files.
You don’t create Items from xxx.things files.
Just create a String type Item, not linked to anything.
Unlinked Items do not show up in PaperUI “control” section, because that’s just an Admin tool for channels related Items.
Who cares, you’re using a proper user-facing UI inHABpanel?

I don’t use Node Red, but surely you can just post a string update to an OH Item?

In my items file: /etc/openhab2/items/messages.items is one line:
String counterMessage;

If I set up a dummy widget in HABPanel (a many thing work already there…) the item is not available as an item.
Is there a need to restart openhab after changing items file?

Changing an item from node red have I alreay done. But via things items in HABPanel as an openHab Item…

No, but you can look in your openhab.log to see if the file was loaded successfully after you edited it.
Lines in xxx.items files do not end with ;

Droped the ;, looks better in VS code now… To much c#…

In the log I found an error:
2021-04-07 13:35:28.589 [WARN ] [me.core.service.AbstractWatchService] - Error while opening file during update: /etc/openhab2/items/messages.items

Seems as if there are permissions missing. As I am not so familar with my raspbian and already broke my installation some times: Can you tell me who the user will be to open the file? openhab? And how to set the necessary permissions? And at the end: I think I have to do a backuop upfront…

One line “ls -l” in my openahb2 folder:
drwxr-xr-x 3 openhab openhab 4096 Aug 2 2020 icons

Sometimes you get a WARN from the editor, which may save a new file in two passes. Then you get a second message afterwards.

Why don’t you use PaperUI and avoid the issue? It’s click + and fill in a form.

Sorry, I feel so cnfused. What I ususally do: Get a binding, Search for things, use them. How to setup an Item “of the shelf”? If I use "Search for things a binding is requested…

Maybe you can just send me a link t oa tutorial, so you don’t have to waste your time to much…

You’re not interested in Things for a standalone Item, none are involved.

Click top left for a drop down menu.
Choose Configuration.
Choose Items. (may take a second to make a long list)
Click big blue +
Fill in form. Must have name and type. If in doubt, leave it out.
Save, look for pop-up message.

OMG: had my setting for “Item Linking” in “Simple Mode”. So Item didn’t show up in the navigation. Now I have got a new Item!

Thank you so much. Now lets see how it works with node red…

1 Like

Oh, I always forget the Simple Mode abomination, sorry. (Done away with in OH3, it’s not helpful)

Will be the next step: OH3…

fyi:

It did the trick. As often: if you no how it’s s easy…

Thanks again for your help!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.