Get Node Red Sensor States

Hi there, I hope I chose the correct section for my first post. I currently switched from a year of openhab - uasge to Home Assistant and I am overwhelmed.

I could integrate nearly everything with ease without great programming knowledge - everything with one exeption:

My smartmeter sends data to a Raspi with node red installed. I want to send this data to a sensor in Home Assistant, so I set up a pushbullet sending node - which is working since I recevive the desired data on my android Smartphone.

My problem: Home Assistant (installed on an other Raspi) is not receiving this data. Perhaps you have an idea how to set it up correctly or an idea for alternatives?

I get following errors:

Logs

Logger: websocket
Source: components/pushbullet/sensor.py:129
First occurred: 12. April 2020, 17:04:20 (2079 occurrences)
Last logged: 8:24:20

error from callback <bound method Listener.on_open of <Listener(Thread-4, initial daemon)>>: on_open() missing 1 required positional argument: 'ws'
error from callback <bound method Listener.on_message of <Listener(Thread-4, initial daemon)>>: on_message() missing 1 required positional argument: 'message'

My config looks like this:

# Sensors
sensor:

  - platform: pushbullet
    api_key: MY_API_KEY
    monitored_conditions:
      - body
      - application_name
      - title

Sensor state is “unknown”

I can’t help why your setup is not working but suggest a few alternatives.

  1. There is a node-red add-on available also in home assistant and works pretty well. if you don’t have too many flows, maybe you can switch your node-red on raspi to home assistant’s node-red. afterwards you can use this https://flows.nodered.org/node/node-red-contrib-home-assistant-websocket (comes installed already with node-red addon). then sensor node is what you need.
  2. install the node-red node I mentioned above in your other raspi and connect to your home assistant server.
  3. publish an mqtt message from node red and create an mqtt sensor in home assistant to listen. more information: https://www.home-assistant.io/integrations/sensor.mqtt/

I might help further if you decide on any of the above options.

Edit: for option 1-2 you also need the custom integration for node-red in home assistant.

thank you very much for your alternatives! I installed the node red add on and the custom integration to go with option 2

So far, I got connected. A Sensor has been created as desired. It gets the correct name but no values. I don’t know how to do the last step - something is missing - can you help me out? I suppose it has to do with “state” and “output location”

1 Like

Can you share the node, how does it look like.
State normally looks like this msg.payload

it looks like this:

[{"id":"145ad60b.b46d5a","type":"ha-entity","z":"2ffddac8.038c86","name":"stromverbrauch_neu","server":"5e59c075.fdcba","version":1,"debugenabled":true,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Stromverbrauch"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"Watt"}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"msg","inputOverride":"allow","x":899.5,"y":390,"wires":[["7f44f341.b6e40c"]]},{"id":"5e59c075.fdcba","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

The node you posted here must be linked to something else in order to receive the msg.payload. possible to send entire flow?
you need to link this one to your rest of the flow(ie. instead of pushbullet node, use this node)

Oh my gosh - my fault. The node was connected to the one which was firing the desired data. BUT: I also connected another node (a simple debug node) which was receiving all the data. After deleting the debug node, it worked properly.

thank you very much!