Skip to content

response variable output - HELP on how to use it #542

@Sn0w82

Description

@Sn0w82

Is there any way to include in documentation the part that teaches us how to update a sensor when running this as a service action?

i'm running following action from automation:

action: multiscrape.scrape
data:
name: OPCOM_60MIN
resource: https://www.opcom.ro/grafice-ip-raportPIP-si-volumTranzactionat/ro
sensor:
- unique_id: opcom_60min
name: OPCOM 60min
select: "#rez60min table.border_table tr:nth-child(2) td:nth-child(2)"
attributes:
- name: "1"
select: "#rez60min table.border_table tr:nth-child(2) td:nth-child(2)"
value_template: "{!{ value | replace('.', '') | replace(',', '.') | float }!}"
- name: "2"
select: "#rez60min table.border_table tr:nth-child(3) td:nth-child(2)"
value_template: "{!{ value | replace('.', '') | replace(',', '.') | float }!}"
- name: "3"
select: "#rez60min table.border_table tr:nth-child(4) td:nth-child(2)"
value_template: "{!{ value | replace('.', '') | replace(',', '.') | float }!}"
- name: Day
select: input[name="day"]
attribute: value
- name: Month
select: input[name="month"]
attribute: value
- name: Year
select: input[name="year"]
attribute: value

and i get following response variable:

{% set action_response = {"opcom_60min":{"value":"633,38","attributes":{"1":633.38,"2":627.86,"3":622.25,"day":"21","month":"1","year":"2026"}}} %}

but didn't manage with the help of the provided documentation or AI chats, to use this and update a specific sensor with that attribute values got in the response.

Anyone that can help with an example of code/template that works to do this?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions