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
HA Automation trigger.to_state.attribute spacing instead of underscore #60
Comments
From the documentation here. |
Thanks for reply, but not the right anwer.
I know that one what you say. But want to work in trigger.to_state. So how to get that work in trigger state?
I use in the automation trigger.to_state.attributes.
So wat you say is only to 1 specific sensor. I want that specific sensor as trigger.entity_id from what triggered the automation
state_attr('sensor.tgtg_*', 'TGTG Price').
Sensor.tgt* has to be "trigger.entity_id.
But can not use it in the way you tells me.
Hope you have the answer
.
Thanks.
Verzonden vanaf Outlook voor Android<https://aka.ms/AAb9ysg>
…________________________________
From: Jorim Tielemans ***@***.***>
Sent: Monday, February 13, 2023 12:05:13 AM
To: Chouffy/home_assistant_tgtg ***@***.***>
Cc: Florian14490 ***@***.***>; Author ***@***.***>
Subject: Re: [Chouffy/home_assistant_tgtg] HA Automation trigger.to_state.attribute spacing instead of underscore (Issue #60)
From the documentation here<https://www.home-assistant.io/docs/configuration/state_object>.
When an attribute contains spaces, you can retrieve it like this:
state_attr('sensor.tgtg_*', 'TGTG Price').
—
Reply to this email directly, view it on GitHub<#60 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUE3NL2BS2G4ZP5ZIWT56LDWXFUCTANCNFSM6AAAAAAUY4S3CQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Agreed, reopening this issue! Although it's not in the developer docs, and I have other integrations that don't seem to use snake_case either, we could change/fix it here. Will be picked up when I'm back from holiday next week (or if anyone feels like giving it a shot). Btw, @Florian14490, feel free to provide your automation as an example. It would be nice to have a few in the documentation here! |
@tjorim , yes offcourse. alias: TooGoodToGo Notification K + F (stock sensor)
|
@tjorim Thank you verry much to put work in it. Have a nice day |
Hello,
Thanks voor the good integration, works perfect !
I have one problem with trigger state.
Some state attributes have spacing instead of underscore between words.
That means that my automation not giving the correct info, it give me error.
I use folllowing : {{trigger.to_state.attributes.TGTG Price}} , its not working because of spacing between TGTG and Price.
Following is working: {{trigger.to_state.attributes.friendly_name}}, it has the underscore between friendly and name.
Example attributes of sensor:
Item ID: '75581'
Item URL: https://share.toogoodtogo.com/item/75581
TGTG Price: 4.99 EUR
Original value: 14.99 EUR
unit_of_measurement: pcs
icon: mdi:storefront-outline
friendly_name: TGTG 't Bakkershuys
The attributes with underscores are working but I cant get the attributes with spacing instead of underscore,=.
Is there a simple tip or trick to get them in my automation?
Example: {{ trigger.to_state.attributes.TGTG Price}}
Hope the here from you.
Already Thanks,
The text was updated successfully, but these errors were encountered: