bassmaster187 / TeslaLogger

TeslaLogger is a self hosted data logger for your Tesla Model S/3/X/Y. Actually it supports RaspberryPi 3B, 3B+, 4B, Docker and Synology NAS.
https://www.teslalogger.de
GNU General Public License v3.0
505 stars 167 forks source link

[Docker] Settings won't be changed #104

Closed bassmaster187 closed 4 years ago

bassmaster187 commented 4 years ago

Warning: file_get_contents(/etc/teslalogger/settings.json): failed to open stream: No such file or directory in /var/www/html/admin/language.php on line 2

ubuntu 18.09 64 Bit.

Docker version 19.03.5, build 633a0ea838 docker-compose version 1.25.0, build 0a186604 docker-py version: 4.1.0

Teslalogger: 1.36.0.0

nortonsk commented 4 years ago

I am experiencing the same issue.

bluppdiwupp commented 4 years ago

same here

bassmaster187 commented 4 years ago

Please try to update. It seems like It has a problem, when there is no settings file available.

nortonsk commented 4 years ago

Hi,

I have updated it and copied the settings.json file from raspberry installation... still not working properly and not possible to update the file from 8888/admin/settings.php even loading of existing file content is not working...

On Sun, Dec 29, 2019, 12:30 Christian P. notifications@github.com wrote:

Please try to update. It seems like It has a problem, when there is no settings file available.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bassmaster187/TeslaLogger/issues/104?email_source=notifications&email_token=AIK6ABE6HNB3DC2MQMIDW43Q3CC7BA5CNFSM4KADJ6D2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHY5KAI#issuecomment-569496833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIK6ABAL3HZGK7GHCKKBGIDQ3CC7BANCNFSM4KADJ6DQ .

bassmaster187 commented 4 years ago

@nortonsk could you please post a screenshot of your settings panel.

nortonsk commented 4 years ago

Hi Chritian,

here is my screenshots: [image: image.png]

cat /docker/TeslaLogger/TeslaLogger/bin/settings.json {"SleepTimeSpanStart":"","SleepTimeSpanEnd":"","SleepTimeSpanEnable":"false","Power":"kw","Temperature":"celsius","Length":"km","Language":"en","URL_Admin":"","

Here are some error messages from LOG FILES: 30.12.2019 16:54:40 : System.InvalidOperationException: Internal error: object is a dictionary, but no key present. at System.Web.Script.Serialization.JsonDeserializer.StoreValue (System.Object o) [0x00055] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JsonDeserializer.Deserialize (System.IO.TextReader input) [0x00082] in

<9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.Json.Deserialize (System.IO.TextReader input, System.Web.Script.Serialization.JavaScriptSerializer jss) [0x00014] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.Json.Deserialize (System.String input, System.Web.Script.Serialization.JavaScriptSerializer jss) [0x00014] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObjectInternal (System.String input) [0x00000] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject (System.String input) [0x00000] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at TeslaLogger.Tools.StartSleeping (System.Int32& startSleepingHour, System.Int32& startSleepingMinutes) [0x0002d] in <459a53c53ac14bc8add511acf8400030>:0 30.12.2019 16:54:42 : System.InvalidOperationException: Internal error: object is a dictionary, but no key present. at System.Web.Script.Serialization.JsonDeserializer.StoreValue (System.Object o) [0x00055] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JsonDeserializer.Deserialize (System.IO.TextReader input) [0x00082] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.Json.Deserialize (System.IO.TextReader input, System.Web.Script.Serialization.JavaScriptSerializer jss) [0x00014] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.Json.Deserialize (System.String input, System.Web.Script.Serialization.JavaScriptSerializer jss) [0x00014] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObjectInternal (System.String input) [0x00000] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject (System.String input) [0x00000] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at TeslaLogger.Tools.StartSleeping (System.Int32& startSleepingHour, System.Int32& startSleepingMinutes) [0x0002d] in <459a53c53ac14bc8add511acf8400030>:0 30.12.2019 16:54:44 : System.InvalidOperationException: Internal error: object is a dictionary, but no key present. at System.Web.Script.Serialization.JsonDeserializer.StoreValue (System.Object o) [0x00055] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JsonDeserializer.Deserialize (System.IO.TextReader input) [0x00082] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.Json.Deserialize (System.IO.TextReader input, System.Web.Script.Serialization.JavaScriptSerializer jss) [0x00014] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.Json.Deserialize (System.String input, System.Web.Script.Serialization.JavaScriptSerializer jss) [0x00014] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObjectInternal (System.String input) [0x00000] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject (System.String input) [0x00000] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at TeslaLogger.Tools.StartSleeping (System.Int32& startSleepingHour, System.Int32& startSleepingMinutes) [0x0002d] in <459a53c53ac14bc8add511acf8400030>:0 30.12.2019 16:54:47 : System.InvalidOperationException: Internal error: object is a dictionary, but no key present. at System.Web.Script.Serialization.JsonDeserializer.StoreValue (System.Object o) [0x00055] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JsonDeserializer.Deserialize (System.IO.TextReader input) [0x00082] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.Json.Deserialize (System.IO.TextReader input, System.Web.Script.Serialization.JavaScriptSerializer jss) [0x00014] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.Json.Deserialize (System.String input, System.Web.Script.Serialization.JavaScriptSerializer jss) [0x00014] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObjectInternal (System.String input) [0x00000] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject (System.String input) [0x00000] in <9f7718f4b0464cf1a81e62ec4b7e1cab>:0 at TeslaLogger.Tools.StartSleeping (System.Int32& startSleepingHour, System.Int32& startSleepingMinutes) [0x0002d] in <459a53c53ac14bc8add511acf8400030>:0 I have it implemented in latests docker and starting it using docker-compose up -d I have pulled the latests changes in the repo. From https://github.com/bassmaster187/TeslaLogger d250f78..5bc8fa7 master -> origin/master Updating d250f78..5bc8fa7 Fast-forward TeslaLogger/www/admin/language.php | 10 +++++++--- TeslaLogger/www/admin/settings.php | 26 ++++++++++++++++++++++++-- After the restart still the same issue. If you like we can call to troubleshoot it better. I have spoken to Michael and I would like to do the translation to Czech when possible. Regards, Norton
tscsmith commented 4 years ago

Hi Christian,

updated to the latest published version

Teslalogger: | 1.36.1.0

the error warnings at the top are gone! In the settings.php I can see now what is actually set, except the scanmytesla integration. It is unchecked but I changed the config the hard way so it is enabled. Anyway if I change now something and save it a popup appears that says it's saved. But if I check the settings.php again nothing changed.

So some progress but the issue is not finally solved. Thanks again for your efforts!

bassmaster187 commented 4 years ago

Could you guys please send me your settings.json file. After that please try to delete your settings.json file and reload the settings panel.

tscsmith commented 4 years ago

Ok I think we found the problem. I haven't a settings.json file in my Teslalogger\Teslalogger folder structure.

Here is something that I just found. In my:

"/TeslaLogger/TeslaLogger/www/admin" folder there is the a file called settings.php

If you check the code there is something written like:

            $content = FALSE;
            if (file_exists("/etc/teslalogger/settings.json"))
                    $content = file_get_contents("/etc/teslalogger/settings.json");

            if ($content === FALSE)
            {
                    echo ("$('#radio_kw').prop('checked', true);\r\n");
                    echo ("$('#radio_celsius').prop('checked', true);\r\n");
                    echo ("$('#radio_km').prop('checked', true);\r\n");
                    echo ("$('#radio_en').prop('checked', true);\r\n");
            }

As I wrote at the beginning I haven't found any settings.json file anywhere. checked the whole system find / -name settings.json

Maybe I do some mistakes here.

bassmaster187 commented 4 years ago

But you see all the other files in /etc/teslalogger in your "webserver" docker?

tscsmith commented 4 years ago

Yes,

root@93fcdc1eeee4:/etc/teslalogger# ls GeocodeCache.xml MySQL.Data.EntityFrameworkCore.dll TeslaLogger.exe geofence.csv nohup.out Google.Protobuf.dll MySql.Data.EntityFramework.dll TeslaLogger.exe.config git tesla_token.txt Logfile.dll MySql.Data.dll VERSION language-en.txt tmp Logfile.pdb MySql.Web.dll backup.sh language-no.txt view_trip.txt M2Mqtt.Net.dll SRTM-Data car_settings.xml mono_crash.131916e56.0.json MQTTClient.exe SRTM.dll cmd_updated.txt mono_crash.26121ab28.0.json MQTTClient.exe.config SRTM.pdb current_json.txt mono_crash.28f0b2e8c.0.json MySQL.Data.EntityFrameworkCore.Design.dll TASKERTOKEN geofence-private.csv mono_crash.2d7624494.0.json

The TeslaLogger.exe.config that I manually edited with the "scanmytesla True" option is also there.

bassmaster187 commented 4 years ago

@tscsmith is the settings.json there, if you hit save button? If not, could you please post the recent seconds of your webserver logfile. docker logs

tscsmith commented 4 years ago

1st there is no settings.json if I hit the Save button.

I am not very into the whole docker universe, so I have some questions.

I looked into the teslalogger_webserver1 container )connected to the console) and checked the logfiles of: root@93fcdc1eeee4:/var/log/apache2# more error.log

But there is no data inside in all off the logfiles. So I googled a little bit and found out that logfiles are written to the host: /var/lib/docker/containers/93fcdc1eeee4fb5df6396aefe8b80c218181f25a03a9fede673e177da8c239cf/93fcdc1eeee4fb5df6396aefe8b80c218181f25a03a9fede673e177da8c239cf-json.log

Attached the tail-f from the log but there is nothing that would help you I think.

{"log":"192.168.113.2 - - [03/Jan/2020:09:13:55 +0100] \"GET /admin/img/icon-help-24.png HTTP/1.1\" 304 180 \"http://192.168.1.211:8888/admin/settings.php\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:13:55.214775753Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:14:00 +0100] \"POST /admin/settings_write.php HTTP/1.1\" 200 444 \"http://192.168.1.211:8888/admin/settings.php\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:14:00.091479169Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:14:02 +0100] \"GET /admin/settings.php HTTP/1.1\" 200 1689 \"http://192.168.1.211:8888/admin/settings.php\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:14:02.584171127Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:14:12 +0100] \"POST /admin/settings_write.php HTTP/1.1\" 200 445 \"http://192.168.1.211:8888/admin/settings.php\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:14:12.46581551Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:14:13 +0100] \"GET /admin/settings.php HTTP/1.1\" 200 1689 \"http://192.168.1.211:8888/admin/settings.php\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:14:14.010679053Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:16:48 +0100] \"POST /admin/settings_write.php HTTP/1.1\" 200 446 \"http://192.168.1.211:8888/admin/settings.php\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:16:48.203907297Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:16:49 +0100] \"GET /admin/settings.php HTTP/1.1\" 200 1689 \"http://192.168.1.211:8888/admin/settings.php\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:16:49.698065772Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:17:13 +0100] \"GET /admin/password.php HTTP/1.1\" 200 996 \"http://192.168.1.211:8888/admin/settings.php\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:17:13.643988394Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:17:21 +0100] \"GET /admin/current_json.php HTTP/1.1\" 200 701 \"http://192.168.1.211:8888/admin/\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:17:21.886292805Z"} {"log":"192.168.113.2 - - [03/Jan/2020:09:19:06 +0100] \"GET /admin/current_json.php HTTP/1.1\" 200 701 \"http://192.168.1.211:8888/admin/\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36\"\n","stream":"stdout","time":"2020-01-03T08:19:06.85555771Z"}

Sorry I don't know much about the docker stuff and how it plays all together with the 4 containers for the teslalogger.

bassmaster187 commented 4 years ago

@tscsmith the docker will redirect the logfiles to stdout and stderr. The attaced logfile is not long enough as I can't see settings_write.php has been loaded.

it should look like this:

172.19.0.1 - - [03/Jan/2020:10:16:03 +0100] "GET /admin/current_json.php HTTP/1.1" 200 652 "http://localhost:8888/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:03 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "http://localhost:8888/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:08 +0100] "GET /admin/current_json.php HTTP/1.1" 200 695 "http://localhost:8888/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:09 +0100] "GET /admin/settings.php HTTP/1.1" 200 1735 "http://localhost:8888/admin/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:09 +0100] "GET /admin/img/icon-help-24.png HTTP/1.1" 200 870 "http://localhost:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:15 +0100] "POST /admin/settings_write.php HTTP/1.1" 200 237 "http://localhost:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" 172.19.0.1 - - [03/Jan/2020:10:16:21 +0100] "GET /admin/settings.php HTTP/1.1" 200 1730 "http://localhost:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"

tscsmith commented 4 years ago

93fcdc1eeee4fb5df6396aefe8b80c218181f25a03a9fede673e177da8c239cf-json.log

Hope that helps!

tscsmith commented 4 years ago

Little update from me to the latest version Teslalogger: | 1.36.3.0

tscsmith commented 4 years ago

Teslalogger 1.36.4.0 same behavior as 1.36.3.0

bassmaster187 commented 4 years ago

Can anybody give me temporary remote access to their shell and admin panel?

rowich commented 4 years ago

Keine Ahnung ob die antwort ankommt. Habe das Problem nicht mitverfolgt aber kann gerne (wie?) Zugriff geben.

⁣TypeApp for Android herunterladen ​

Am 7. Jan. 2020, 13:20, um 13:20, "Christian P." notifications@github.com schrieb:

Can anybody give me temporary remote access to their shell and admin panel?

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/bassmaster187/TeslaLogger/issues/104#issuecomment-571564248

nortonsk commented 4 years ago

UPDATE: Issue was fixed by setting the ownership to www-data on the whole folder Teslalogger/bin I have set the permission to other folders too. chown -R www-data Teslalogger

Now the issue is gone and save of the settings.json works.

Still the issue is there: When I have settings.json it cannot read it and do not show options... When I remove settings.json file then it shows me default values and when I hit on SAVE it gives me window saved... No file created.

From logs I have this: 192.168.1.18 - - [14/Jan/2020:16:03:56 +0100] "POST /admin/settings_write.php HTTP/1.1" 200 445 "http://192.168.1.245:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"

192.168.1.18 - - [14/Jan/2020:16:03:59 +0100] "GET /admin/settings.php HTTP/1.1" 200 1688 "http://192.168.1.245:8888/admin/settings.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"

If you like we can have a session via Skype/Teams or other program and I can share you my screen.

REgards,

Norton

bassmaster187 commented 4 years ago

Please update to 1.37.3.0 - after Reboot you should see this in logfile:

teslalogger_1  | 15.01.2020 16:39:41 : Creating empty settings.json
teslalogger_1  | 15.01.2020 16:39:41 : chmod 666 /etc/teslalogger/settings.json

after that, you should be able to write the settings file.

tscsmith commented 4 years ago

Nice work! Thank you for your efforts. Works like a charm now. :)