[Solved] Switch item configured in .item file not made persistence in OH2?

I have declared 2 switch items in /etc/openhab2/items/mqtt.items

Switch doorbell_ring {mqtt="<[mosquitto:myHome/doorbell/ring:state:default]"}
Switch doorbell_mute {mqtt=">[mosquitto:myHome/doorbell/mute:command:ON:1],>[mosquitto:myHome/doorbell/mute:command:OFF:0]"}

although everything is working correct, these items are not made persistent in my influxDB. Currently I have the persitency setup for influxdb to make all (*) persistent, on everychange.

according:


The states of an item are persisted in time series with names equal to the name of the item. All values are stored in a field called “value” using integers or doubles, OnOffType and OpenClosedType values are stored using 0 or 1. The times for the entries are calculated by InfluxDB.

but I don’t see this comment in the OH2 documentation, neither do I see this behaviour, for my own configured switches,
for switch Items coming from a OH2 bindings (like samsung TV binding where I use power item (being of type switch) the values are made persistence as 0 & 1, so it should be possible. I would expect the same for these manual configured switchs items but that is not the case. Is this a bug or am I missing something?

I’m using OH2, with influxdb 1.1.1

It has been awhile since I’ve checked but I used to routinely chart Switch Items using Influx and Grafana. I can’t say if this is something has changed. If so it is a bug and not expected behavior.

Please post:

  1. version of OH you are running (release, 2.1 snapshot, etc)
  2. your full influxdb.persist file
  3. results of querying InfluxDB for your switch items

I don’t know why but somehow OH needed an overnight sleep. Currently it is working for both manual configured switches :slight_smile:

for doorbell_ring I noticed I made a mistake as this switch is only sending ON values for everytime the doorbell is ringing. in the persistence file I had configured strategy = EveryChange. Changing this to EveryUpdate did the job.
For doorbell_mute I still don’t get why it is working now and not at the moment I configured it.
But the good news is it is working :slight_smile: