NorthernMan54 / node-red-contrib-homebridge-automation

Homebridge and Node-RED Integration
Apache License 2.0
107 stars 18 forks source link

Event logs are displayed as error #95

Open skavinvarnan opened 2 years ago

skavinvarnan commented 2 years ago

I'm running node-red on pm2, on my Raspberry Pi Zero. Its runs on a SD card. So I want to eliminate logs as much as possible. But I see on pm2 error logs and I see lots of events logs present there.

Here are the logs

/root/.pm2/logs/node-red-error.log last 15 lines:
1|node-red | 2021-08-20T03:52:35.230Z hapNodeRed Controlled 0E:46:A1:58:31:C9 -> { On: 1 }
1|node-red | 2021-08-20T03:52:36.462Z hapNodeJSClient Events [{"host":"192.168.68.220","port":51154,"deviceID":"0E:46:A1:58:31:C9","aid":8,"iid":10,"value":1,"status":true}]
1|node-red | 2021-08-20T03:52:36.467Z hapNodeRed hbEvent Light Trigger {
1|node-red |   host: '192.168.68.220',
1|node-red |   port: 51154,
1|node-red |   deviceID: '0E:46:A1:58:31:C9',
1|node-red |   aid: 8,
1|node-red |   iid: 10,
1|node-red |   value: 1,
1|node-red |   status: true
1|node-red | }
1|node-red | 2021-08-20T03:52:36.499Z hapNodeRed _status request: Tube light - Lightbulb -> 0E:46:A1:58:31:C9:?id=3.10,3.11,3.12 ->
1|node-red | 2021-08-20T03:52:36.590Z hapNodeRed hbStatus received: "Tube light - Lightbulb" = {"characteristics":[{"aid":3,"iid":10,"value":1},{"aid":3,"iid":11,"value":5},{"aid":3,"iid":12,"value":232}]}
1|node-red | 2021-08-20T03:52:36.617Z hapNodeRed Control 0E:46:A1:58:31:C9 -> {"characteristics":[{"aid":3,"iid":10,"value":0}]}
1|node-red | 2021-08-20T03:52:36.999Z hapNodeRed Controlled 0E:46:A1:58:31:C9 -> { On: 0 }

1|node-red  | 2021-08-20T03:53:14.319Z hapNodeJSClient Events [{"host":"192.168.68.220","port":51154,"deviceID":"0E:46:A1:58:31:C9","aid":9,"iid":10,"value":1,"status":true}]
1|node-red  | 2021-08-20T03:53:14.324Z hapNodeRed hbEvent Fan Trigger {
1|node-red  |   host: '192.168.68.220',
1|node-red  |   port: 51154,
1|node-red  |   deviceID: '0E:46:A1:58:31:C9',
1|node-red  |   aid: 9,
1|node-red  |   iid: 10,
1|node-red  |   value: 1,
1|node-red  |   status: true
1|node-red  | }
1|node-red  | 2021-08-20T03:53:14.411Z hapNodeRed _status request: Fan - Switch -> 0E:46:A1:58:31:C9:?id=15.11,15.12,15.13,15.14,15.10 ->
1|node-red  | 2021-08-20T03:53:14.491Z hapNodeRed hbStatus received: "Fan - Switch" = {"characteristics":[{"aid":15,"iid":11,"value":1},{"aid":15,"iid":12,"value":19},{"aid":15,"iid":13,"value":0.2},{"aid":15,"iid":14,"value":237},{"aid":15,"iid":10,"value":1}]}
1|node-red  | 2021-08-20T03:53:14.526Z hapNodeRed Control 0E:46:A1:58:31:C9 -> {"characteristics":[{"aid":15,"iid":10,"value":0}]}
1|node-red  | 2021-08-20T03:53:16.339Z hapNodeRed Controlled 0E:46:A1:58:31:C9 -> { On: 0 }
1|node-red  | 2021-08-20T03:53:16.999Z hapNodeJSClient Events [{"host":"192.168.68.220","port":51154,"deviceID":"0E:46:A1:58:31:C9","aid":9,"iid":10,"value":0,"status":true}]
1|node-red  | 2021-08-20T03:53:17.000Z hapNodeRed hbEvent Fan Trigger {
1|node-red  |   host: '192.168.68.220',
1|node-red  |   port: 51154,
1|node-red  |   deviceID: '0E:46:A1:58:31:C9',
1|node-red  |   aid: 9,
1|node-red  |   iid: 10,
1|node-red  |   value: 0,
1|node-red  |   status: true
1|node-red  | }
1|node-red  | 2021-08-20T03:53:17.077Z hapNodeRed _status request: Fan - Switch -> 0E:46:A1:58:31:C9:?id=15.11,15.12,15.13,15.14,15.10 ->
1|node-red  | 2021-08-20T03:53:17.143Z hapNodeRed hbStatus received: "Fan - Switch" = {"characteristics":[{"aid":15,"iid":11,"value":1},{"aid":15,"iid":12,"value":19},{"aid":15,"iid":13,"value":0.2},{"aid":15,"iid":14,"value":237},{"aid":15,"iid":10,"value":0}]}
1|node-red  | 2021-08-20T03:53:17.184Z hapNodeRed Control 0E:46:A1:58:31:C9 -> {"characteristics":[{"aid":15,"iid":10,"value":1}]}
1|node-red  | 2021-08-20T03:53:17.454Z hapNodeRed Controlled 0E:46:A1:58:31:C9 -> { On: 1 }
1|node-red  | 2021-08-20T03:53:28.116Z hapNodeJSClient Events [{"host":"192.168.68.220","port":51154,"deviceID":"0E:46:A1:58:31:C9","aid":8,"iid":14,"value":236,"status":true}]
1|node-red  | 2021-08-20T03:53:28.134Z hapNodeRed hbEvent Light Trigger {
1|node-red  |   host: '192.168.68.220',
1|node-red  |   port: 51154,
1|node-red  |   deviceID: '0E:46:A1:58:31:C9',
1|node-red  |   aid: 8,
1|node-red  |   iid: 14,
1|node-red  |   value: 236,
1|node-red  |   status: true
1|node-red  | }
1|node-red  | 2021-08-20T03:53:28.921Z hapNodeJSClient Events [{"host":"192.168.68.220","port":51154,"deviceID":"0E:46:A1:58:31:C9","aid":14,"iid":14,"value":237,"status":true}]
1|node-red  | 2021-08-20T03:53:28.932Z hapNodeRed hbEvent Light {
1|node-red  |   host: '192.168.68.220',
1|node-red  |   port: 51154,
1|node-red  |   deviceID: '0E:46:A1:58:31:C9',
1|node-red  |   aid: 14,
1|node-red  |   iid: 14,
1|node-red  |   value: 237,
1|node-red  |   status: true
1|node-red  | }
1|node-red  | 2021-08-20T03:53:30.260Z hapNodeJSClient Events [{"host":"192.168.68.220","port":51154,"deviceID":"0E:46:A1:58:31:C9","aid":9,"iid":14,"value":236,"status":true}]
1|node-red  | 2021-08-20T03:53:30.275Z hapNodeRed hbEvent Fan Trigger {
1|node-red  |   host: '192.168.68.220',
1|node-red  |   port: 51154,
1|node-red  |   deviceID: '0E:46:A1:58:31:C9',
1|node-red  |   aid: 9,
1|node-red  |   iid: 14,
1|node-red  |   value: 236,
1|node-red  |   status: true
1|node-red  | }

These are all events logs, can we not log them as errors?

NorthernMan54 commented 2 years ago

Do you have the DEBUG option enabled? These message appear to be DEBUG messages from the package.

On Aug 20, 2021, at 12:55 AM, Kavin Varnan @.***> wrote:

hbEvent

skavinvarnan commented 2 years ago

No I don't run node-red on debug mode. Here is my pm2 script.

module.exports = {
  apps : [{
    name   : "Node Red",
    script : "node-red",
    node_args: '--max-old-space-size=128',
    out_file: "/var/log/nrout.log",
    error_file: "/var/log/nrerr.log"
  }]
}

I also did check your code. https://github.com/NorthernMan54/node-red-contrib-homebridge-automation/blob/master/HAP-NodeRed.js#L183. Its getting printed as debug log.

But still I'm seeing the logs as error on pm2 🤔

NorthernMan54 commented 2 years ago

This is definitely something in your PM2 config and setup, did you try googling it for a fix? Somewhere in the environment that your starting node-red from DEBUG is being enabled.

Also this is the debug package, https://www.npmjs.com/package/debug, which does use console.error