Comments (5)
Power calc entities are added to existing devices
integration_entities('powercalc') will return all entities set up by powercalc
device_attr(entity, 'identifiers') will return a list of all identifiers related to the entity (this would be the identifier linked to the entity's original device)
to skip the identidiers belonging to the entities in the groups, you may have to try...
{% set pwr_entities=integration_entities('powercalc') %}
{%- for entity in pwr_entities %}
{%- set ids = device_attr(entity, 'identifiers') %}
{%- if ids is not none %}
{{ entity }}
{{ device_attr(entity, 'identifiers') }}
{%- endif %}
{% endfor %}
You may also be able to expand the groups and iterate over the entities in that group
{%- set group_entities = entity |expand|map(attribute='entity_id') %}
from homeassistant-powercalc.
Hi @teskanoo
I really appreciate your quick reply 😊
I realize some extra background should have been helpfully.
I wrote a template to list unavailable devices. That became more complicated than I originally anticipated, two challenges, the first one I tackled, the second I'm looking into 😅
Basically a device is defined unavailable when all device related entities are unavailable, with some exceptions.
1: some devices have a status entity of device_class connectivity. That entity will remain available (in problem state).
2: Sorry for the long intro, but here I found out that some devices were extended with Powercalc entities. Those can remain available as well, depending the configuration for unavailable.
But I now understand you extent them on purpose. So maybe I have to rethink my approach.
Update: the real issue is that I don't now a decent way to list all integrations. So the approach starts with looking up the integrations for all entities (via the device attribute identifiers).
from homeassistant-powercalc.
As this seems a deliberate choice, with well thought reasons, you are free to close the issue 🤓
from homeassistant-powercalc.
Yes, Powercalc entities are connected to same device as the source entitity, and this is one of the key features of Powercalc.
You might want to retrieve all powercalc entities first in your template and assign those to a variable.
As @teskanoo mentioned: {% set pwr_entities=integration_entities('powercalc') %}
And then exclude these when determining availability for a device.
from homeassistant-powercalc.
As @teskanoo mentioned:
{% set pwr_entities=integration_entities('powercalc') %}
And then exclude these when determining availability for a device.
Yes I have done that, my issue is solved😊 I close this issue now.
I just published the macro to share: https://community.home-assistant.io/t/a-sensor-to-list-unavailable-devices/684896/36
from homeassistant-powercalc.
Related Issues (20)
- ability to enter power-on consumption for 'Sonof ZBmini01' via the configure GUI HOT 3
- Why is powercalc trying to reach the internet after installation and setup? HOT 11
- Thanks for the contribution, makes sense to add the alias as you also verified the power draw is similar. HOT 2
- cant delete entries on the integration HOT 9
- Energy sensor have mixed kWh or Wh as unit HOT 10
- light_setting.hue = int(hs[0] / 360 * 65535) ~~^^^ TypeError: 'NoneType' object is not subscriptable HOT 4
- Innr outdoor lights
- Adopt powercalc to change in device info HOT 1
- Add IKEA LED2104R3 GU10 bulb
- Support for multiple-outlet smart outlets and smart strips HOT 20
- Energy sum to retrieve untracked energy HOT 5
- Option flow cleanup HOT 1
- More than 130 powercalc light entities per room. Why? HOT 11
- Adding my autodectected TP-Link HS300 results in exception HOT 4
- A sensor grouping power sensors went crazy HOT 7
- Allow edit of disabled PowerCalc entry HOT 3
- Problem with group-type entities HOT 7
- Error occurred loading flow for integration powercalc: cannot import name 'ConfigEntryBaseFlow' HOT 3
- Ssl error on setup HOT 2
- Entity standby power still counting event when calculation_enabled_condition is false HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homeassistant-powercalc.