Each event from the websocket comes in as msg.payload.event, and the event_type would be msg.payload.event.event_type, and although there are many event_types from Home Assistant, my subnode is only looking for either state_changed, homeassistant_start, zwave.network_ready and zwave.scene_activated. If it does not match one of those 4 event_types, it should not output anything, so I am not sure why you are getting those errors, unless it has to do with the configuration of the YOUR_API_PASSWORD and YOUR_HASS_IP
Did you change all instances of YOUR_API_PASSWORD and YOUR_HASS_IP to match the password you have set for Home Assistant and the IP Address of your Home Assistan in the flow before doing the clipboard import into Node-RED? I have not tested it for a setup that does not use an API Password, so I’m not sure you if are using a password or not.
I find it easier to paste the flow json code into a text editor, then do a search and replace on YOUR_API_PASSWORD and YOUR_HASS_IP, and then copy and paste it into Node-RED’s import window. If you are on a Mac and use TextEdit.app, you may find that TextEdit changes all the quotes to a fancy style quote that will mess up the code, so I would use a different text editor than TextEdit if you are on a Mac when you are searching and replacing the instances of YOUR_API_PASSWORD and YOUR_HASS_IP
Since you already imported though, you can just look inside the nodes themselves and track down all the references and change them inside Node-RED as well.
As for the websocket send, from my testing, you have to send each request with a unique ID that is higher than the previous ID, so to me it seemed annoying to have to keep incrementing the ID of each new request. I figured after a week or so of running Home Assistant, with all the events going on, the ID numbers would in the thousands, and continue to climb, so unless I mis-understood Home Asistants websocket API documentation, it seemed kind of absurd, so I found it easier to use the direct RESTapi when calling back to Home Assistant to turn things on and off. Also, having only one set of nodes to do On, Off and Toggle for all device types (switch, light, input_boolean, script, etc) by using the msg.action and msg.type as variables in the http node made it a lot easier and cleaner. So for every action I wanted Home Assitant to carry out, I only had to supply msg.type, msg.action and msg.payoad (entity_id), so it just seemed easier.
So…
msg.action = "turn_on"
msg.type = "switch"
msg.payload = {
"entity_id":"switch.living_room_lamp"
}
With the variables of the URL in the http node:
http://YOUR_HASS_IP:8123/api/services/{{{type}}}/{{{action}}}
would become
http://YOUR_HASS_IP:8123/api/services/switch/turn_on
For those not familiar with Node-RED beyond the initial nodes that come pre-installed, remember, you can go to http://flows.nodered.org to find and install additional nodes and flows, that are being added to daily, so that you can increase your ability to interact with more and more devices, services and utilities.