Persistence stopped working for some items

At this point the best I can offer is filing an issue. I don’t use MySQL and I’ve not seen similar threads recently on a problem like this.

I would like to dig a little bit deeper into my logs before opening an issue.

How do i use grep with multiple statements?
I would like to use grep with my item name, “mysql” and the items serialnumber.

Thanks Rich!

Two ways:

grep “a|b|c”
grep “a” | grep “b” | grep “c”

1 Like

I tried both ways and none worked:
grep "mySQL|itmHeizung_Schlafzimmer_IST|MEQ1557919" /var/log/openhab2/openhab.log* | less

grep "mySQL" /var/log/openhab2/openhab.log* | grep "itmHeizung_Schlafzimmer_IST" /var/log/openhab2/openhab.log* | grep "<SERIALNUMBER>" /var/log/openhab2/openhab.log* | less

And now all Charts stopped working…
Not only the homematic thermostat Charts stopped working but also my weather chart.

2018-12-22 00:45:54.539 [DEBUG] [thome.ui.internal.chart.ChartServlet] - Received incoming chart request: Request(GET //192.168.2.11:8080/chart?items=itmHeizung_Schlafzimmer_IST&period=D&theme=dark&t=1545435954503)@161f8c8
2018-12-22 00:45:54.543 [DEBUG] [thome.ui.internal.chart.ChartServlet] - No begin or end is specified, use now as end and now-period as begin.
2018-12-22 00:45:54.546 [DEBUG] [thome.ui.internal.chart.ChartServlet] - chart building with width 480 height 240 dpi null
2018-12-22 00:45:54.552 [DEBUG] [ltchartprovider.DefaultChartProvider] - Rendering chart: service: 'null', theme: 'dark', startTime: 'Fri Dec 21 00:45:54 CET 2018', endTime: 'Sat Dec 22 00:45:54 CET 2018', width: '480', height: '240', items: 'itmHeizung_Schlafzimmer_IST', groups: 'null', dpi: 'null', legend: 'null'

what is your default persistence service? (and how many persistence services do you have installed)

Default is mySQL and no others installed.

I don’t like this part in the log (but this shouldn’t be the problem since the Chart should pickup the default)
can you try to add explicitly the service in your Chart element in the sitemap?
Ref: https://www.openhab.org/docs/configuration/sitemaps.html#element-type-chart

That syntax is wrong. The second and third calls to grep can’t specify a file.

Use:

grep "mySQL" /var/log/openhab2/openhab.log* | grep "itmHeizung_Schlafzimmer_IST" | grep "<SERIALNUMBER>"

I already tried:
Chart item=itmHeizung_Schlafzimmer_IST refresh=60000 period=D service="mySQL"
Chart item=itmHeizung_Schlafzimmer_IST refresh=60000 period=D service="mysql"
(What syntax is correct? There´s no example in the docs for mySQL Charts. Maybe i´ll change to RRD4j for this Charts)

But there´s still no Chart being rendered and displayed.

service=“mySQL”

2018-12-22 09:45:17.726 [DEBUG] [thome.ui.internal.chart.ChartServlet] - Received incoming chart request: Request(GET //192.168.2.11:8080/chart?items=itmHeizung_Schlafzimmer_IST&period=D&service=mySQL&theme=dark&t=1545468317692)@15a08fd
2018-12-22 09:45:17.731 [DEBUG] [thome.ui.internal.chart.ChartServlet] - No begin or end is specified, use now as end and now-period as begin.
2018-12-22 09:45:17.734 [DEBUG] [thome.ui.internal.chart.ChartServlet] - chart building with width 480 height 240 dpi null
2018-12-22 09:45:17.740 [DEBUG] [ltchartprovider.DefaultChartProvider] - Rendering chart: service: 'mySQL', theme: 'dark', startTime: 'Fri Dec 21 09:45:17 CET 2018', endTime: 'Sat Dec 22 09:45:17 CET 2018', width: '480', height: '240', items: 'itmHeizung_Schlafzimmer_IST', groups: 'null', dpi: 'null', legend: 'null'
2018-12-22 09:45:17.746 [WARN ] [thome.ui.internal.chart.ChartServlet] - Illegal argument in chart: Persistence service not found 'mySQL'.

service=“mysql”
(No error but still no chart)

2018-12-22 09:46:13.170 [DEBUG] [thome.ui.internal.chart.ChartServlet] - Received incoming chart request: Request(GET //192.168.2.11:8080/chart?items=itmHeizung_Schlafzimmer_IST&period=D&service=mysql&theme=dark&t=1545468373149)@b296f9
2018-12-22 09:46:13.174 [DEBUG] [thome.ui.internal.chart.ChartServlet] - No begin or end is specified, use now as end and now-period as begin.
2018-12-22 09:46:13.177 [DEBUG] [thome.ui.internal.chart.ChartServlet] - chart building with width 480 height 240 dpi null
2018-12-22 09:46:13.182 [DEBUG] [ltchartprovider.DefaultChartProvider] - Rendering chart: service: 'mysql', theme: 'dark', startTime: 'Fri Dec 21 09:46:13 CET 2018', endTime: 'Sat Dec 22 09:46:13 CET 2018', width: '480', height: '240', items: 'itmHeizung_Schlafzimmer_IST', groups: 'null', dpi: 'null', legend: 'null'

The persistence stopped working at all and none items are currently stored into mySQL.


That´s why i asked for the syntax :wink:

Now i tried:
grep "mySQL" /var/log/openhab2/openhab.log* | grep "itmHeizung_Schlafzimmer_IST" | grep "<SERIALNUMBER>" | less

I just get an empty window…
I double checked upper-/lowercase as grep seems to be case sensitive.
And without | lessi don´t get anything displayed and just a new command line.

dig deeper into the OH2 ↔ MySQL connection
put the addon in TRACE log level to see what the OH2 side has to say
double check that the MySQL server is up and running and listening to incoming connections

from the OH2 console:

log:set TRACE org.openhab.persistence.mysql

try also to transition to the better version: persistence-jdbc-mysql instead of persistence-mysql maybe this will help?

I think the second one that you used (service="mysql"). but this won’t help since there is no data being stored in the DB for the chart to retrieve them :frowning:

btw: did you recently modify the tags to the affected items?
can you try to remove the tags for a second to see if this warning disappears and if the item states are being persisted?

edit:

you may have duplicate Items and/or Links in your system

check using the console:

items list |grep xyz
links list |grep xyz

I did another restart of openHAB because now the rule engine stopped working partially.
Basic timer rules were still running but thing based rules didn´t started or simple doesn´t received their trigger.

I changed the log level through the console and checked with log:get
Also changed the smarthome and openhab log level to DEBUG.

Logger                                             │ Level
───────────────────────────────────────────────────┼──────
org.eclipse.smarthome                              │ DEBUG
org.openhab                                        │ DEBUG
org.openhab.persistence.mysql                      │ TRACE

It seems like the logging for mysql doesn´t work, as i don´t get any TRACE logs.

The mySQL Server is running on my HP MicroServer Gen8 with Windows Server 2016 and is up, running and listening for connections.
The error log had no entries for external events like broken connections or something similiar.
The general log is now enabled so it just started to log everything.

Is it possible to migrate?
There´s a topic in the docs but no information HOW to migrate…
Do i just need to uninstall the old one, install the new one and change the config file?

I changed some group memberships for the battery channels.
The groups are defined at the beginning of my .items files and then used.
Some are starting with an uppercase letter and some with an lowercase letter, does this matter?

I had a problem with my homematic items a while back.

As i´m coming from oH1 i choosed to still work with files instead of the json based PaperUI.
So i´m working with .things and .items files for everything i use in oH.
When initially setting up oH2 with Homegear for homematic all items were linked to things through the channels.
But a while back this links didn´t worked anymore so i had to link them through PaperUI.
Now i´m running with items that are linked to things through channels and the items are linked to things through PaperUI.
Maybe this could cause some problems?
The problem is that my items didn´t received any updates with the channel based linking to things…

openhab> items list |grep itmHeizung_Schlafzimmer_IST
itmHeizung_Schlafzimmer_IST (Type=NumberItem, State=21.40, Label=Temperatur Schlafzimmer, Category=heating, Tags=[CurrentTemperature], Groups=[Schlafzimmer, Temperatur, gPersist])
openhab> links list |grep itmHeizung_Schlafzimmer_IST                                                                                                                                                                                                                                                  
itmHeizung_Schlafzimmer_IST -> homematic:HM-CC-RT-DN:default:<SERIALNUMBER>:4#ACTUAL_TEMPERATURE
itmHeizung_Schlafzimmer_IST -> homematic:HG-HM-CC-RT-DN:default:<SERIALNUMBER>:4#ACTUAL_TEMPERATURE

So yes, i have duplicate links :frowning_face:

I removed the PaperUI links through the JSON file org.eclipse.smarthome.core.thing.link.ItemChannelLink.json
and double checked the homematic.items file.

Now i just have one link for my oH items

openhab> items list |grep itmHeizung_Schlafzimmer_IST
itmHeizung_Schlafzimmer_IST (Type=NumberItem, State=21.40, Label=Temperatur Schlafzimmer, Category=heating, Tags=[CurrentTemperature], Groups=[Schlafzimmer, Temperatur, gPersist])
openhab> links list |grep itmHeizung_Schlafzimmer_IST                                                                                                                                                                                                                                       
itmHeizung_Schlafzimmer_IST -> homematic:HG-HM-CC-RT-DN:default:<SERIALNUMBER>:4#ACTUAL_TEMPERATURE

I don´t know if this caused the persistence to stop.
I´ll have a look at the stability in the next days and let the logs stay in DEBUG/TRACE for a while.

Last thing would be the migration from mySQL to JDBC with mySQL.

Thanks!

Yep. The -i switch makes it ignore case:

grep -i ...

You could also try:

grep -i -E 'a|b|c' file

that’s too much :slight_smile:
your OH2 instance will struggle to output so much logging to openhab.log

yes. backup your configs and DB first :slight_smile:

no

the correct way is to link the Item to the Channel of the Thing (either using items files of via PaperUI). The link is done to the Channel (not the Thing itself).

most likely you had made a mistake with the CUID (Channel Unique Identifier). Copy the CUID from PaperUI and paste it in your Item config (channel="CUID")

I switched back the openhab and smarthome logging to INFO and set mySQL to TRACE.
mySQL stopped working again…
The openhab.log had no error and just stopped logging the mysql persistence at 15:38.
The mySQL log has no errors and stopped receiving connections at the same time.

Charts are also stopped working for homematic and weather items.
They don´t even get displayed.

I´m out of ideas.
A restart of the openhab service resolves the problem for some hours but that´s no solution.

Persistence is up and running for some days now.
Charts are also working without problems.

Thanks for your help Rich, namraccr and Angelos!

How do i remove the logging for mysql?
Or what is the standard loglevel?

This says

log:set DEFAULT org.openhab.persistence.mysql

Or you can just choose a level like INFO or ERROR.

1 Like

I was wondering if anyone could lend me a hand or some advice. I too am having issues with some items not getting pushed into mysql.

Here are the items in question: DnAvg & WnAvg? All others are working fine. And they all belong to the same group?

// Laundry Room
Switch tplinksmarthome_hs110_B1AFF9_switch              "Dryer"                    (BF_LaundryRoom , GetPower)
Number tplinksmarthome_hs110_B1AFF9_power               "Dryer Power"              (BF_LaundryRoom , GetPower)    ["Power"]
Number plinksmarthome_hs110_B1AFF9_energyUsag           "Dryer Usage"              (BF_LaundryRoom , GetPower)
Number tplinksmarthome_hs110_B1AFF9_current             "Dryer Current"            (BF_LaundryRoom , GetPower)

Switch tplinksmarthome_hs110_B16E5F_switch            "Washing Machine"            (BF_LaundryRoom , GetPower)
Number tplinksmarthome_hs110_B16E5F_power             "Washing Machine Power"      (BF_LaundryRoom , GetPower)    ["Power"]
Number tplinksmarthome_hs110_B16E5F_energyUsage       "Washing Machine Usage"      (BF_LaundryRoom , GetPower)
Number tplinksmarthome_hs110_B16E5F_current           "Washing Machine Current"    (BF_LaundryRoom , GetPower)

Number Washingmachine_OpState           "Washing Machine State [MAP(wmachine.map):%s]"   (BF_LaundryRoom , GetPower)
Number Dryer_OpState                    "Dryer State [MAP(dryer.map):%s]"                (BF_LaundryRoom , GetPower)

Number DnAvg            "Dryer Power Avg [%.2f kW]"                                   (BF_LaundryRoom , GetPower)        ["Power"]
Number WnAvg            "Washing Machine Power Avg [%.2f kW]"                         (BF_LaundryRoom , GetPower)        ["Power"]

And when I look at the log I see data for those two entries?

2019-01-15 09:19:59.270 [INFO ] [clipse.smarthome.model.script.dryer ] - Power average  is: 1.393267739929732