Hi @CM000n,
Thank you for the examples, they helped me very much.
I started to use the Component from @hthiery right now, it is fantastic!
Concerning the FritzDECT Switches I had a little problem:
When trying to read the current Power Consumption of a FritzDECT 100 (or 200) as in your example above with:
value_template: ‘{{ states.switch.stecker_trockner.attributes[“current_power_w”] | float | round(1) }}’
I got this:
Error rendering template: UndefinedError: ‘mappingproxy object’ has no attribute ‘current_power_w’
A little research showed the following behaviour:
It doesn’t matter if the switch is set to on or off, if there is no load (no current flow) at the FritzDECT Plug, the attribute is missing.
So, depending on the current flow (zero vs nonzero), the attribute “current_power_w” disappears/appears dynamically in the state list.
My workaround to avoid the error above is this template in the sensor definition:
value_template: >
{% if states.switch.stecker_trockner.attributes["current_power_w"] %}
{{ states.switch.stecker_trockner.attributes["current_power_w"] | float | round(1) }}
{% else %}
0.0
{% endif %}
Seems to work, but the question is,
Why has (only?) this attribute such a dynamic behaviour ??
Anyway: Thanks to @hthiery for his great work to integrate FritzDect into Home Assistant!
BTW:
I’m Using HassIO 0.84.2
FritzBox 7490 Firmware Release: 7.01
.