seydx / homebridge-camera-ui

Homebridge plugin for RTSP Cameras with HSV, motion detection support, Image Rekognition, Web UI to manage/watch streams and WebApp support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RangeError: Invalid time value

l3zha opened this issue · comments

commented

Why? Every 5 minute(
Logs
[29.06.2023, 17:09:40] [CameraUI] Tapo: Motion ON
[29.06.2023, 17:09:55] [CameraUI] Tapo: Motion OFF - Motion handler timeout.
[29.06.2023, 17:10:02] [CameraUI] Tapo: Closing recording process
[29.06.2023, 17:10:04] [Homebridge UI] Starting terminal session
[29.06.2023, 17:10:19] RangeError: Invalid time value
at Date.toISOString ()
at parseElapsedTime (/var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:107:14)
at parseLine (/var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:572:31)
at /var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:663:23
at Array.forEach ()
at parseProcesses (/var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:661:13)
at /var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:736:30
at ChildProcess.exithandler (node:child_process:411:7)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

[29.06.2023, 17:10:19] Got SIGTERM, shutting down Homebridge...
[29.06.2023, 17:10:19] [CameraUI] VIDEOANALYSIS: New message: Data: {"time":"2023-06-29T11:10:19.318Z","event":"killed"} - Motion: resetted - Camera: Tapo
[29.06.2023, 17:10:24] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[29.06.2023, 17:10:29] [HB Supervisor] Restarting Homebridge...
[29.06.2023, 17:10:29] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[29.06.2023, 17:10:29] [HB Supervisor] Started Homebridge v1.6.1 with PID: 938661
[29.06.2023, 17:10:29] Loaded config.json with 0 accessories and 2 platforms.
[29.06.2023, 17:10:30] Loaded 0 cached accessories from cachedAccessories.
[29.06.2023, 17:10:30] ---
[29.06.2023, 17:10:30] Loaded plugin: homebridge-camera-ui@5.0.27
[29.06.2023, 17:10:30] Registering platform 'homebridge-camera-ui.CameraUI'
[29.06.2023, 17:10:30] ---
[29.06.2023, 17:10:30] Loading 2 platforms...
[29.06.2023, 17:10:30] [CameraUI] Initializing CameraUI platform...
[29.06.2023, 17:10:30] [CameraUI] Config changed through interface, saving...
Setup Payload:

Environment

  • Node.js Version: v18.16.0
  • Homebridge Version: v4.50.4
  • Camera UI Version: v5.0.27
  • Operating System: Debian
commented

{
"name": "CameraUI",
"port": 8081,
"atHomeSwitch": false,
"logLevel": "info",
"mqtt": {
"active": false,
"tls": false,
"port": 1883
},
"http": {
"active": false,
"port": 7272,
"localhttp": false
},
"smtp": {
"active": false,
"port": 2727,
"space_replace": "+"
},
"ftp": {
"active": false,
"useFile": false,
"port": 5050
},
"ssl": {
"active": false
},
"options": {
"videoProcessor": "ffmpeg"
},
"cameras": [
{
"name": "Tapo",
"manufacturer": "Tp-Link",
"model": "TC65",
"serialNumber": "TapoTC65",
"excludeSwitch": false,
"motion": false,
"doorbell": true,
"switches": true,
"motionTimeout": 15,
"unbridge": true,
"hsv": true,
"prebuffering": true,
"prebufferLength": 8,
"hksvConfig": {
"source": "-rtsp_transport tcp -i rtsp://ip/stream1",
"audio": true
},
"videoConfig": {
"source": "-rtsp_transport tcp -i rtsp://ip/stream1",
"subSource": "-rtsp_transport tcp -i rtsp://ip/stream2",
"stillImageSource": "-rtsp_transport tcp -i rtsp://*ip/stream1",
"vcodec": "copy",
"acodec": "libfdk_aac",
"audio": true,
"debugReturn": false
},
"smtp": {
"email": "Tapo"
},
"videoanalysis": {
"active": true
},
"mqtt": {}
}
],
"platform": "CameraUI"
}

I got the same Error:

[7/13/2023, 4:14:43 PM] [CameraUI] Schuppen: Configuring unbridged accessory...
[7/13/2023, 4:14:43 PM] [CameraUI] Schuppen: Setting up accessory...
[7/13/2023, 4:14:43 PM] [CameraUI] Accessories refreshed and config.json saved!
[7/13/2023, 4:14:43 PM] Publishing external accessory (name: Schuppen, publishInfo: {
  username: '2B:A9:BA:42:9E:52',
  pincode: '***-**-***',
  category: 17,
  port: undefined,
  bind: [ 'eth0', [length]: 1 ],
  mdns: undefined,
  addIdentifyingMaterial: true,
  advertiser: 'bonjour-hap'
}).
[7/13/2023, 4:14:43 PM] Schuppen 9277 is running on port 38319.
[7/13/2023, 4:14:43 PM] Please add [Schuppen 9277] manually in Home app. Setup Code: 111-22-444
[7/13/2023, 4:14:45 PM] [CameraUI] Schuppen: Setting up camera, please be patient...
[7/13/2023, 4:14:45 PM] RangeError: Invalid time value
    at Date.toISOString (<anonymous>)
    at parseElapsedTime (/var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:107:14)
    at parseLine (/var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:572:31)
    at /var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:663:23
    at Array.forEach (<anonymous>)
    at parseProcesses (/var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:661:13)
    at /var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js:736:30
    at ChildProcess.exithandler (node:child_process:411:7)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
[7/13/2023, 4:14:45 PM] Got SIGTERM, shutting down Homebridge...
[7/13/2023, 4:14:50 PM] [CameraUI] camera.ui v5.0.27 is listening on port 8081 (http)
[7/13/2023, 4:14:50 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[7/13/2023, 4:14:55 PM] [HB Supervisor] Restarting Homebridge...

My Homebridge runs on Proxmox in an Debian 12 LXC container.

my config
{
    "bridge": {
        "name": "Homebridge",
        "username": "0E:9B:AD:5E:36:C8",
        "port": 51927,
        "pin": "111-22-444",
        "advertiser": "bonjour-hap",
        "bind": [
            "eth0"
        ]
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "auto",
            "tempUnits": "c",
            "lang": "auto",
            "proxyHost": "bridge.domain",
            "platform": "config"
        },
        {
            "devices": [
        {
            "name": "CameraUI",
            "port": 8081,
            "logLevel": "info",
            "mqtt": {
                "active": false,
                "tls": false,
                "port": 1883
            },
            "http": {
                "active": false,
                "port": 7272,
                "localhttp": false
            },
            "smtp": {
                "active": false,
                "port": 2727,
                "space_replace": "+"
            },
            "ftp": {
                "active": false,
                "useFile": false,
                "port": 5050
            },
            "ssl": {
                "active": false,
                "key": "/ssl/home.key",
                "cert": "/ssl/home.cert"
            },
            "cameras": [
                {
                    "name": "Schuppen",
                    "manufacturer": "reolink",
                    "model": "RLC-510WA",
                    "serialNumber": "",
                    "motion": true,
                    "motionTimeout": 15,
                    "unbridge": true,
                    "hsv": true,
                    "prebuffering": true,
                    "prebufferLength": 4,
                    "hksvConfig": {
                        "source": "-i rtsp://admin:pass@192.168.178.7:554",
                        "maxWidth": 1920,
                        "maxHeight": 1080,
                        "maxFPS": 20,
                        "maxBitrate": 2048,
                        "audio": true
                    },
                    "videoConfig": {
                        "source": "-i rtsp://admin:pass@192.168.178.7:554",
                        "subSource": "-i rtsp://admin:pass@192.168.178.7:554",
                        "stillImageSource": "-i rtsp://admin:pass@192.168.178.7:554",
                        "maxFPS": 20,
                        "vcodec": "copy",
                        "acodec": "libfdk_aac",
                        "audio": true
                    },
                    "smtp": {
                        "email": "Schuppen"
                    },
                    "videoanalysis": {
                        "active": true
                    },
                    "mqtt": {}
                }
            ],
            "platform": "CameraUI",
            "atHomeSwitch": false,
            "options": {
                "videoProcessor": "/usr/local/bin/ffmpeg"
            }
        }
    ],
    "disabledPlugins": []
}

I installed ffmpeg-for-homebridge manually after it wasn't installed with the backup from another machine:

sudo curl -Lf# https://github.com/homebridge/ffmpeg-for-homebridge/releases/latest/download/ffmpeg-debian-$(uname -m).tar.gz | sudo tar xzf - -C / --no-same-owner

I think I found the solution. The bug is not in camera-ui, but in the node.js library systeminformation.
My easy fix was to just copy some lines from the current version on Github and paste them into var/lib/homebridge/node_modules/homebridge-camera-ui/node_modules/systeminformation/lib/processes.js as replacement of the function in line 107.

The better solution would be to just update the library, but I have no idea how to do that. I'm more the Python-Guy.
Hopefully this solves also the problem for you @l3zha!

commented

Danke so geht es bei mir jetzt auch

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

same issue here, ill try your fix @Bergruebe

What is interesting is that i have the EXACT same initial parameters as you
installed on proxmox and is a backup of a previous install with the added ffmpeg for homebridge install

I've tried to do a more "NodeJS" approach by executing "npm update" inside the CameraUI directory
cd var/lib/homebridge/node_modules/homebridge-camera-ui/ ; npm update

It seems that my systeminformation lib is up to the latest version now, ill see how this goes