gersilex / informational-header

Displays customizable, interactive notification items after the dashboard name.
MIT License
2 stars 2 forks source link

Update of notification label not working #2

Open strizl opened 5 years ago

strizl commented 5 years ago

Hi!

First of all thanks for your great work and the widget!

I used it beside a lot of other things for displaying an appointment from my caldav binding. If an appointment takes place the next 24h, a notification with the text of the calendar entry should be displayed as informational header. For that I created a rule which changes the .label-name of the notification-item and activates it:

my rule: ...if an appointment takes place the next 24h... notification_kalender.label = "📅 " + kalName.state sendCommand(notification_kalender, ON) ...else... sendCommand(notification_kalender, OFF) ...

The interesting thing is, it's working, but it displays the text from last time. That means, if I had a calendar entry with "Biomüll" in the past, set it to off because it's gone now, and the next appointment e.g. "Restmüll" arrives in the upcoming 24h, it displays "Biomüll". Only when I refresh the Habpanel-Page manual, it display the correct text. Do you have any idea how I can change this?

Thanks a lot for your help! Kind regards, strizl

gersilex commented 5 years ago

Hey @strizl .

I wasn't aware that labels can be changed in the Rules DSL, thanks for pointing that out!

I just had a look into openHAB's event stream at /rest/events and it does not seem like openHAB or ESH are generating any events on that event stream if the labels are changed. HABPanel and thus my widget rely on the event stream and act upon updates. You can show the stream in your browser: http://openhab:8080/rest/events (you may need to change the hostname to fit yours).

Unfortunately, I cannot change this and have not enough programming expertise with openHAB or ESH.

If you are not interested in a static label, you could change the widget, so that it does not display the label, but instead the state of an item. You should change the Item to a Text item and change its value from within your rules.

I might give it a shot some time but I am too busy right now to add brand new features here. It would be awesome if you could give it a shot and even more awesome if you contribute your work back into this project.

If you have any questions, feel free to ask here. :)

strizl commented 5 years ago

Hi @gersilex

Thanks for your reply and the hint! Finally that was the solution. I have now a working informational header with various text.

I did the following changes:

What I not checked yet is the function when you press the notification. Maybe it works by entering e.g. OFF and creating a rule watching out for text "OFF"... I will try asap and give feedback!

Kind regards, strizl