Git Product home page Git Product logo

node-red-contrib-home-assistant-discovery's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

diemade nstadigs

node-red-contrib-home-assistant-discovery's Issues

Nodered crashing after Typeerror; Am I doing it wrong?

pi@raspberrypi:~ $ node -v
v16.19.0
pi@raspberrypi:~ $ npm -v
8.19.3

Node-red version 3.0.2

So this is the flow i am trying to do (similar to one of the examples):

[
    {
        "id": "8cd3a6b74dd73dcb",
        "type": "ha-discovery-out",
        "z": "f97c15c91ed475df",
        "name": "Zimmer",
        "server": "3a9b250ba5d6b411",
        "dev_id": "zigbee2mqtt_0x00124b0024cb2366",
        "uniq_id": "0x00124b0024cb2366_switch_zigbee2mqtt",
        "qos": "0",
        "retain": "false",
        "payload": "payload",
        "payload_type": "msg",
        "x": 500,
        "y": 340,
        "wires": []
    },
    {
        "id": "c30268b42210b258",
        "type": "inject",
        "z": "f97c15c91ed475df",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "ON",
        "payloadType": "str",
        "x": 270,
        "y": 320,
        "wires": [
            [
                "8cd3a6b74dd73dcb"
            ]
        ]
    },
    {
        "id": "f2225d4772bee672",
        "type": "inject",
        "z": "f97c15c91ed475df",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "OFF",
        "payloadType": "str",
        "x": 270,
        "y": 380,
        "wires": [
            [
                "8cd3a6b74dd73dcb"
            ]
        ]
    },
    {
        "id": "3a9b250ba5d6b411",
        "type": "ha-discovery",
        "name": "",
        "server": "bff4588a2c004522",
        "topic": "homeassistant/#"
    },
    {
        "id": "bff4588a2c004522",
        "type": "mqtt-broker",
        "name": "local broker",
        "broker": "127.0.0.1",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

The flow can be deployed, but whe triggering one of the Injectors, it sucesfully publishes to mqtt, but crashes node-red as a whole. This is the commad line output:

Welcome to Node-RED
23 Feb 23:58:08 - [info] Node-RED version: v3.0.2
23 Feb 23:58:08 - [info] Node.js version: v16.19.0
23 Feb 23:58:08 - [info] Linux 5.10.103+ arm LE
23 Feb 23:58:24 - [info] Loading palette nodes
23 Feb 23:58:45 - [info] Settings file : /home/pi/.node-red/settings.js
23 Feb 23:58:46 - [info] Context store : 'default' [module=memory]
23 Feb 23:58:46 - [info] User directory : /home/pi/.node-red
23 Feb 23:58:46 - [info] Projects directory: /home/pi/.node-red/projects
23 Feb 23:58:48 - [info] Server now running at http://127.0.0.1:1880/
23 Feb 23:58:48 - [info] Active project : pi
23 Feb 23:58:48 - [info] Flows file : /home/pi/.node-red/projects/pi/flow.json
23 Feb 23:58:48 - [warn] Using unencrypted credentials
23 Feb 23:58:48 - [info] Starting flows
23 Feb 23:58:50 - [info] Started flows
23 Feb 23:58:51 - [info] [mqtt-broker:local broker] Connected to broker: mqtt://127.0.0.1:1883
23 Feb 23:58:51 - [info] [ha-discovery:discovery @ local broker] MQTT fetch devices ...
23 Feb 23:59:14 - [red] Uncaught Exception:
23 Feb 23:59:14 - [error] TypeError: Cannot convert undefined or null to object
at Function.keys ()
at getKeyByValue (/home/pi/.node-red/node_modules/node-red-contrib-home-assistant-discovery/nodes/server.js:158:14)
at /home/pi/.node-red/node_modules/node-red-contrib-home-assistant-discovery/nodes/server.js:162:19
at Array.some ()
at getKeyByValue (/home/pi/.node-red/node_modules/node-red-contrib-home-assistant-discovery/nodes/server.js:158:24)
at /home/pi/.node-red/node_modules/node-red-contrib-home-assistant-discovery/nodes/server.js:183:23
at Array.forEach ()
at MqttClient.onMessage (/home/pi/.node-red/node_modules/node-red-contrib-home-assistant-discovery/nodes/server.js:181:22)
at MqttClient.emit (node:events:513:28)
at MqttClient._handlePublish (/usr/lib/node_modules/node-red/node_modules/mqtt/lib/client.js:1547:12)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=20s expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 15.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
23 Feb 23:59:54 - [info]
Welcome to Node-RED
23 Feb 23:59:54 - [info] Node-RED version: v3.0.2
23 Feb 23:59:54 - [info] Node.js version: v16.19.0
23 Feb 23:59:54 - [info] Linux 5.10.103+ arm LE
24 Feb 00:00:11 - [info] Loading palette nodes
24 Feb 00:00:33 - [info] Settings file : /home/pi/.node-red/settings.js
24 Feb 00:00:33 - [info] Context store : 'default' [module=memory]
24 Feb 00:00:33 - [info] User directory : /home/pi/.node-red
24 Feb 00:00:33 - [info] Projects directory: /home/pi/.node-red/projects
24 Feb 00:00:34 - [info] Server now running at http://127.0.0.1:1880/
24 Feb 00:00:35 - [info] Active project : pi
24 Feb 00:00:35 - [info] Flows file : /home/pi/.node-red/projects/pi/flow.json
24 Feb 00:00:35 - [warn] Using unencrypted credentials
24 Feb 00:00:36 - [info] Starting flows
24 Feb 00:00:38 - [info] Started flows
24 Feb 00:00:38 - [info] [mqtt-broker:local broker] Connected to broker: mqtt://127.0.0.1:1883
24 Feb 00:00:38 - [info] [ha-discovery:discovery @ local broker] MQTT fetch devices ...

Help please.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.