Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug mode fails to open alexaDiscovery.json #620

Open
dazzlee42 opened this issue Apr 19, 2024 · 3 comments
Open

Debug mode fails to open alexaDiscovery.json #620

dazzlee42 opened this issue Apr 19, 2024 · 3 comments
Labels

Comments

@dazzlee42
Copy link

Analysis

Hi, Just updated to v0.6.9 and I have debug turned on for the plugin. Restarted homebridge and after a few seconds it restarts. I managed to disable the plugin and check the logs. Seems it is now trying to save out to alexaDiscovery.json when in debug mode and failing.

Expected Behavior

Don't crash ;-) Save the file to a known location.

Steps To Reproduce

Enable debug, restart.

Logs

[19/04/2024, 12:36:25] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge) is running on port 51826.
[19/04/2024, 12:36:25] [BraviaPlatform] Loaded cookie file from /home/dkeverne/.homebridge/plugin-persist/homebridge-bravia/sonycookie_Lounge TV
2024-04-19T11:36:26.360Z alexaLocal connect mqtts://alexa.homebridge.ca:8883/ command/dazzlee69/#
2024-04-19T11:36:26.811Z hapNodeJSClient HAP Device discovered Homebridge CAD8 [ '127.0.0.1', '::1' ]
[19/04/2024, 12:36:28] [Homebridge UI] Homebridge UI v4.56.1 is listening on :: port 8080
[19/04/2024, 12:36:30] [homebridge-sonoff] This plugin slows down Homebridge. The read handler for the characteristic 'On' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
2024-04-19T11:36:30.232Z hapNodeJSClient Homebridge instance discovered Homebridge CAD8 @ http://127.0.0.1:51826 with 34 accessories
dkeverne : TTY=pts/0 ; PWD=/home/dkeverne/.homebridge ; USER=root ; COMMAND=/usr/bin/journalctl -o cat -n 500 -f -u homebridge
pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
2024-04-19T11:36:45.613Z hapNodeJSClient Ready
2024-04-19T11:36:45.614Z alexaActions alexaDiscovery
[19/04/2024, 12:36:45] [Alexa] alexaDiscovery - returned 32 devices
[19/04/2024, 12:36:45] Error: EACCES: permission denied, open 'alexaDiscovery.json'
    at Object.openSync (node:fs:596:3)
    at Object.writeFileSync (node:fs:2322:35)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge-alexa/lib/alexaActions.js:141:10)
    at HAPNodeJSClient.HAPaccessories (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/HAPNodeJSClient.js:245:3)
    at Object.alexaDiscovery (/usr/lib/node_modules/homebridge-alexa/lib/alexaActions.js:92:14)
    at HAPNodeJSClient.<anonymous> (/usr/lib/node_modules/homebridge-alexa/lib/alexaActions.js:36:20)
    at HAPNodeJSClient.emit (node:events:517:28)
    at HAPNodeJSClient.<anonymous> (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/HAPNodeJSClient.js:119:10)
    at Timeout._onTimeout (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/HAPNodeJSClient.js:199:7)
    at listOnTimeout (node:internal/timers:569:17)
    at processTimers (node:internal/timers:512:7)
[19/04/2024, 12:36:45] Got SIGTERM, shutting down Homebridge...
homebridge.service: Main process exited, code=exited, status=143/n/a
homebridge.service: Failed with result 'exit-code'.

Configuration

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-155",
        "advertiser": "ciao"
    },
    "description": "Homebridge on ananke",
    "ports": {
        "start": 52100,
        "end": 52250,
        "comment": "This section is used to control the range of ports that separate accessory (like camera or television) should be bind to."
    },
    "platforms": [
        {
            "name": "Config",
            "port": 8080,
            "auth": "none",
            "theme": "teal",
            "restart": "sudo -n systemctl restart homebridge",
            "sudo": true,
            "log": {
                "method": "systemd",
                "service": "homebridge"
            },
            "platform": "config"
        },
        {
            "name": "Alexa",
            "username": "dazzlee69",
            "password": "L3tm3Br1dge",
            "pin": "031-45-155",
            "debug": false,
            "refresh": 900,
            "keepalive": 5,
            "CloudTransport": "mqtts",
            "deviceListHandling": "none",
            "platform": "Alexa"
        },

... <other platforms removed> ...

}

Environment

  • OS: Ubuntu 22.04.4
  • Software: v1.7.0
  • Node: v18.20.2
  • npm: 10.5.0

Process Supervisor

hb-service

Additional Context

No response

@dazzlee42 dazzlee42 added the bug label Apr 19, 2024
@dazzlee42
Copy link
Author

Note, turning off debug, bypasses the code trying to open the file, so I'm back and working. Not sure what debug was giving me, would be good to get this working with debug and have the json files to review. Thanks

@NorthernMan54
Copy link
Owner

That option is saving a copy of your configuration that was shared with Amazon alexa to aid in debugging a users setup. The file is written to the current directory from which homebridge was installed, and assumes that the directory is writable. Do you need debug enabled for something ?

@dazzlee42
Copy link
Author

Hi, not specifically, but I normally run with debug on, just in case. Was this changed, as it was not crashing before. Shouldn't it save to the config directory, where all the other plugins save to? Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants