schris88 / MMM-Hoymiles-Wifi

GNU General Public License v3.0
1 stars 1 forks source link

Cannot get the module to run. #2

Closed evroom closed 1 week ago

evroom commented 1 week ago

Hi,

You are using the module name MMM-Hoymiles-Wifi, but then in the config it is called MMM-HTMLSnippet. This is confusing, but also does not work on my Raspberry Pi:

{
  module: "MMM-HTMLSnippet",
  position: "top_left",
  config: {
    width: "180px",
    height: "100px",
    updateInterval: 60000, // in milli seconds
    frames : [
      { src: 'http://127.0.0.1:5000' },
    ]
  },
},
0|MagicMirror  | [2024-11-05 18:40:33.058] [WARN]  No /home/admin/MagicMirror/js/../modules/MMM-HTMLSnippet/MMM-HTMLSnippet.js found for module: MMM-HTMLSnippet.
0|MagicMirror  | [2024-11-05 18:40:33.059] [LOG]   No helper found for module: MMM-HTMLSnippet.
$ ls -als /home/admin/MagicMirror/js/../modules/MMM-HTMLSnippet/MMM-HTMLSnippet.js
ls: cannot access '/home/admin/MagicMirror/js/../modules/MMM-HTMLSnippet/MMM-HTMLSnippet.js': No such file or directory

Tried to change the module name:

{
  module: "MMM-Hoymiles-Wifi",
  position: "top_left",
  config: {
    width: "180px",
    height: "100px",
    updateInterval: 60000, // in milli seconds
    frames : [
      { src: 'http://127.0.0.1:5000' },
    ]
  },
},

0|MagicMirror | [2024-11-05 19:09:02.012] [WARN] No /home/admin/MagicMirror/js/../modules/MMM-Hoymiles-Wifi/MMM-Hoymiles-Wifi.js found for module: MMM-Hoymiles-Wifi.

It seems that module name and js file need to be the same. And it makes more sense too.

Could you please have a look at this ?

admin@BlackPi4b:~ $ cat /proc/cpuinfo | egrep '^model name|^Hardware|^Revision|^Model' | sort -u
Model       : Raspberry Pi 4 Model B Rev 1.5
Revision    : d03115

admin@BlackPi4b:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:    12
Codename:   bookworm
schris88 commented 1 week ago

Need to try that out, not using the repo myself but my hacked together version for now :D I think it´s determined in Module.register("MMM-HTMLSnippet" should still be the correct name, pls try running "npm install" in the root folder after clone

EDIT: I changed the name to MMM-Hoymiles-Wifi everywhere I found it and updated the readme, didnt test for now

evroom commented 1 week ago

I tried running npm install in the ~/MagicMirror/modules/MMM-Hoymiles-Wifi directory, but no change. If I recall it right, then this is only necessary if your module uses a package.json file.

I think you are right about Module.register("MMM-HTMLSnippet", but the path is what it complains about.

0|MagicMirror | [2024-11-05 20:16:40.045] [WARN] No /home/admin/MagicMirror/js/../modules/MMM-HTMLSnippet/MMM-HTMLSnippet.js found for module: MMM-HTMLSnippet.

Now I copied MMM-Hoymiles-Wifi to MMM-HTMLSnippet and come a bit further:

0|MagicMirror  | [2024-11-05 20:32:06.492] [LOG]   Module helper loaded: MMM-HTMLSnippet

0|MagicMirror  | [2024-11-05 20:32:09.895] [INFO]  [main.js:601:8] All modules started!
0|MagicMirror  | [2024-11-05 20:32:10.092] [ERROR] (node:187711) electron: Failed to load URL: http://127.0.0.1:5000/ with error: ERR_CONNECTION_REFUSED

I have

address: "0.0.0.0",
ipWhitelist: [],

so it should be opened. Do not know about port 5000 though, need to check.

schris88 commented 1 week ago

This is my config start, I have my mirror running since last year not sure if I changed it already for some other module

var config = { address: '127.0.0.1', port: 8080, basePath: '/', ipWhitelist: [ '127.0.0.1', '::ffff:127.0.0.1', '::1' ], useHttps: false, httpsPrivateKey: '', httpsCertificate: '', language: 'de', locale: 'de-DE', logLevel: [ 'INFO', 'LOG', 'WARN', 'ERROR' ], timeFormat: 24, units: 'metric', electronOptions: { webPreferences: { webviewTag: true } }, modules: .......

If your inverter is offline because nighttime it will show black text on screen "Unable to get response!"

Make sure the .sh is running otherwise http://127.0.0.1:5000 will be unreachable!

You can test in browser as well with the url http://127.0.0.1:5000 if the flask server is running successfully

schris88 commented 1 week ago

For module name I see folder name, module name and coresponding module-name.js should be same, hope I did that with last changes everywhere

evroom commented 1 week ago

Guten morgen,

I have the module running now, but it does not give a measurement.

MMM-Hoymiles-Wifi 2024-11-06 at 09 22 55

When I run: $ hoymiles-wifi --host 192.168.178.50 get-real-data-new I see that my Hoymiles is active and producing.

In the pm2 log I also see values:

$ pm2 logs HoymilesWifi --lines 100
2|HoymilesWifi  | INFO:werkzeug:127.0.0.1 - - [06/Nov/2024 09:20:39] "GET / HTTP/1.1" 200 -
2|HoymilesWifi  | INFO:werkzeug:127.0.0.1 - - [06/Nov/2024 09:21:39] "GET / HTTP/1.1" 200 -
2|HoymilesWifi  | INFO:werkzeug:127.0.0.1 - - [06/Nov/2024 09:22:39] "GET / HTTP/1.1" 200 -
2|HoymilesWifi  | INFO:werkzeug:127.0.0.1 - - [06/Nov/2024 09:23:39] "GET / HTTP/1.1" 200 -
2|HoymilesWifi  | DTU Response: device_serial_number: "414393499999"
2|HoymilesWifi  | timestamp: 1730880820
2|HoymilesWifi  | active_power: 1
2|HoymilesWifi  | firmware_version: 1
2|HoymilesWifi  | sgs_data {
2|HoymilesWifi  |   serial_number: 22070012499999
2|HoymilesWifi  |   firmware_version: 1
2|HoymilesWifi  |   voltage: 2338
2|HoymilesWifi  |   frequency: 4998
2|HoymilesWifi  |   active_power: 35
2|HoymilesWifi  |   current: 1
2|HoymilesWifi  |   power_factor: 1000
2|HoymilesWifi  |   temperature: 67
2|HoymilesWifi  |   warning_number: 3
2|HoymilesWifi  |   crc_checksum: 28864
2|HoymilesWifi  |   link_status: 1
2|HoymilesWifi  |   modulation_index_signal: 3014884
2|HoymilesWifi  | }
2|HoymilesWifi  | pv_data {
2|HoymilesWifi  |   serial_number: 22070012499999
2|HoymilesWifi  |   port_number: 1
2|HoymilesWifi  |   voltage: 229
2|HoymilesWifi  |   energy_total: 27029
2|HoymilesWifi  |   error_code: 50921472
2|HoymilesWifi  | }
2|HoymilesWifi  | pv_data {
2|HoymilesWifi  |   serial_number: 22070012499999
2|HoymilesWifi  |   port_number: 2
2|HoymilesWifi  |   voltage: 310
2|HoymilesWifi  |   current: 12
2|HoymilesWifi  |   power: 37
2|HoymilesWifi  |   energy_total: 31653
2|HoymilesWifi  |   energy_daily: 2
2|HoymilesWifi  |   error_code: 50331648
2|HoymilesWifi  | }
2|HoymilesWifi  | dtu_power: 35
2|HoymilesWifi  | dtu_daily_energy: 2

Any ideas what it can be and / or how to investigate ??

schris88 commented 1 week ago

I think it´s just too small so you dont see it, open the url in browser and you will see it for the widget change the size in your config width: "300px", height: "320px",

Upcomming issue I see is that I have an inverter with only one input so I´m using the only pv_data object that I have, possibly you get the wrong one, energy_total should be still displayed tho but if current wattage and daily dont appear let me know.

For people with more inputs we should switch to dtu_power and dtu_daily_energy to get the total system power not just from one input. For me that was irrelevant because with only on input its the same

evroom commented 1 week ago

Changed to:

    width: "288px",
    height: "360px",

Now I see the values.