question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Call Service node reporting API call error when populating Entity field if using Logbook/Log domain/service call.

See original GitHub issue

Problem/Motivation

API error on ‘Call Service’ node when calling ‘logbook/log’ domain/service. If ‘Entity’ field is populated the call to the API is unsuccessful and reports ‘Call-service error’ If ‘Entity’ field is left blank it the call is successful. ‘Call service’ node works fine when using the ‘switch’ domain.

Expected behavior

Keep the behavior as in the previous versions. Previously, I was able to use the ‘Entity’ field pass it to the log service to be correctly populated in the log entry.

Actual behavior

If the entity field is used when using ‘call service’ node with ‘logbook’ domain, the API call fails.

Steps to reproduce

Create a ‘call service’ node to add a log entry by using the ‘logbook’ domain and the ‘log’ service and populate the ‘entity’ field with any valid entity in your system. Use an inject node to activate the service all and you will get a ‘call-service’ error. I added a 2-node sequence below.

Proposed changes

  • Allow the entity field to be used for logging purposes.
  • I have managed to work around this issue by leaving the ‘entity’ field blank and passing ‘entity_id’ via a message variable.

[{"id":"3411bfc6f0a7330f","type":"api-call-service","z":"f1b6eb10f8042de9","name":"Logging","server":"1680b843.4f7308","version":4,"debugenabled":false,"domain":"logbook","service":"log","target":{"areaId":[],"deviceId":[],"entityId":["switch.power_switch_02"]},"data":"{ \"name\": \"{{data_log.name}}\", \"message\": \"{{data_log.message}} [Node-RED_{{data_log.id}}]\", \"domain\": \"{{data_log.domain}}\", \"entity_id\": \"{{data_log.entity_id}}\" }","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1140,"y":860,"wires":[[]]},{"id":"cee9084140327534","type":"inject","z":"f1b6eb10f8042de9","name":"","props":[{"p":"data_log.message","v":"has been turned ON or OFF by Node-RED automation","vt":"str"},{"p":"data_log.entity_id","v":"switch.power_switch_02","vt":"str"},{"p":"data_log.domain","v":"switch","vt":"str"},{"p":"data_log.name","v":"friendly_name","vt":"str"},{"p":"data_log.id","v":"your_own_ID_for_reference","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":950,"y":860,"wires":[["3411bfc6f0a7330f"]]},{"id":"1680b843.4f7308","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mty17commented, Feb 17, 2022

I think that will help more, from an add-on perspective, we package it up in such a way its all working together nicely, but we do not develop the node itself

Understood. I will do that. Thank you!

0reactions
mty17commented, Feb 17, 2022

Bug has been opened under the Home Assistant Websocket Node project: https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/590

Read more comments on GitHub >

github_iconTop Results From Across the Web

API error just in some "call service" node - Node-RED
Hi, I'm getting some API error in call service node. If I try to trigger them manually with an inject node they work...
Read more >
Call Service Tips and Tricks | node-red-contrib-home-assistant ...
The homeassisant domain can be used with different domains of entities with certain services. Here's an example of using the homeassistant ...
Read more >
Call service node failing with "Call-service API error." #162
Call service node appears to randomly fail. The flow can be tested and works. If the flow is triggered either by a timer...
Read more >
Node Red + Home Assistant - YouTube - YouTube
Node Red + Home Assistant - Master Class 1. Beginners guide, basic flow with state, call service +_. 57K views · 2 years...
Read more >
API Error when sending notifcation to phone- call service
Hi! I have a notification system that notifies me via google assistant speakers when particulate matter (PM) is above a certain threshold.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found