Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. zwave_inovelli_led_color:
  2. alias: Change LED color on Inovelli Switch
  3. sequence:
  4. - service: zwave.set_config_parameter
  5. data_template:
  6. node_id: '{{node_id}}'
  7. parameter: 16
  8. size: 4
  9. value: >
  10. {% if color is number and color >= 0 and color <= 255 %}
  11. {% set hx=color %}
  12. {% elif color=="red" %}
  13. {% set hx=1 %}
  14. {% elif color=="orange" %}
  15. {% set hx=21 %}
  16. {% elif color=="green" %}
  17. {% set hx=85 %}
  18. {% elif color=="blue" %}
  19. {% set hx=170 %}
  20. {% elif color=="pink" %}
  21. {% set hx=234 %}
  22. {% elif color=="yellow" %}
  23. {% set hx=42 %}
  24. {% else %}
  25. {% set hx=127 %}
  26. {% endif %}
  27. {% if level is number and level >= 0 and level <= 10 %}
  28. {% set lx=level*256 %}
  29. {% else %}
  30. {% set lx = 10*256 %}
  31. {% endif %}
  32. {% if duration is number %}
  33. {% if duration >= 0 and duration <= 255 %}
  34. {% set dx = duration*65536 %}
  35. {% else %}
  36. {% set dx = 10*65536 %}
  37. {% endif %}
  38. {% elif duration == "on" %}
  39. {% set dx = 255*65536 %}
  40. {% else %}
  41. {% set dx = 10*65536 %}
  42. {% endif %}
  43. {% if effect is number and effect >= 0 and effect <= 5 %}
  44. {% set ex = effect * 16777216 %}
  45. {% elif effect=="off" %}
  46. {% set ex = 0 %}
  47. {% elif effect=="solid" %}
  48. {% set ex = 1 * 16777216 %}
  49. {% elif effect=="chase" %}
  50. {% set ex = 2 * 16777216 %}
  51. {% elif effect=="fast_blink" %}
  52. {% set ex = 3 * 16777216 %}
  53. {% elif effect=="slow_blink" %}
  54. {% set ex = 4 * 16777216 %}
  55. {% elif effect=="pulse" %}
  56. {% set ex = 5 * 16777216 %}
  57. {% else %}
  58. {% set ex = 5 * 16777216 %}
  59. {% endif %}
  60. {{(hx+lx+dx+ex) | int}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement