This node is a type unknown to your installation of Node-RED

I’m new to NR and having Claude and ChatGPT create code for me, so not sure if that is causing this error? When I import the flows, I get this error on all the nodes except the first (selector) node?

thx

It looks like you don’t have Home Asssistant palette loaded into Node Red. I use Node Red outside of Home Assistant so I don’t know if Node Red Add-on automatically loads the Home Assistant palette. I had to add Home Assistant’s palette: node-red-contrib-home-assistant-websocket

I installed Node-Red from using this info… Home Assistant Community Add-on: Node-RED

it says " The add-on is pre-configured out of the box! There is no need
to add/change/update the server connection settings!"

… so I thought it would be plug-n-play?

Do I need the Node-RED Companion Integration?

I don’t see a specific mention that the Home Assistant palette is automatically installed for add-on but you would think it would be. Goto Hamburger menu at top right of screen in Node Red then Manage Palette.

Look under Nodes for node-red-contrib-home-assistant-websocket

Again, I am giving advice from point of view of using Node Red on it’s own, not as a Home Assistant add-on. I tried to install the Add-on to see. Clicking start never does anything for me.

I had SSL checked so it wouldn’t install. Fixed that so now I got the Node Red Add-on running and it does indeed have the Home Assistant palette installed. I am afraid that I am at the limit of my knowledge on this. Sorry. A ton of people use Node Red; I am surprised no one else has commented.

thank you for looking at it… I also posted one github, hoping someone knows.

thx!

You might have gotten deprecated info from ChatGPT for your import. I don’t have a Call-Service Node in my installation of the Home Assistant palette. I think the Action Node recently replaced it.

I also think that what you got from the chat bot was wrong. Try importing an example from the official documentation.

1 Like

here’s what both AI engines provided…

[
    {
        "id": "house_mode_switch",
        "type": "switch",
        "z": "house_modes",
        "name": "Which Mode?",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            { "t": "eq", "v": "Sleep", "vt": "str" },
            { "t": "eq", "v": "Vacation", "vt": "str" },
            { "t": "eq", "v": "Late Night", "vt": "str" },
            { "t": "eq", "v": "Spa", "vt": "str" },
            { "t": "eq", "v": "Guest", "vt": "str" },
            { "t": "eq", "v": "Neighborhood", "vt": "str" }
        ],
        "x": 300,
        "y": 300,
        "wires": [
            ["set_sleep_mode"],
            ["set_vacation_mode"],
            ["set_late_night_mode"],
            ["set_spa_mode"],
            ["set_guest_mode"],
            ["set_neighborhood_mode"]
        ]
    },
    {
        "id": "set_sleep_mode",
        "type": "call-service",
        "z": "house_modes",
        "name": "Set Sleep Mode",
        "server": "home_assistant",
        "service_domain": "input_select",
        "service": "select_option",
        "data": "{\"entity_id\": \"input_select.house_mode\", \"option\": \"Sleep\"}",
        "x": 600,
        "y": 100,
        "wires": []
    },
    {
        "id": "set_vacation_mode",
        "type": "call-service",
        "z": "house_modes",
        "name": "Set Vacation Mode",
        "server": "home_assistant",
        "service_domain": "input_select",
        "service": "select_option",
        "data": "{\"entity_id\": \"input_select.house_mode\", \"option\": \"Vacation\"}",
        "x": 600,
        "y": 150,
        "wires": []
    },
    {
        "id": "set_late_night_mode",
        "type": "call-service",
        "z": "house_modes",
        "name": "Set Late Night Mode",
        "server": "home_assistant",
        "service_domain": "input_select",
        "service": "select_option",
        "data": "{\"entity_id\": \"input_select.house_mode\", \"option\": \"Late Night\"}",
        "x": 600,
        "y": 200,
        "wires": []
    },
    {
        "id": "set_spa_mode",
        "type": "call-service",
        "z": "house_modes",
        "name": "Set Spa Mode",
        "server": "home_assistant",
        "service_domain": "input_select",
        "service": "select_option",
        "data": "{\"entity_id\": \"input_select.house_mode\", \"option\": \"Spa\"}",
        "x": 600,
        "y": 250,
        "wires": []
    },
    {
        "id": "set_guest_mode",
        "type": "call-service",
        "z": "house_modes",
        "name": "Set Guest Mode",
        "server": "home_assistant",
        "service_domain": "input_select",
        "service": "select_option",
        "data": "{\"entity_id\": \"input_select.house_mode\", \"option\": \"Guest\"}",
        "x": 600,
        "y": 300,
        "wires": []
    },
    {
        "id": "set_neighborhood_mode",
        "type": "call-service",
        "z": "house_modes",
        "name": "Set Neighborhood Mode",
        "server": "home_assistant",
        "service_domain": "input_select",
        "service": "select_option",
        "data": "{\"entity_id\": \"input_select.house_mode\", \"option\": \"Neighborhood\"}",
        "x": 600,
        "y": 350,
        "wires": [["disable_location_alerts", "keep_security_disarmed"]]
    },
    {
        "id": "disable_location_alerts",
        "type": "call-service",
        "z": "house_modes",
        "name": "Disable Location Alerts",
        "server": "home_assistant",
        "service_domain": "notify",
        "service": "dismiss",
        "data": "{\"message\": \"Disable location alerts for people in Neighborhood Zone\"}",
        "x": 850,
        "y": 350,
        "wires": []
    },
    {
        "id": "keep_security_disarmed",
        "type": "call-service",
        "z": "house_modes",
        "name": "Ensure Security Stays Disarmed",
        "server": "home_assistant",
        "service_domain": "alarm_control_panel",
        "service": "alarm_disarm",
        "data": "{\"entity_id\": \"alarm_control_panel.home\"}",
        "x": 850,
        "y": 400,
        "wires": []
    }
]

Since there is no longer a Call Service Node, that won’t work. Let’s start at the beginning. What are you trying to achieve with your Node Red Automation?

I’m creating House Modes, and will integrate with Alarmo to sync the House Modes with the Security Alarm Modes.

This is what I fed the AI…


Build Node-Red code that works on Home Assistant for a House Mode system that includes a real alarm security panel using Envisalink. As described below.

Requirements:
1. House Mode changes can be selected from a Selector entity, or based on time of day, or based on Person's Home or Away status.

2. When a House Mode is triggered, prior to enabling any secure house mode or alarm panel mode, check all sensors included in the house mode to ensure all sensors are 'closed' and ready.  If they are all 'closed' then set the selected house mode. If they sensors are not all closed, send a mobile notification to all users showing which sensors are not ready. Then check all sensors again. Do this up to three times, pausing for 20 seconds between each check, until it passes all checks. If after the third try, the sensors are still not all 'closed' send a mobile notification saying the mode change failed, and cease trying to change the house mode.

3. Create notifications are sent to the Home Assistant Companion mobile app for all house mode changes. Successful change notifications should include the mode that it is now in, and any sensors that were bypassed. Failure notifications should state why the change failed, including the sensors that caused the failure

House Modes fall into two main categories, Armed and Disarmed

Disarmed house modes are...

* Home : 
1. Notifications for doors opening and closing, windows opening and closing, and garage doors opening and closing. 
2. Notification reminders for open doors and windows when still open after 3 minutes, unless a bypass helper is enabled for each separate entity type
3. Exterior motion alerts and mobile notifications

* Guest:  
1. Does not allow the house mode or panel to change modes unless manually changed with the House Mode Selector entity.
2. Automatically disables after 4 hours.

* Hot Tub:
1. disables patio motion and patio door notifications

* Neighborhood : 
1. disables geofence notifications for any Person inside the Neighborhood Zone

Armed house modes are...

* Stay : 
1. All window and door alerts enabled
2. Exterior motion alerts and mobile notifications enabled.
3. Sets alarm panel to Stay.

* Late Night :
1. Sets alarm panel to Stay
2. Sets bypass helper entity so the house mode does not go into Sleep mode until manually changed.
3. Automatically change from Late Night mode to Sleep mode at 1am

* Sleep :
1. Sets alarm panel to Stay Night.
2. Enables all window and door notifications

* Away
1. Same as Sleep mode but also enables all internal motion notifications

* Vacation
1. Same as Away mode, and turns off water value, and sets Ecobee to vacation.

Security bypass options / helpers...

* HVAC bypass helper – when we want to keep windows open for nice weather and still set Away, Stay, Sleep (this can never enable in Vacation). This tells the automations to ignore any window/doors that are not closed, and to enable ‘bypass’ on the alarm panel

I frankly don’t think humans should post any further replies to this thread.

That’s a complicated automation. It seems you are trying to fly without even a basic understanding of Node Red. Your first step is learning about Node Red on their website. There are lots of helpful materials there. Then, start creating simple automations where motion turns on light or something. AI can be helpful but you need a basic understanding. It’s like you aren’t going to learn German from a German dictionary if you don’t know any German words.

Fascinating. There is so much talk about how wonderful AI is, I have been wondering how well it would cope with writing Node-RED code.

I am not sure what my politically correct response should be - to either laugh out loud or to rub garlic all over myself and run for the hills. Suffice to say, that if that is what the Great AI can produce, good luck to anyone who tries to use it with Node-RED!

A more considered response, I believe, should investigate what AI has produced, and perhaps wonder if AI could ever actually write Node-RED ‘code’.

I was involved with auto-code generators over 40 years ago, and safe to say they never caught on. All computer languages are set in code, usually US-English text but it could be symbols. This provides instructions for either a procedural language or a functional language, then processed by either compilation (translation) to real/virtual machine instruction code or scripting by an interpreter.

The most basic language is ‘meta code’ which is a human readable list of what I want, using sequence, selection and basic iteration. Your later “what I fed the AI” falls into this category. Translation from meta code to something useful has been fraught with issues since it usually fails to be precise enough. English is, after all, very messy.

Most real computer languages are therefore based on a strict grammar. We start with a lexicon (list of symbols) and a grammar (eg see BNF). All computer languages are fundamentally flawed with over-loading, context sensitive, recursive descent issues to name just a few. The most perfect language is, I think, Pascal, which is typed and context free (but not object-orientated so very old-hat). Going back to the idea of a computer program writing a computer program of course we arrive at the philosophical question - does a computer program reach sentience when it is capable of writing (auto generating) itself?

Now we need to consider Node-RED.

Node-RED is not a standard computer language. It is more akin to a meta language, since a Node-RED flow just partially describes what is required, it does not contain the full execution code. As a visual language, Node-RED works with a set of nodes, allowing the user to place and wire these together and to arrange settings within each node. The node contains the JavaScript code to do the work, so a Node-RED ‘program’ is a mix of the wiring (sequence) between nodes, and the nodes (acting as functions) and the individual node settings and code.

To write a Node-RED flow manually we take a particular node, add it to the flow, set the node options, and wire it in. The ‘code’ generated on export is not the individual nodes from the palette, but rather the flow - which nodes are used, how wired, how configured.

Therefore, for AI to write a working Node-RED flow requires either

  • use of the correct (already existing) nodes [written by humans, in the palette or available in npm]
  • AI to write a band-new node and make this available in npm

Since AI cant yet write and publish actual nodes on npm (can it?) it has to use existing ones, presumably selected by examining a few Node-RED flows out there on the internet…

So let us see how well AI did:

Being a human I can do a bit of guesswork and fill in the gaps to work out what AI was trying to do, so on the left are the exported settings for just one node (Action Node) with the appropriate settings required.

On the right are the settings provided by AI (and a blank means they were missing)
[do not use this code - this is just an edit to compare human with AI generated code and it will NOT work]

[
    {
        "id": "d0fb95cadb917cc1",				    "set_sleep_mode"
        "type": "api-call-service",				    "call-service"
        "z": "dc25556591dc08be",					"house_modes"
        "name": "Set Sleep Mode",					"Set Sleep Mode"
        "server": "e4afb0991c6e3d40",				"home_assistant"
        "version": 7,
        "debugenabled": false,
        "action": "input_select.select_option",		"service_domain": "input_select", "service": "select_option"
        "floorId": [],
        "areaId": [],
        "deviceId": [],
        "entityId": [ "input_select.house_mode"],
        "labelId": [],
        "data": "{\"option\": \"Sleep\"}",			"{\"entity_id\": \"input_select.house_mode\", \"option\": \"Sleep\"}"
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "blockInputOverrides": true,
        "domain": "input_select",
        "service": "select_option",
        "x": 560,									600
        "y": 320,									100
        "wires": [									[]
            []
        ]
    }
]

Apart from the fact that the Call Service node changed to the Action node recently, and in doing so collapsed the “domain” and “service” options into the one “action”, AI has fairly much failed to get anything right at all.

The reason (if you have read this far) that you got ‘node is a type unknown’ is that the type-name of the Action node (I do know because I am better at this than AI that that is the node you want) is of type “api-call-service” and this has not changed even when becoming the Action node. AI has type “call-service” which is nice but WRONG. This AI node will never match with anything in the real world.

Yes, you could fix this by adding “api-” to the front, but then consider what else is WRONG

  • the id must be a unique identifier, and ‘set_sleep_mode’ may work, but it probably wont
  • same for “z”, which is the containing flow/subflow
  • the HA server is the id of the server node. Since AI has no idea about your HA server it has made this up. You would have to hand-patch this to the correct HA server id.
  • version and a whole bunch of other settings are missing. the node will not work without these settings… ever…
  • data field is wrong. This is a significant cause of much merriment amongst humans, and in this case AI has put the correct option in but also the entity_id (now entityId) that should have gone elsewhere. WRONG
  • and lastly the wiring, which needs an array of arrays since the node can be wired to more than one node…

In short - WRONG

A more considered response - even if you changed the name, there is so much incorrect and missing that you would find it easier to code this yourself manually rather than to correct the bodge job AI has done for you. I don’t even think that the ‘concept picture’ that AI has generated provides any help at all either. Far too abstract bunch of unconnected nodes to mean anything.

Node-RED was designed as a rapid prototyping tool - it is very easy to very quickly put together a ‘program’ that does something. Just pick, drag and drop, edit the settings, wire together.

My conjecture:
The effort you expended writing the instructions for AI was equal or greater than the effort required to build the correct working program in Node-RED.

Of course, to be fair to AI I should admit that your code requirements are very complicated and will require quite a lot of work, and that this is not something that could be built just overnight.

And I should admit that the Switch node looks OK, and that if the other nodes were recognised then the wiring would possibly work. I should grant AI at least that.

If AI could write a computer program to write a computer program, would the computer program thus written then write a better program to replace AI so as to write a better version of itself? Discuss.