After reboot, string values are empty

[EDIT voda]: I’ve changed the title of the thread. The previous title was “My opinion about OH4”, therefore several topics are mixed at the beginning

Hello guys,

Generally, I’m satisfied with Openhab. It was a little difficult to familiarise yourself with the system, but once you understood the principle you were able to build up a nice system. I started with OH 3.4.2 and have now upgraded to OH 4.0.2 with certain expectations.

Unfortunately, my expectations were disappointed. These are e.g.

  • missing support of f7/iconify-icons in sitemaps. Why are these showing in the configuration?
  • you can’t set a profil picture

But what’s really annoying is this:

I have created a rule that sends an e-mail in the event of errors/battery levels etc. I enter the e-mail address as a point string.I can enter this e-mail address freely in the GUI. Works great until the next restart. After that the field is empty!

There is an error that occurs when the Fritzbox loses the connection to OH after an update, for example, and cannot re-establish it. Only a reboot helps here. I have written a programme that detects this and reboots accordingly.

But now I can’t send a success mail because the field is empty. OH forgets the e-mail address I entered after a reboot? Why?

I was hoping that these were bugs and had been fixed with the big update. Therefore, in my opinion, it is not worth upgrading to OH 4.0.1. Sorry!

Not sure if you just want to complain that you feel better (fair enough) or want to have a solution for your problem. If you want a solution, please provide detailed information. Where do you „enter an email address“? Is the address saved in an item? Is it an unlinked item? If yes, do you have persistency activated for this item? Otherwise the content of the item is lost after a reboot.

1 Like

Iconify icons are supported in Basic UI since OH 4.0 and f7 icons are now supported in OH 4.1. So Basic UI now supports material, f7 and iconify icons. Same as Main UI.

The support by the Android and iOS apps is not yet fully completed. To be confirmed as I do not use it but normally iconify is now supported by the iOS app.

Support has been added snd is proved working.
Please show us your sitemap config to help you.

Where do you want to set a profile picture and what for?

Like @Oliver2 already wrote, it seems you have not configured persistence correctly.
For String Items, you will need mapDB with restoreOnStartUp configured for that.

Please elaborate a bit more on this, as it is not absolutely clear what happenes. Anything in the logs ?

In general, a more meaningful subject for your topic will raise the chance to get help.

In addition to a full explanation, the documentation includes a table showing what icon sources are supported by each app.

1 Like

of course,

here my workaound:

1st step: In my model I created a Equipment with the name Settings. In this, I create a string item with the name “Email-Adresse”.

2nd step: In my overview page, I created a list with Input List Item and I connect this item with follow settings:

3rd step. In my java script rule (like ECMA 5.1, currently I use Nashorn JS, I haven’t rework my JS-script yet), I call the value of “Email-Adresse” as follows:

 var receiver = itemRegistry.getItem("EmailAdresse").getState();

It works absolutley fine, but after rebooting the system, the set string, my E-Mail adress, is empty.

My standard persistence Service is RRD4j.

Rrdj4 only persists numbers.
I think you need to install mapdb and restore on start up.

That’s how I have mine set up and have no issues.
I have done all my persistence via the UI and don’t use any files.
I am using both rrdj4 and mapdb. Rrdj4 is my default.

It doesn’t work. I can’t see external icons in my Android app. You can see:

[EDIT]: Okay, I overlooked this in the docs. Android is not supported yet. I think I once read that this was fixed with 4.0.0. My mistake.

It’s not a big deal. I would like to change my administrator icon:
Admin

I don’t know where the error lies. After a short disconnection of the Fritzbox (due an update, for example), OH can no longer connect to the login data of the Fritzbox. The Fritzbox log shows “Incorrect password”. Since unfortunately no regulation works anymore and only a reboot helps, I have written a shell script which I call via the binding EXEC when the Fritzbox is no longer online:

var Things = Java.type('org.openhab.core.model.script.actions.Things');
var currentStatus = itemRegistry.getItem('FritzBoxStatus').getState();
//var currentStatus = "OFFLINE";

sendMail(currentStatus,"FritzBox");
 
function sendMail(Device, deviceName)
{ 
  if(Device != "ONLINE")
  {  
     var receiver = itemRegistry.getItem("EmailAdresse").getState();
     var subject = "Gerät " + deviceName + " offline, Reboot des Systems";
     var message = "Hallo Daniel, \n\nDas Gerät " + deviceName + " ist offline.\nDie Verbindung zwischen Openhab und Fritzbox ist gestört. "+
                    "Daher wurde das System neu gebootet.\n\nLogge Dich ein um zu prüfen ob alle Geräte wieder online sind.";
     
    Things.getActions('mail', 'mail:smtp:Postausgang').sendMail(receiver, subject, message);
   events.sendCommand('Shutdown_Ausfuhrung','ON'); // EXEC-Binding switch, call sh /home/scripts/shutdown.sh
  } 
  else 
  {
    events.sendCommand('Shutdown_Ruckgabewert','Kein Fehler erkannt.');
  }
}

This rule, I called it 6 times in 24h.

This workaround works absolutley fine. To be honest: This failure case is very rare and so far with OH 3.4.2, but Murpheys law is very reliable: It always happens when you are on holiday, for example. I have VPN access to my system, but fully automated is always better. I am only notified when the system reboots.

To be honest, I didn’t expect any help. This was only my opinion. :slight_smile:

Ohh, I actually didn’t know that. What is the workaround? Just install Binding or is it more complicated?

What do you mean exactly?
Are you using Fritzbox TR-064 binding?
What is the problem - is there no IP connection from OH to fritzbox or is the problem on a higher level that OH cannot receive information from Fritzbox although an IP connection exists?

Simply install MapDB (Addon store - Other - Persistence Services) and configure persistency so that it covers your email item

Read this:

mapdb is just an addon.

No, I use the lastest version of AVM Fritz!Binding. Openhab can no longer connect with the stored login data if the Fritzbox has been switched off or has undergone an update.

I install MapDB but how can I configure that, only for my Email-Adress? I wouldn’t like lost my logging datas in my dagrams.

When you configure MapDB persistence, just enter the item that stores your email address in the configuration settings.

Sorry, I don’t understand it right now. What do I have to configure where?

For ease of use, if you want to persist other non-number items later on it is easier to link all persist items to a group and persist the group itself. This way you do not need to edit config files all the time.

  1. create a group gRestoreOnStartup
  2. create a file mapdb.persist in your persistence directory
  3. add this to your mapdb.persist:
Strategies {
    default = restoreOnStartup
}

Items {
    gRestoreOnStartup*: strategy = everyChange, restoreOnStartup
  1. link your items to the group

Just to be complete: persistency with mapdb does not contain a history of items persisted. You only have access to the value before the last change.

My mapdb in the UI looks like this an d I persist everything:
Screenshot from 2023-12-16 22-14-06

And the code looks like this in the mapdb:

configurations:
  - items:
      - "*"
    strategies:
      - everyChange
      - restoreOnStartup
    filters: []
cronStrategies: []
defaultStrategies: []
thresholdFilters: []
timeFilters: []
equalsFilters: []
includeFilters: []

Nice. Which version of OH is this? I can‘t see it on M3 right now.

I just don’t understand it at the moment! What do I have to set where? I am using OH 4.0.4.

I just stay with RRD4j and keep my already logged data. I hard-code the e-mail address in the script. Function is “nice to have”.

These are the little things that just annoy me about OH. You have to do a lot of tricks just to save a simple string.

It is not a trick. If you want to be flexible and want to store values in an item, you need to make sure they survive a reboot. Other users have a requirement that an item after reboot is reset. So what would you do as a developer of openhab?
You would give them the flexibility to decide what YOU want to do with that item.
You can read it in the docs how to do that.
Greg showed you a very simple way how to persist all values and I have provided you an easy way how to selectively persist items with zero maintenance effort.
I honestly cannot think of a better way of how OH could deal with this.

But I understand you - especially when you are new to OH sometimes its flexibility is something you need to learn with. The best way is to post your topic shortly and add some meaningful information so that we understand your problem and you will see, you will always get an answer and even solutions.
This way you learn OH over time and you will start appreciating its flexibility.

Where is this configuration menu? Where? I can’t find it.