@getut wrote:
I’ve found tons of stuff about adding iotawatt, but I’m missing a step somewhere. I found the thread on a jinja template to pull in all the sensors associated with it but it isn’t working for me.
Here is the jinja template from the other thread. The error I am getting is "Error rendering template: UndefinedError: ‘None’ has no attribute ‘attributes’
I have already added the rest sensor iotawatt into my configuration.yaml and rebooted and HA can see the iotawatt. If I check states in dev tools, I can even see all my outputs and inputs there. The template just doesn’t run and I can’t see my inputs and outputs outside of dev tools.
sensor: - platform: template sensors: {%- for i in range(states.sensor.iotawatt.attributes.inputs| length) %} {%- set input = states.sensor.iotawatt.attributes.inputs[i] %} {%- if input.Watts %} iotawatt_input_{{ input.channel }}: value_template: {{"{{states.sensor.iotawatt.attributes.inputs["}}{{i}}{{"].Watts}}"}} unit_of_measurement: Watts {%- endif %} {%- endfor %} {%- for i in range(states.sensor.iotawatt.attributes.outputs| length) %} {%- set output = states.sensor.iotawatt.attributes.outputs[i] %} iotawatt_output_{{ output.name }}: value_template: {{"{{states.sensor.iotawatt.attributes.outputs["}}{{i}}{{"].value}}"}} unit_of_measurement: {{ output.units }} {%- endfor %}
Posts: 3
Participants: 2