-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cell Voltage/ Resistance #170
Comments
Hi!
Yes, have a look at line 17 of the example template in the template editor of the developer tools.
No, they are not available, they do not fit the current UI architecture and are specific to the JK BMS, so I'm quite hesitant to implement and maintain those. You can still look them up in the app by temporarily disabling the integration. Best regards, |
got it to this point: `
{% endfor %}` But how do I now replace the "0"'s in the loop body by some kind of index counter ? |
If you install Mushroom you could use this: |
Hi .. thanks. I'll have a look at this later this evening. But anyway --
and the output of it in the Template editor looks like this: template: >
But after restart HA is Got this Error MSG: Invalid config for 'template' at configuration.yaml, line 28: expected a dictionary '', got "\n{%- set ns = namespace(count = 0) -%} {%- for attr in states.sensor.sp18b2311300049_delta_voltage.attributes.cell_voltages %} - sensor:\n - name: cell_voltage_{{ ns.count }}\n state: >-\n {{ state_attr('sensor.sp18b2311300049_delta_voltage', 'cell_voltages')[ns.count] }}\n unit_of_measurement: 'V'\n state_class: measurement\n device_class: voltage\n availability: >- \n {{ has_value('sensor.sp18b2311300049_delta_voltage') }}\n{% set ns.count = ns.count + 1 %} ... Does this mean what you meant with it is not possible to autogenerate Sensors in the for loop ? |
Correct, the loop does not work to generate configuration entries in the YAML file. The loop (template) only works within |
modding the code with some "raw" lines I could at least use this script in the template Editor to generate the inlined Template code automatically ;-)
But is it possible to "group" this sensors now into a Device ? |
Clever idea. 😃 |
Checklist
Describe the issue
I have a question to this Template od the Manual:
_template:
state: >-
{{ state_attr('sensor.smartbat_...delta_voltage', 'cell_voltages')[0] }}
unit_of_measurement: 'V'
state_class: measurement
device_class: voltage
availability: >-
{{ has_value('sensor.smartbat...delta_voltage') }}
is there a (Jinja) syntax doing a loop over all cell voltages ? (so I do not need to copy this block 48 times in my system )
And is the Cell resistance also avaliable? Or should I add a Feature request for it ?
The text was updated successfully, but these errors were encountered: