Closed t0bst4r closed 2 weeks ago
Hi, I've had a look over it and it seems like it could be easily filtered. Unfortunately I couldn't get the development environment set up, so I've just looked at the home assistant js repo and came up with this.
In home-assistant-client.ts:48
const filteredEntities = Object.entries(entities).filter(([key, value]) => this.isIncluded(key) && ! value.attributes.hidden);
Please tell me if it makes sense.
also disabled entities are wrongly exported
Maybe we could just write another method for the entities like isEnabled, just like the isIncluded method?
I’ll have a look tomorrow regarding the hidden attribute. i have seen that before, but it felt not to be reliable, but ill give it another try by testing it explicitly.
Sorry about #54. I forgot to refresh my browser page and did not see this one.
+1 though :-)
I just gave it a try in #58 without testing. I’ll do some testing tomorrow and release it as soon as possible.
I just checked the attributes I get from the WebSocket and the hidden
attribute is not exposed at all.
Then I checked the attributes in Home Assistant's developer tools and found that the hidden state is NOT an attribute
at the entity.
I don't know if and how we can get that information in the WebSocket or the Rest API. For now, I have no solution for this and it needs further investigation.
What about using labels? Would that work as a workaround? i.e. one would create a dedicated label for hidden entities, tag said entities and then Matterbridge can use that label to exclude the entities.
Could you check in the developer tools of home assistant if labels are added to attributes?
If not I’ll need to consider to call the rest api additionally to the websocket…
Could you check in the developer tools of home assistant if labels are added to attributes?
If not I’ll need to consider to call the rest api additionally to the websocket…
If I've looked at the correct thing, it doesn't look like the label is part of the attributes of entities.
That’s unlucky… I’ve also thought about adding the "hidden" attribute by hand (or automation) via the developer settings in home assistant. That is actually possible to do by hand, but since custom attributes are transient, they are not actually saved and get lost after restarting HA.
we'd need an scheduled automation which syncs the hidden-property to the entity's attributes. But I cannot find any service call to set a custom attribute. On the other hand, that is just a workaround to avoid calling the API 😅 Maybe we should accept that’s it’s not possible with the WebSocket and consider to call the rest api once in a while
I have found a way to retrieve the hidden status via the websocket. This needs some further refactoring and therefore I need some days
@tam481 @antoniozh Just released version 1.0.0 including this feature