sdetweil / MMM-Config

testing
30 stars 3 forks source link

Cannot read property 'icons' of undefined #6

Closed fireport closed 3 years ago

fireport commented 3 years ago

Dear sdetweil, I installed your amazing module in my raspberry magic mirror config but the module refuse to start with the following error: `[2021-05-23 07:10:03.914] [ERROR] stderr 2: /home/pi/MagicMirror/modules/MMM-Config/scripts/buildschema3.js:600 return data[left]; ^

TypeError: Cannot read property 'icons' of undefined at get_define_info (/home/pi/MagicMirror/modules/MMM-Config/scripts/buildschema3.js:600:14) at get_define_info (/home/pi/MagicMirror/modules/MMM-Config/scripts/buildschema3.js:597:12) at form_object_correction.forEach (/home/pi/MagicMirror/modules/MMM-Config/scripts/buildschema3.js:415:29) at Array.forEach () at Object. (/home/pi/MagicMirror/modules/MMM-Config/scripts/buildschema3.js:405:24) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) `

sdetweil commented 3 years ago

can u attach the defaults.js file (have to rename to .txt) from the module folder.. and your config.js (for personal info, change the text, don't remove any entries)

or mail to me, same user ID at gmail

fireport commented 3 years ago

config.txt defaults.txt

sdetweil commented 3 years ago

thanks.. fixed.. please git pull and try it out

fireport commented 3 years ago

Now the errors are gone but the configuration page display only "Configure MagicMirror and modules" without other entries.

sdetweil commented 3 years ago

can you go the module folder and see schema3.json. that is the form file

sdetweil commented 3 years ago

I used your files and it works as expected Screenshot at 2021-05-24 07-54-04

if the web page was still open, please hit f5 for refresh

fireport commented 3 years ago

I tried even changing the browser. Unfortunately, the page contains only the title. I enabled debug mode but the only entries I found are: [2021-05-24 15:57:06.660] [LOG] connection started = connect │··· [2021-05-24 15:57:06.666] [LOG] path=/home/pi/MagicMirror/modules/MMM-Config/schema3.json │··· [2021-05-24 15:57:26.777] [LOG] connection started = connect │··· [2021-05-24 15:57:26.778] [LOG] path=/home/pi/MagicMirror/modules/MMM-Config/schema3.json │··· [2021-05-24 15:57:27.890] [LOG] connection started = connect │··· [2021-05-24 15:57:27.892] [LOG] path=/home/pi/MagicMirror/modules/MMM-Config/schema3.json │··· [2021-05-24 15:57:29.272] [LOG] connection started = connect │··· [2021-05-24 15:57:29.273] [LOG] path=/home/pi/MagicMirror/modules/MMM-Config/schema3.json │··· [2021-05-24 15:57:31.506] [LOG] connection started = connect │··· [2021-05-24 15:57:31.510] [LOG] path=/home/pi/MagicMirror/modules/MMM-Config/schema3.json

sdetweil commented 3 years ago

and you are using the MM url, NOT the file url

note above in my screen shot, I am using the MM url

mm url is

if using localhost

            http://localhost:MM_port:/modules/MMM-Config/config.html

or ip address 

            http://MM_IP_address:MM_port:/modules/MMM-Config/config.html

file url is

          file:///home/sam/MagicMirror/modules/MMM-Config/config.html

the form will NOT load using the file url

sdetweil commented 3 years ago

the QRcode link is

http://ipaddress:port/modules/MMM-Config/review

which will redirect to the MM url

this lets me change the MM url when/if I need to

fireport commented 3 years ago

I'm using the mM URL immagine

sdetweil commented 3 years ago

in the web form page, ctrl-shift-i and select the console tab for any web page errors...

fireport commented 3 years ago

The console shows some errors Screenshot_2021-05-25_07-17-05 but the bootstrap.css is accessible from the browser pi@raspberrypi:~/MagicMirror/modules/MMM-Config/node_modules/jsonform/deps/opt$ ls -l ~/MagicMirror/modules/MMM-Config/node_modules/jsonform/deps/opt/bootstra│·············p.css │············· -rw-r--r-- 1 pi pi 146010 Oct 26 1985 /home/pi/MagicMirror/modules/MMM-Config/node_modules/jsonform/deps/opt/bootstrap.css

fireport commented 3 years ago

Screenshot_2021-05-25_09-10-09

sdetweil commented 3 years ago

note that the latest update now adds a new parm on the end, the port number of the socket,

please start with the top level url

http://MM_ip:MM_port/modules/MMM-Config/review

it will redirect to the correct url

fireport commented 3 years ago

Dear @sdetweil thank you for your effort but I can't see the form on the page even with the latest version.

sdetweil commented 3 years ago

you did an npm install after the git pull, correct?

and you use the review link, and it opens a new page with url with port= on the end, correct?

fireport commented 3 years ago

you are correct

Il giorno gio 27 mag 2021 alle ore 12:47 sam detweiler < @.***> ha scritto:

you did an npm install after the git pull, correct?

and you use the review link, and it opens a new page with url with port= on the end, correct?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sdetweil/MMM-Config/issues/6#issuecomment-849532044, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXYQ4GC7HVAE3YOTCXACZTTPYPMZANCNFSM45LKQYIA .

sdetweil commented 3 years ago

used your config.js and defaults.txt above on the latest code (I had to disable some modules I didn;t have installed) but it works, using the review link..

Screenshot at 2021-05-27 09-23-40

also in the MM startup messages I see

  Starting module helper:MMM-Config
[27.05.2021 09:22.59.737] [LOG]   execing /home/sam/MagicMirror/modules/MMM-Config/test_convert.sh override
[27.05.2021 09:22.59.749] [LOG]    got port=8300
fireport commented 3 years ago

you are correct Il giorno gio 27 mag 2021 alle ore 12:47 sam detweiler < @.***> ha scritto: you did an npm install after the git pull, correct? and you use the review link, and it opens a new page with url with port= on the end, correct? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#6 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXYQ4GC7HVAE3YOTCXACZTTPYPMZANCNFSM45LKQYIA .

Pointing my browser to http://xxxxx:8080/modules/MMM-Config/review I'm redirected to http://xxxxx:8080/modules/MMM-Config/config.html?port=8300 but the config page is empty

sdetweil commented 3 years ago

thank you, lets do a couple things

  1. try the next code version
    cd ~/MagicMirror/modules/MMM-Config
    git checkout newform
    npm install

    then do your normal starting of MM

if THAT doesn NOT work

  1. try the multi-module version
    cd ~/MagicMirror/modules/MMM-Config
    git checkout multi-module
    npm install

    then do your normal starting of MM

if THAT does NOT work

  1. send me your config.js and the defaults.js from the module folder, each of these will have to be renamed to have .txt instead of .js my email is my same userid at gmail.
sdetweil commented 3 years ago

looks like it works on multi-module, using the config and defaults above the others fail, correction

the others fail because I letit build a defaults file and I don't have some of the same modules installed... so in config but not installed causes a problem..

sdetweil commented 3 years ago

ok, found it.. the data in config.js is beyond what is defined in the data from the module home-assistant

values: [{
                        sensor: "sensor.riscaldamento_temperature",
                        alertThreshold: 50,
                        icons: [{
                            "default": "temperature-celsius"
                        }]
                    }, {
                        sensor: "sensor.sensore_stanza_chiara_temperature",
                        icons: [{

                            "default": "temperature-celsius"
                        }]
                    }, {
                        sensor: "sensor.deumidificatore_stanza_da_letto_am2301_temperature",
                        icons: [{
                            "default": "temperature-celsius"
                        }]
                    }, {
                        sensor: "sensor.deumidificatore_simone_am2301_temperature",
                        icons: [{
                            "default": "temperature-celsius"
                        }]

                    }, {
                        sensor: "sensor.clima_esterno_temperature",
                        icons: [{
                            "default": "temperature-celsius"
                        }]
                    }

the module says

  values: []

so the form now shows an array of 1 text field for all of that

in multi-module with the schema.json file we can improve the form to be an array of structures (which is what it is supposed to be)

git checkout multi-module git pull

fireport commented 3 years ago

I tried also with a clean install but, unfortunately, I continue to see a page without forms. `129 pi@raspberrypi:~/MagicMirror/modules$ git clone https://github.com/sdetweil/MMM-Config Cloning into 'MMM-Config'... remote: Enumerating objects: 570, done. remote: Counting objects: 100% (570/570), done. remote: Compressing objects: 100% (409/409), done. remote: Total 570 (delta 353), reused 343 (delta 154), pack-reused 0 Receiving objects: 100% (570/570), 462.98 KiB | 2.57 MiB/s, done. Resolving deltas: 100% (353/353), done. pi@raspberrypi:~/MagicMirror/modules$ cd MMM-Config/ pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ ls config.html exec_script.js MMM-Config.css node_helper.js postinstall README.md templates test_convert.sh translations webform.js doc_images form-client.js MMM-Config.js package.json postinstall.cmd scripts test_convert.cmd touch.cmd webform.css pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ git checkout multi-module Branch 'multi-module' set up to track remote branch 'multi-module' from 'origin'.

mmm-config@1.0.0 postinstall /home/pi/MagicMirror/modules/MMM-Config node exec_script.js ./postinstall:postinstall.cmd

copying git pre-commit hook

npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"}) npm WARN mmm-config@1.0.0 No repository field.

added 135 packages from 99 contributors and audited 136 packages in 54.314s

7 packages are looking for funding run npm fund for details

found 0 vulnerabilities

pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ pm2 restart 0 `

sdetweil commented 3 years ago

can u open the developers window

ctrl-shift-i, and select the console tab

but its probably because of the collector failing

cd modules/MMM-Config

./test_convert.sh override

sdetweil commented 3 years ago

also, because you are using pm2,

pm2 flush pm2 restart 0

then pm2 logs --lines=100 >somefile.txt

attach somefile.txt and then


cd ~/MagicMirror/modules/MMM-Config
node scripts/buildschema4.js ../defaults.js debug >somefile2.txt

and attach somefile2.txt

thanks
fireport commented 3 years ago

There are a lot of errors. Good Hunting ;-) somefile.txt

sdetweil commented 3 years ago

ok, this looks good, I don't see any errors in the error side, that match the timestamp (you didn't pm2 flush to empty the logs)

     | [2021-06-03 19:55:28.493] [INFO]   Checking git for module: MMM-DarkSkyForecast
0|mm       | [2021-06-03 19:55:28.535] [INFO]   Checking git for module: MMM-MyGarbage
0|mm       | [2021-06-03 19:55:28.578] [INFO]   Checking git for module: MMM-Tado
0|mm       | [2021-06-03 19:55:28.619] [INFO]   Checking git for module: MMM-COVID19-SPARKLINE
0|mm       | [2021-06-03 19:55:28.666] [INFO]   Checking git for module: MMM-Carousel
0|mm       | [2021-06-03 19:55:28.716] [LOG]     got port=8300   <------
0|mm       | [2021-06-03 19:55:29.561] [LOG]        - MMM-Tado: Checking if all data is present
0|mm       | [2021-06-03 19:55:29.562] [LOG]        - MMM-Tado: Not all data present
0|mm       | [2021-06-03 19:55:32.434] [INFO]   Newsfeed-Fetcher: Broadcasting 116 items.
0|mm       | [2021-06-03 19:55:32.493] [LOG]        - MMM-Tado: Checking if all data is present
0|mm       | [2021-06-03 19:55:32.494] [LOG]        - MMM-Tado: Not all data present
0|mm       | [2021-06-03 19:55:33.182] [INFO]   Calendar-Fetcher: Broadcasting 4 events.
0|mm       | [2021-06-03 19:55:33.334] [INFO]   Newsfeed-Fetcher: Broadcasting 12 items.
0|mm       | [2021-06-03 19:55:33.480] [LOG]        - MMM-Tado: Logged in
0|mm       | [2021-06-03 19:55:34.002] [LOG]        - MMM-Tado: Checking if all data is present
0|mm       | [2021-06-03 19:55:34.007] [LOG]        - MMM-Tado: Not all data present
0|mm       | [2021-06-03 19:55:34.126] [INFO]   Calendar-Fetcher: Broadcasting 4 events.
0|mm       | [2021-06-03 19:55:34.214] [INFO]   Calendar-Fetcher: Broadcasting 10 events.
0|mm       | [2021-06-03 19:55:34.706] [LOG]        - MMM-Tado: Got me()
0|mm       | [2021-06-03 19:55:34.716] [LOG]        - MMM-Tado: Got homes()
0|mm       | [2021-06-03 19:55:35.018] [LOG]        - MMM-Tado: Checking if all data is present
0|mm       | [2021-06-03 19:55:35.019] [LOG]        - MMM-Tado: Not all data present
0|mm       | [2021-06-03 19:55:35.079] [LOG]        - MMM-Tado: Got zones()
0|mm       | [2021-06-03 19:55:35.817] [LOG]    [COVID:CORE] Access to data source.
0|mm       | [2021-06-03 19:55:36.972] [LOG]        - MMM-Tado: Checking if all data is present
0|mm       | [2021-06-03 19:55:36.975] [LOG]        - MMM-TADO: All data is present
0|mm       | [2021-06-03 19:55:37.792] [LOG]    [COVID:CORE] Resolving: csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv
0|mm       | [2021-06-03 19:55:39.418] [LOG]    [COVID:CORE] Resolving: csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv
0|mm       | [2021-06-03 19:55:40.450] [LOG]    [COVID:CORE] Resolving: csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv
0|mm       | [2021-06-03 19:55:40.598] [LOG]    can't find property recovered Canada:
0|mm       | [2021-06-03 19:55:40.599] [LOG]    adding...
0|mm       | [2021-06-03 19:55:41.194] [LOG]    [COVID:CORE] Calculating Wordlwide total.
0|mm       | [2021-06-03 19:55:41.654] [LOG]    [COVID:CORE] Scan Completed.
0|mm       | [2021-06-03 19:57:19.716] [LOG]    stdout: completed   <------
0|mm       | 
0|mm       | [2021-06-03 19:59:48.558] [LOG]    Shutting down server...
0|mm       | [2021-06-03 19:59:48.562] [LOG]    

so, now lets open the developers window, ctrl-shift-i, and select the console tab. also look at the module folder, schema3.json.. it is the thing that creates the form

fireport commented 3 years ago

Dear @sdetweil sorry for the delay but I was busy in the last few days. Unfortunately, I have the same problem even with the last release. I'm starting to thinking that is a problem with my specific configuration.

sdetweil commented 3 years ago

can u open the developers window and look at the console? see instructions on my prior post.. no rush.. whenever u have time

fireport commented 3 years ago

Screenshot_2021-06-08_16-58-15

sdetweil commented 3 years ago

can't be socket 8200, has to be 8300 or higher..
please hit f5 for refresh

fireport commented 3 years ago

I completely switch browser (now EDGE) but I always see port 8200 Cattura

sdetweil commented 3 years ago

you have old code,

cd ~/MagicMirror/modules/MMM-Config
git pull 
git checkout main
npm install

then try again

fireport commented 3 years ago

I'm already on the last version `pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ cd ~/MagicMirror/modules/MMM-Config pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ git pull Already up to date. pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ git checkout main Already on 'main' Your branch is up to date with 'origin/main'. pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ npm install

mmm-config@1.0.0 postinstall /home/pi/MagicMirror/modules/MMM-Config node exec_script.js ./postinstall:postinstall.cmd

copying git pre-commit hook

npm WARN mmm-config@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

audited 136 packages in 15.225s

7 packages are looking for funding run npm fund for details

found 0 vulnerabilities

`

sdetweil commented 3 years ago

for the future that ~ char at the front means users_home, same as /home/pi

cd ~/MagicMirror/modules/MMM-Config

if u remove it then its ROOT /MagicMirror... does NOT exist

weird, I JUST updated yesterday

ok, lets check

ls ~/MagicMirror/modules/MMM-Config/scripts

fireport commented 3 years ago

pi@raspberrypi:~/MagicMirror/modules/MMM-Config$ ls ~/MagicMirror/modules/MMM-Config/scripts buildschema3.js buildschema4.js dumpdefaults.js

sdetweil commented 3 years ago

ok, then u should have the latest , and review link should take you to 8300 or above

http://localhost:MM_port/modules/MMM_Config/review

fireport commented 3 years ago

yes,it is Cattura

sdetweil commented 3 years ago

is there a way we could setup a time for me to teamviewer to a PC with chrome using the form.

sdetweil commented 3 years ago

no response