jakubonty / weather_station_mqtt

5 stars 7 forks source link

Configure maserver #1

Open roumano opened 3 years ago

roumano commented 3 years ago

Hi, I'm trying to use this weather_station_mqtt but i'm failed. First, i have a home-assistant core (so without docker ) on a raspberry Debian OS.

if i try to use it on command line (or via a systemd service), it's start, but not working and no log file, no debug information :

/usr/bin/node /opt/weather_station_mqtt/maserver/mobilealerts.js

i'm a not a export of javascript and npm and node and this kind of tool, but i known about system admin, so i have try to enable debug :

/usr/bin/node --report-compact --report-on-fatalerror --report-on-signal --report-uncaught-exception --trace-sync-io --trace-uncaught --trace-warnings /opt/weather_station_mqtt/maserver/mobilealerts.js 
127.0.0.1
::1
192.168.1.15
fe80::9d2:255d:b919:aa4
### Local IP address for proxy: undefined
(node:26781) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
    at showFlaggedDeprecation (buffer.js:191:11)
    at new Buffer (buffer.js:278:3)
    at Object.<anonymous> (/opt/weather_station_mqtt/maserver/mobilealerts.js:170:65)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47
### MQTT server is connected

After that nothing happen (same output when use with systemd server )

jakubonty commented 3 years ago

Hello, this could be a problem: "### Local IP address for proxy: undefined", on plugin configuration tab, did you set field localIPv4Address(it should be same ip address as your HA has)? Also other values should be set.

The output should look like this:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Hello!
v14.16.0
6.14.11
### Local IP address for proxy: 192.168.0.123
(node:202) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Mobile-Alert Gateway : ***********
Name                 : MOBILEALERTS-Gateway
Use DHCP             : true
DHCP IP              : 192.168.0.126
Fixed IP             : 192.168.1.222
DHCP Netmask         : 255.255.255.0
Fixed DNS IP         : 192.168.1.253
Fixed Gateway        : 192.168.1.254
Use Proxy            : true
Proxy Server Name    : 192.168.0.123
Proxy Port           : 8080
Data Server Name     : www.data199.com
### MQTT server is connected
roumano commented 3 years ago

Hi, i don't use any container.

even after change configuration in config.json, when i lunch the node mobilealerts.js, it's not change the ouptut :
( i have try with /opt/weather_station_mqtt/maserver/config.json and /opt/weather_station_mqtt/config.json

root@rasp:~# /opt/weather_station_mqtt/data/run.sh
+ set -e
+ CONFIG_PATH=/opt/weather_station_mqtt/maserver/config.json
+ echo 'Hello!'
Hello!
+ node -v
v12.21.0
+ npm -v
6.14.11
+ node /opt/weather_station_mqtt/maserver/mobilealerts.js
127.0.0.1
::1
192.168.1.15
fe80::9d2:255d:b919:aa4
### Local IP address for proxy: undefined
Error: ENOENT: no such file or directory, open 'lastSensorMessages.json'
    at Object.openSync (fs.js:462:3)
    at Object.readFileSync (fs.js:364:35)
    at Object.<anonymous> (/opt/weather_station_mqtt/maserver/mobilealerts.js:166:30)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'lastSensorMessages.json'
}
### MQTT server is connected
(node:32553) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
jakubonty commented 3 years ago

Hello, it did not take configuration path from env variable CONFIG_PATH, I fixed it. Now it should work.

roumano commented 3 years ago

I have update my local repository but it still not working for me, still not use configuration path or not read configuration file ? (also tested with create a config file on /data/options.json path, it's not used)