Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-History Entity ID Include returns 'Request failed with status code 400' starting HA Core 2023.05 #924

Closed
alvinchen1 opened this issue May 8, 2023 · 3 comments · Fixed by #1167
Labels
bug Something isn't working

Comments

@alvinchen1
Copy link

alvinchen1 commented May 8, 2023

Describe the bug

Since 2023.05, when get-history node attempts using Entity ID INCLUDE returns "Request failed with status code 400"

I have nodes which use INCLUDE "binary_sensor.[star]_sensor_motion[star]" as well as INCLUDE "device_tracker." which all worked before 2023.05. Also Entity ID IS (vs INCLUDE) seems to work with no problem, just the INCLUDE does not. I've been trying to do some digging, (tried the Node-Red Forums) and been redirected back to HA Core and zeroing in on here.

Add-on: Node-RED
Flow-based programming for the Internet of Things
Add-on version: 14.1.5
You are running the latest version of this add-on.
System: Home Assistant OS 10.1 (amd64 / generic-x86-64)
Home Assistant Core: 2023.5.2
Home Assistant Supervisor: 2023.04.1
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

To Reproduce

1: Get History Node
2: Entity ID change from IS (Default) to INCLUDE
3: Put in a wild card, such as device_tracker or binary_sensor.[star]_motion_sensor[star]
4: Deploy and inject test.

Entity ID IS something works fine
Entity ID INCLUDE something returns "Request failed with status code 400"

Expected behavior

Expected Entity ID Include to return results, which worked before 2023.05

Screenshots

image

image

Example Flow

[{"id":"487929f4bce5e53b","type":"api-get-history","z":"da8e8fcaab62edd9","name":"1 hour","server":"3a95bff3.8b691","version":0,"startdate":"","enddate":"","entityid":"device_tracker.","entityidtype":"includes","useRelativeTime":true,"relativeTime":"1h","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":290,"y":1020,"wires":[["4ce3aad90bec5a3d"]]},{"id":"c2fba5b9700de4d5","type":"inject","z":"da8e8fcaab62edd9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1020,"wires":[["487929f4bce5e53b"]]},{"id":"4ce3aad90bec5a3d","type":"debug","z":"da8e8fcaab62edd9","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":1020,"wires":[]},{"id":"3a95bff3.8b691","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

This package's version (not the Home Assistant add-on version)

0.49.1

Is Node-RED running in Docker?

Home Assistant add-on

Node-RED version

3.0.2

Node.js version

18.14.2-r0

Additional context

Doing some digging in previous issues and seems like get-history relies upon the REST API. Found this issue where there is discussion about recent changes to REST due to SSL Cipher List. Was trying to follow to see if it is related, but unsure.

home-assistant/core#92500

May not be related since Entity ID IS works but Entity ID Include does not.

@zachowj
Copy link
Owner

zachowj commented May 8, 2023

home-assistant/core#90992

I'll have to see if there's a way to accomplish wildcard look-ups still.

@zachowj
Copy link
Owner

zachowj commented May 8, 2023

A temporary solution would be to use the get-entities node and build the entity id list and send that to the get-history node.

image

[{"id":"1f8181bb1d6fecc1","type":"inject","z":"c89d915bdff0f798","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":348,"y":880,"wires":[["7bec928dbee467fd"]]},{"id":"a75b866f2bda66ef","type":"api-get-history","z":"c89d915bdff0f798","name":"","server":"","version":0,"startdate":"","enddate":"","entityid":"","entityidtype":"is","useRelativeTime":true,"relativeTime":"5h","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":1138,"y":880,"wires":[["0715bd94f6ec1014"]]},{"id":"7bec928dbee467fd","type":"ha-get-entities","z":"c89d915bdff0f798","name":"","server":"","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"device_tracker.","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":506,"y":880,"wires":[["5c16ab186fa8e1da"]]},{"id":"357daee536bbcce8","type":"join","z":"c89d915bdff0f798","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":798,"y":880,"wires":[["a772e05155d0590d"]]},{"id":"5c16ab186fa8e1da","type":"template","z":"c89d915bdff0f798","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.entity_id}}","output":"str","x":660,"y":880,"wires":[["357daee536bbcce8"]]},{"id":"a772e05155d0590d","type":"change","z":"c89d915bdff0f798","name":"move to entity_id","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"entity_id\": payload}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":966,"y":880,"wires":[["a75b866f2bda66ef"]]},{"id":"0715bd94f6ec1014","type":"debug","z":"c89d915bdff0f798","name":"debug 90","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1276,"y":880,"wires":[]},{"id":"aaec7bac32dec684","type":"change","z":"c89d915bdff0f798","name":"entity id string","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"entity_id\": payload.entity_id ~> $join(\",\")}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":684,"y":928,"wires":[["43529df9adeaf975"]]},{"id":"13db69f7e3bb73c2","type":"debug","z":"c89d915bdff0f798","name":"debug 91","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":988,"y":928,"wires":[]},{"id":"0a436b6514092b07","type":"inject","z":"c89d915bdff0f798","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":348,"y":928,"wires":[["af1688c811722ae3"]]},{"id":"af1688c811722ae3","type":"ha-get-entities","z":"c89d915bdff0f798","name":"","server":"","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"device_tracker.","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":506,"y":928,"wires":[["aaec7bac32dec684"]]},{"id":"43529df9adeaf975","type":"api-get-history","z":"c89d915bdff0f798","name":"","server":"","version":0,"startdate":"","enddate":"","entityid":"","entityidtype":"is","useRelativeTime":true,"relativeTime":"5h","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":846,"y":928,"wires":[["13db69f7e3bb73c2"]]}]

@alvinchen1
Copy link
Author

Thanks for the suggestion, will work those in!

@zachowj zachowj added the bug Something isn't working label May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants