Closed highincolorado closed 2 years ago
The error message appears to be correct. You need to format the attributes as a dictionary. For example,
"attributes": {"attr1": 42, "attr2": "abcd"}
Ah curly brackets all the things I tried and that wasn't one. Many thanks. This worked:
{
"attributes":{"ordered": 1}
}
One further question if I may, the following is the var defiinition, will the attribute I set in node red be overwritten when the tracked ink changes it's value?
ink_office_canon_magenta:
friendly_name: "Office Canon CLI-251XL M"
initial_value: 0
unit_of_measurement: "%"
value_template: >-
{% if is_state('sensor.canon_mx920_series_magenta', 'unavailable') or
is_state('sensor.canon_mx920_series_magenta', 'unknown') -%}
{{ (states('var.ink_office_canon_magenta')) }}
{%- else -%}
{{ (states('sensor.canon_mx920_series_magenta')) }}
{% endif %}
tracked_entity_id:
- sensor.canon_mx920_series_magenta
attributes:
ordered: "0"
Yes. From the docs:
attributes (map)(Optional) Dictionary of attributes equivalent to that of HomeAssistant template sensor attributes.
Similar to value_template, attributes are evaluated on every update.
If you set the attribute via NodeRed, then it will be reevaluated each time the tracked entity updates.
I am trying to add attibutes to some variables and then use the node-red call service node to modify the attribute. I have tried many ways to format the call but nothing has worked so far. I even loaded the example data and made the call and got the same error message: "Call-service error. expected a dictionary for dictionary value @ data['attributes']
I admit to a lack of knowledge with how to format what I want but was hoping the example data would point me in a good direction. Is this broken or am I just not getting it? Any help? Thanks!
"