Write in the database, if no connection #40

To track the loss of connection write down when there was no connection.
added a tiny comment
fix some trouble with the doubled variables
adjust the moistchart a tiny bit