Hi
is there a way to log the actions from Node Red in the HA log?
Hi Everyone,
Just upgraded to this as I decided to take another stab at node-red. Got it all going but for the life of me, I cannot figure out how to get call-api-service for device_tracker.see working (probably due to my newbness) and hope someone can steer me in the right direction:
My data:
{
"dev_id": "chris_nodered",
"location_name": "{{msg.location.isat[0]}}",
"gps": "[{{msg.location.lat, msg.location.lon}}]"
}
The debug data you see in the screenshot is part of my flow I pass to call-api-service:
If I statically set location_name to say āhomeā and drop gps, itāll update the device_tracker entity but that doesnāt work for what Iām trying to do (which is dynamically populate the tracker with data from my flow)
Can someone shed some light on this and lend a helping hand? This is the last step in my geofence flow, everything but this is working (and was rather easy, which surprised me) but Iām stumped on this.
Thanks!
More than likely itās because mustache templates use dot notation for everything even arrays.
Try
...
"location_name": "{{msg.location.isat.0}}",
...
Thanks @Kermit
While it doesnāt fail with this, it doesnāt update it either
If I include the GPS data, it still fails. Not sure why as using the dev-ui I can enter the data manually and it works.
It because device tracker is expecting the gps to be of type float and theyāre getting passed in as a string. Drop a function node before the call-service node and try
msg.payload = {
data: {
"dev_id": "chris_nodered",
"location_name": msg.location.isat[0],
"gps":[
msg.location.lat,
msg.location.lon
]
}
};
return msg;
This is kind of what I ended up doing earlier today before reading this
{
"data": {
"dev_id": "chris_nodered",
"location_name": "{{location.isat.0}}",
"attributes": {
"source_type": "gps",
"gps_accuracy": "{{gps_accuracy}}",
"latitude": "{{location.lat}}",
"longitude": "{{location.lon}}",
"battery": "{{battery}}"
}
}
}
Itās not elegant I suppose but it does work which makes me happy I very much appreciate you giving me a hand with this, hereās the flow as it stands (portion thereof):
I did have to remove the entity from core.restore_state with all the testing it took me to get to this point, once I did that, it worked like a charm.
I gave up on node-red a while back but glad I saw this thread and tried again ā I may be able to repro my old python script using it which would be make me even happier
New Release v0.9.1
Bug Fixes
- Fix for checking valid entity id (4ee501e)
- haltif: Fix to include contexts on other operators (1a250b9)
- poll-state: Set default value for updateIntervalUnits (61f9768)
Features
-
api: New node for direct access to api (ed7341a)
-
call-service: domain and service fields accept templates (8f86906)
-
get-history: Add flatten option (b46a4d5)
-
poll-state: Added Interval Units (44f75c0)
-
Access to msg, flow and global context (e1ce911)
Full Changelog
Iāve been trying to get the āFire Eventā node to update a binary_sensor all morning without luck, does anyone have an example? Iāve tried vai direct input into the node and via payload without success
Hi guys, Iām getting the error - [api-current-state:Occupancy] entity could not be found in cache for entity_id: sensor.mark_presence_confidence, sending empty payload
Looking above that seemed to be a version thing so I went away and updated everything:
- Node.js Version: 10.12.0
- Node Red Version: 0.19.6
- NR Home Assistant Plugin Version: 0.9.1
- Is Node Red running in Docker: No (HA 0.89.1)
- Browser: Safari and Chrome
Iām using the long lived token access method. Should I revert to the mentioned version of NodeRed?
Iām also seeing the:
12 Mar 18:23:25 - [debug] [server:HomeAssistant] WebSocket Connecting http://10.10.10.4:8123
12 Mar 18:23:25 - [debug] [server:HomeAssistant] config server event listener connecting
12 Mar 18:23:25 - [debug] [server:HomeAssistant] config server event listener closed
Log entries as well.
Mark
ā- Edit
Definitely a connection issue. Getting Call service attempted without connection to server on the call service nodes in console debug.
ā- Edit 2
It was a firewall issueā¦ Had to switch to localhost and comms came straight up. Interestingly at some piping i started getting connection errors in the node-red log that werenāt there before.
Iām loving the recent updates to this palette.
Quite a lot of my node-red flows have a Current State node thatās followed by a Switch node to change the flow depending on the state of the entity.
Wondering whether it would be possible to build some switch functionality into the Current State node? So you get a different output depending on the state of the node (other other attribute.
fyi, whenever i update my NR docker image to the latest, i have to go into the docker command line and:
docker exec -it -u root nodered bash
npm uninstall node-red-contrib-home-assistant-websocket
npm install node-red-contrib-home-assistant-websocket
exit
and then restart my docker container.
I never have to do that.
Are you asking for more than the two outputs that has now if you using the halt-if logic?
I donāt normally use this package in a docker setup but like @flamingm0e said when I have tested it before I have never had this problem.
Why do you have to do this? You never really said.
@Kermit just started using the deCONZ for my zigbee devices. The xiaomi round buttons see action through the event node, not like sensors or mqtt (zigbee2mqtt).
Everything good but i needed to use the long_release time and i noticed the time is not on the msg. If i subscribe to ha event listener i get the time_fired property. This obviously can be resolved at nodered, but i though it was worth to mention
i updated my docker to 0.20.2 (v8)
when launching NR after the update it would say all the HA-WS nodes were āunknownā
this happened the last time i updated as well.
@stone If it makes you feel any better, I have to do the same thing and Iām using Docker for my NR. As far as I can tel this module is the only one that I need to do that withāall the others I can just update through the NR console.
Whatās the first output from?
You should check if the package is being installed in the persistent volume.