-
Notifications
You must be signed in to change notification settings - Fork 26
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
Allow sub-object in data selector #86
Comments
This only works for attributes.
Just checking in to see if this feature has been merged and released. The documentation seems to suggest it has but I can't get it to work. Using modify: x.blar instead but keen to change to this once released. |
Have you tried smth like this?
|
Thanks. Yes that is what I currently do and it works fine but thought this solution was better and I would like to avoid using modify: x.subattr |
In the docs (data column examples), this is included |
Yep. I found the same. I think this will be a great addition if/when it gets implemented/released. I have an entity for connected devices on my LAN that uses nested objects/attributes. So it would literally require - object1.object2.field1 It is working fine using modify so I was just interested to see if I could get it working... Thanks for helping/discussing this with me :-) |
one more question. See below for attributes for an entity. For the 'actions' attribute, I want to return the 'data' value. How would I do this? I have tried the following... `weekdays:
|
@jata1 |
mmmh, for me the following works e.g. for weather:
the |
@daringer
and it creates ONE row for a particular array's element (as it is expected):
|
Hi good people. I see this issue is open after the merged 'fix dot notation' commit.
I can access things I want, like the title of the first game with HA templating, like:
Now I need that in my flex-table-card. I copied code from ... somewhere... that used to work and now doesn't. It used the sensor,
This just results in The only thing I can get to work is what's not in a list, like:
So... does the new version's fix work for selecting items in a list and then their attributes? Is there a right way to do this? I've spent an hour trying the various suggestions in issues here, like Thanks in advance :) |
Thanks for reporting this interesting case. Sorry for the trouble. I'll take a look. In the meantime, I can confirm that your example works in v0.7.7. You can roll back to it here. Also, I was able to get the following to work with v0.7.8, for what it's worth. I could not reduce it to the first item in the array as you did with Also, this configuration will not work with the blank data in the 3rd element of the array...I had to delete it.
Another option is to break down the structure using a template sensor. This example (from
A card definition that works with it is:
|
@lindsaymarkward: I've submitted the fix for this, but cannot guarantee when or if it will be merged and released. This fix is one line of code if you want to short-circuit the process. |
Suppose I have an attribute named: my_data. My data is an object that contains another object named: more_data. Inside more_data is a field named: my_field. The problem is that the data selector can only access the top object as in:
data: my_field
I can use the modify selector to access the rest of the object as in:
modify: x.more_data.my_field.
However this means that I cannot use the fmt selector and would therefore have to add additional code in the modify selector to format the data.
So, I propose that the data selector be able to use dotted notation to access the correct field. For example:
data: my_data.more_data.my_field
This allows me to use the fmt option if I choose or I can continue to use the modify option to format the x value.
The modification I propose should be flexible enough to allow any number of sub-levels.
This modification should only apply to attributes and not to any other entity key.
The text was updated successfully, but these errors were encountered: