{% for var in custom_html_panel.variables.all %}
{% if var.active and var.device.active %}
{% endif %}
{% endfor %}
{% for var in custom_html_panel.variable_properties.all %}
{% if var.variable.active and var.variable.device.active %}
{% endif %}
{% endfor %}
{{ custom_html_panel.html|safe }}