edit: @hummingbear I like the IDEA of sort by parent - but I need it to work.
edit2: we’ll talk about the scaling change afterwards… I also need a way to have the previous behavior.
I like this very much and wonder of this would be possible with dynamic connections (wifi device on various access points in the house)?
This would perfectly visualize the different connections between the main router, the mesh devices as well as the phones, cameras, etc.
Do you know if this is possible and if so, could you provide a small example how to connect the dynamic devices to the sankey configuration?
I tested what I am able to do:
I would like to create a view of my network devices spread all over the various repeaters around the house.
My idea is to start with the router (fritz.box) and let it branch into the 7 repeaters.
From there I would like to connect the devices like tasmota bulbs, cameras, phones etc to the connected repeater.
For the middle part (repeater) I have created dynamic groups which are populated with the members connected to the repeater:
service: group.set
data:
object_id: fritz_clients_rep_wozi_sofa
name: Geräte an Fritz Wozi-Sofa
icon: mdi:network-outline
entities: >
{{ states.device_tracker | selectattr('attributes.connected_to', 'search',
'fritz-Powerline-1220E-WoZi-Sofa') | map(attribute='entity_id') | list }}
I tried to create a Sankey Card with it and wonder if this is even possible.
My code looks like this and I am happy to hear about your comments:
I defined a dedicated template sensor for each device or entity that I wanted to include in the dependency tree:
** the “branches” in the dependency tree have a value depending on their state. The difference in value is 0.1 which is not really visible when displayed, still it can be used in the card configuration to display color-based states. The value of a “branch” is the sum of values of its children’s values.
** the “leaves” in the dependency tree have a value of 1, however you may use the above logic if you want to display them color-changing state-dependent.
I use a dedicated view of sidebar type to display the dependency tree
my card uses color based states. The color limit at a certain point is the sum of the values of the children devices.
the card displays columns based on the list of entities from the sections part: first list of entites is the left-most column, followed by the next list of entities, etc.
simplified example explained:
** RF blinds, garage door, etc depend on the RF433 bridge; they are leaves with values 1 each, the RF bridge has a value of 4 (having four leaves with values 1).
** similarly Zigbee temp/humidity (zbth_akos) and door/window (zbdw_akos) sensors are leaves having values 1 each, but they depend on the Zigbee bridge that has value 2 (having two leaves with values 1)
** MQTT device has two children, the RF and the Zigbee bridges, having a value of 6 (4+2 from its children)
Awesome!
Thank you very much for your detailed response!
This helps a lot.
Creating additional template sensors for each entity I would like to include is a lot of effort, but worth the work for such a nice overview.
It’s a good project for the upcoming end-of-year holidays!
EDIT: @amaximus:
I have one more question I struggle with.
Because some devices’ connection will jump between the different repeaters (e.g. when I walk around with my phone).
That’s why I created the different dynamic groups.
I guess this dynamic structure cannot be taken into account with the sankey card?
Like:
@NCO3 I was thinking a little bit about your goal and the way it could be implemented. This is how would I approach the dynamic display:
the router and repetears each should have a template defined where their value is the number of statically connected devices + for each device that can be connected to multiple devices (e.g. mobiles, tablets, anything that moves around the house) a device*is_connected
e.g. mobileA would have a mobileA_repeater1, mobileA_repeater2, … mobileA_repeaterN and their template sensor would define it which will have value 1 for the the repeater that is connected to, the others will get automatically value of 0
so repeater1’s template value would be sum of the statically connected devices + the sum of mobileN_repeaterK
on the sankey-chart you could use option min_state: 1 (however I guess by default shows the ones with non-zero value) , therefore they will dynamically appear as child of repeater1 when connected to it and disappear from the rest of repeaterKs.
Please note that I haven’t tested this, it’s purely a theoretical solution.
Wow, thank you for spending even more time on my topic.
That’s an interesting approach.
For 7 repeaters / access points including the Fritzbox itself, it would require 7 times the number of portable devices in the house (around 8) additional sensors.
I am not sure yet, if this is worth the effort.
Because the auto-entities card uses some JS code filter the entities shown, I wonder if this would be possible for a Sankey card to move the entities dynamically between the groups (repeaters) as well.
But the JS code is far beyond my capabilities.
Anyway, I will start trying your approach and might come back with questions.
Again - thank you for your support!
You can easily do this with a type: remaining_child_state entity in the new section. Just make an entity like this with name Kitchen and add the 3 entities you want as children. There may be an example in the Readme.
Make sure to add Kitchen as child of EDF and remove the other 3 from EDF
Above is what im trying to get to. The 7 bullet points are sensors with the data. Can you combine multiple sensors into a single entity. E.g for the Solar entity it should be the sum for Solar2House + Solar2Battery + Solar2Grid
The house bit onwards I’ve sorted, its just the first half im struggling with.
You can combine entities with add_entities but I recommend just creating sum helper entities in HA instead of relying on the card for this. It is easier to debug, track and customize in HA
Sure this the code for my dashboard. This is for a GivEnergy battery system, so might be quite different for another manufacturer.
GivEnergy gives the following sensors:
Grid to Battery
Grid to House
Solar to House
Solar to Battery
Solar to Grid
Battery to House
Battery to Grid
I then had to create the following summed entities:
GridAll
- Grid to Battery
- Grid to House
SolarAll
- Solar to House
- Solar to Battery
- Solar to Grid
BatteryAll
- Battery to House
- Battery to Grid
MyGrid
- Solar to Grid
- Battery to Grid
MyHouse
- Grid to House
- Solar to House
- Battery to House
MyBattery
- Grid to Battery
- Solar to Battery