Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- zwave_inovelli_led_color:
- alias: Change LED color on Inovelli Switch
- sequence:
- - service: zwave.set_config_parameter
- data_template:
- node_id: '{{node_id}}'
- parameter: 16
- size: 4
- value: >
- {% if color is number and color >= 0 and color <= 255 %}
- {% set hx=color %}
- {% elif color=="red" %}
- {% set hx=1 %}
- {% elif color=="orange" %}
- {% set hx=21 %}
- {% elif color=="green" %}
- {% set hx=85 %}
- {% elif color=="blue" %}
- {% set hx=170 %}
- {% elif color=="pink" %}
- {% set hx=234 %}
- {% elif color=="yellow" %}
- {% set hx=42 %}
- {% else %}
- {% set hx=127 %}
- {% endif %}
- {% if level is number and level >= 0 and level <= 10 %}
- {% set lx=level*256 %}
- {% else %}
- {% set lx = 10*256 %}
- {% endif %}
- {% if duration is number %}
- {% if duration >= 0 and duration <= 255 %}
- {% set dx = duration*65536 %}
- {% else %}
- {% set dx = 10*65536 %}
- {% endif %}
- {% elif duration == "on" %}
- {% set dx = 255*65536 %}
- {% else %}
- {% set dx = 10*65536 %}
- {% endif %}
- {% if effect is number and effect >= 0 and effect <= 5 %}
- {% set ex = effect * 16777216 %}
- {% elif effect=="off" %}
- {% set ex = 0 %}
- {% elif effect=="solid" %}
- {% set ex = 1 * 16777216 %}
- {% elif effect=="chase" %}
- {% set ex = 2 * 16777216 %}
- {% elif effect=="fast_blink" %}
- {% set ex = 3 * 16777216 %}
- {% elif effect=="slow_blink" %}
- {% set ex = 4 * 16777216 %}
- {% elif effect=="pulse" %}
- {% set ex = 5 * 16777216 %}
- {% else %}
- {% set ex = 5 * 16777216 %}
- {% endif %}
- {{(hx+lx+dx+ex) | int}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement