Closed morikplay closed 2 months ago
Hey there @bbernhard, mind taking a look at this feedback as it has been labeled with an integration (signal_messenger
) you are listed as a code owner for? Thanks!
@morikplay i am getting, the following:
Template variable error: list object has no element 0 when rendering '{{ value_json[0].envelope.dataMessage.message | default('', true) }}'
Probably because there is no new messages and no array returned. But not sure if this was visible before HA version 2024.1.2.
But by the way, i don't see the mandatory payload in the swagger api documentation for the GET v1/receive endpoint, and you are already passing the number in the URI. Isn't payload only for POST endpoints anyways?
@renini Thank you so much for looking into the issue and responding.
@morikplay i am getting, the following: Template variable error: list object has no element 0 when rendering '{{ value_json[0].envelope.dataMessage.message | default('', true) }}' Probably because there is no new messages and no array returned. But not sure if this was visible before HA version 2024.1.2.
If receive
response returns nothing (meaning nothing left to retrieve from signal server) then obviously there won't be any payload to evaluate. I'm sure my configuration could be cleaned up using templates, but being rather new to REST APIs, I did try to keep things simple. I can change the value_template
to:
value_template: >-
{% value_json != none and value_json | length > 0 %}
{{ value_json[0].envelope.dataMessage.message }}
{% endif %}
But by the way, i don't see the mandatory payload in the swagger api documentation for the GET v1/receive endpoint, and you are already passing the number in the URI. Isn't payload only for POST endpoints anyways?
Per Swagger API, {number}
is mandatory. Obviously it is mandatory because the REST URI needs to be formulated. However, when testing in insomnia i noticed that:
payload
is included, nothing is returned even though there are pending messages to be received. A message log (for a msg sent by {no1}
to a group containing {no1, no2, no3}
with group-owner being no3
can be seen below:
REQUEST: GET URI: http://<my-signal-container-instance-address>/v1/receive/{no3}
RESPONSE: []
payload
per above, which has the same number: {number}
included returns data. A message log (for a msg sent by {no1}
to a group containing {no1, no2, no3}
with group-owner being no3
can be seen below:
REQUEST: GET URI: http://<my-signal-container-instance-address>/v1/receive/{no3}
{
"number": "{no3}",
max_messages: "1"
}
RESPONSE: [
{
"envelope": {
"source": "{no1}",
"sourceNumber": "{no1}",
"sourceUuid": "{no1_uuid}",
"sourceName": "{name}",
"sourceDevice": {n},
"timestamp": 1703993110672,
"dataMessage": {
"timestamp": 1703993110672,
"message": "test",
"expiresInSeconds": 0,
"viewOnce": false,
"groupInfo": {
"groupId": "{group1}",
"type": "DELIVER"
}
}
},
"account": "{no3}"
}
]
Are you suspecting funky behavior specific to my settings only?
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved. If this issue is still relevant, please let us know by leaving a comment 👍 This issue has now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Feedback
The current example for this section is misleading for 2 reasons:
value_template
needs a value for json_attributes to work. It can be found on the authors' original page.payload
is mandatory for this to work. It is missing in the authors' original page example as wellHere's a working example from my testing:
URL
https://www.home-assistant.io/integrations/signal_messenger/
Version
2023.12.4
Additional information
No response