mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 18:40:14 -04:00
initial push
This commit is contained in:
@@ -0,0 +1,320 @@
|
||||
---
|
||||
# Calculation References:
|
||||
# https://nathanfiscus.github.io/inovelli-notification-calc/
|
||||
# https://community.inovelli.com/t/home-assistant-2nd-gen-switch-rgb-working/168/62
|
||||
# https://docs.google.com/spreadsheets/d/1bEpujdvBPZY9Fl61PZLUWuHanD2VAkRORFZ5D9xjLzA/edit?usp=sharing
|
||||
#
|
||||
# Changes:
|
||||
# July 22, 2020: Incorporating changes from Kevin Schlichter.
|
||||
# https://github.com/kschlichter/Home-Assistant-Inovelli-Red-Dimmer-Switch
|
||||
#
|
||||
# September 17, 2020: There are some massive improvements to my version of this code. Here are the highlights:
|
||||
# 1. Choose - using the recently added choose: feature a separate call has been created for the Z-wave and OZW
|
||||
# versions of the service call.
|
||||
# 2. Variables - using 0.115’s new variables: feature the variables sent each service call only have to be
|
||||
# calculated once.
|
||||
# 3. Supported Features - I realized that I could probably tell the difference between modules using the
|
||||
# “supported_features” attribute of each switch. For example my dimmer’s supported features is “33”.
|
||||
#
|
||||
# September 18, 2020: Added "model" parameter with options of dimmer, switch, combo_light, combo_fan. This replaces
|
||||
# supported_features as the combo fan/light switch also had the same supported_features value.
|
||||
#
|
||||
# February 24, 2021: Added support for Z-Wave JS in place of OpenZwave (ozw).
|
||||
# The ozw code is remarked out for those that still need it.
|
||||
#
|
||||
# February 27, 2021:
|
||||
# 1. Added zwave_integration at top of "variables:" section to allow users to define which integration is
|
||||
# installed ("zwave", "ozw", "zwave_js"). I just don't see a simple way to auto-detect this.
|
||||
# 2. Added a comment describing the "model" variable.
|
||||
# 3. Replaced personal "script.debug" service call with universal "persistent_notification.create".
|
||||
# Unremarking these lines could help you troubleshoot why something isn't working as expected.
|
||||
# 4. Updated broken spreadsheet link with public copy stored in my Google Docs account.
|
||||
# Thanks for the heads up Kevin Schlichter!
|
||||
#
|
||||
# March 26, 2021
|
||||
# 1. Added fields to help users experimenting in the Services Developer Tool.
|
||||
#
|
||||
# April 3, 2021
|
||||
# Incorporated @firstof9's changes:
|
||||
# 1. Set execution mode to "parallel" to all this script to potentially run on more than one devices simultaneously.
|
||||
# 2. Implement ZWave JS's new zwave_js.bulk_set_partial_config_parameters command.
|
||||
# Source: https://gist.github.com/firstof9/b88d072a81c54b314fe7ddb901fc5c29
|
||||
#
|
||||
mode: parallel
|
||||
variables:
|
||||
# REQUIRED to be one of these options: "zwave", "ozw", "zwave_js"
|
||||
# Advanced: If you'd like to have your device list filtered in the Services Developer Tool,
|
||||
# then unremark out "integration: zwave_js" under the fields section, and change the integration
|
||||
# name to match.
|
||||
zwave_integration: "zwave_js"
|
||||
|
||||
# * Strongly recommended -> Use the passed model type ("dimmer", "switch", "combo_light") when present.
|
||||
# * If not present, then attempt to identify the type using the "product_name" attribute (which is only
|
||||
# unfortunately only available in the original zwave integration).
|
||||
# * Finally, assume the model type is "dimmer".
|
||||
model: |
|
||||
{% if model is string %}
|
||||
{{ model }}
|
||||
{%- elif state_attr(entity_id, 'product_name') is string %}
|
||||
{%- if 'LZW31' in state_attr(entity_id, 'product_name') %}
|
||||
dimmer
|
||||
{%- elif 'LZW36' in state_attr(entity_id, 'product_name') %}
|
||||
combo_light
|
||||
{%- else %}
|
||||
switch
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
dimmer
|
||||
{%- endif %}
|
||||
parameters:
|
||||
dimmer: 16
|
||||
combo_light: 24
|
||||
combo_fan: 25
|
||||
switch: 8
|
||||
node_id: '{{ state_attr(entity_id,"node_id") }}'
|
||||
color: |
|
||||
{%- if color is not number %}
|
||||
{{ color|default("Yellow")|title }}
|
||||
{%- else %}
|
||||
{{ color|int }}
|
||||
{% endif %}
|
||||
# 1-10
|
||||
level: "{{ level|default(4)|int }}"
|
||||
duration: '{{ duration|default("Indefinitely")|title }}'
|
||||
effect: '{{ effect|default("Blink")|title }}'
|
||||
colors:
|
||||
"Off": 0
|
||||
"Red": 1
|
||||
"Orange": 21
|
||||
"Yellow": 42
|
||||
"Green": 85
|
||||
"Cyan": 127
|
||||
"Teal": 145
|
||||
"Blue": 170
|
||||
"Purple": 195
|
||||
"Light Pink": 220
|
||||
"Pink": 234
|
||||
durations:
|
||||
"Off": 0
|
||||
"1 Second": 1
|
||||
"2 Seconds": 2
|
||||
"3 Seconds": 3
|
||||
"4 Seconds": 4
|
||||
"5 Seconds": 5
|
||||
"6 Seconds": 6
|
||||
"7 Seconds": 7
|
||||
"8 Seconds": 8
|
||||
"9 Seconds": 9
|
||||
"10 Seconds": 10
|
||||
"15 Seconds": 15
|
||||
"20 Seconds": 20
|
||||
"25 Seconds": 25
|
||||
"30 Seconds": 30
|
||||
"35 Seconds": 35
|
||||
"40 Seconds": 40
|
||||
"45 Seconds": 45
|
||||
"50 Seconds": 50
|
||||
"55 Seconds": 55
|
||||
"60 Seconds": 60
|
||||
"2 Minutes": 62
|
||||
"3 Minutes": 63
|
||||
"4 Minutes": 64
|
||||
"10 Minutes": 70
|
||||
"15 Minutes": 75
|
||||
"30 Minutes": 90
|
||||
"45 Minutes": 105
|
||||
"1 Hour": 120
|
||||
"2 Hours": 122
|
||||
"Indefinitely": 255
|
||||
effects_dimmer:
|
||||
"Off": 0
|
||||
"Solid": 1
|
||||
"Chase": 2
|
||||
"Fast Blink": 3
|
||||
"Slow Blink": 4
|
||||
"Blink": 4
|
||||
"Pulse": 5
|
||||
"Breath": 5
|
||||
effects_switch:
|
||||
"Off": 0
|
||||
"Solid": 1
|
||||
"Fast Blink": 2
|
||||
"Slow Blink": 3
|
||||
"Blink": 3
|
||||
"Pulse": 4
|
||||
"Breath": 4
|
||||
sequence:
|
||||
# Preform the Inovelli math.
|
||||
- variables:
|
||||
parameter: "{{ parameters[model|lower] }}"
|
||||
color: "{{ colors[color|title]|int }}"
|
||||
duration: "{{ durations[duration|title] }}"
|
||||
effect: |
|
||||
{% if model == "switch" %}
|
||||
{{- effects_switch[effect|title] }}
|
||||
{%- else %}
|
||||
{{- effects_dimmer[effect|title] }}
|
||||
{% endif %}
|
||||
inovelli_math: |
|
||||
{%- if effect|int > 0 %}
|
||||
{{ color|int + (level|int * 256) + (duration|int * 65536) + (effect|int * 16777216) }}
|
||||
{%- else %}
|
||||
0
|
||||
{% endif %}
|
||||
# Unremark to provide an notification with troubleshooting information.
|
||||
# - service: persistent_notification.create
|
||||
# data:
|
||||
# title: "DEBUG: script.inovelli_led"
|
||||
# notification_id: "inovelli_led"
|
||||
# message: |
|
||||
# zwave_integration: {{ zwave_integration }}
|
||||
# model: {{ model }}
|
||||
# color: '{{ color|title }}'
|
||||
# level: '{{ level }}'
|
||||
# duration: '{{ duration|title }}'
|
||||
# effect: '{{ effect|title }}'
|
||||
# node_id: '{{ node_id }}'
|
||||
# parameter: '{{ parameter }}'
|
||||
# value: '{{ inovelli_math }}'
|
||||
|
||||
- choose:
|
||||
# The Z-Wave JS integration requires this service call.
|
||||
- conditions:
|
||||
- '{{ zwave_integration == "zwave_js" }}'
|
||||
sequence:
|
||||
# Clear the previous effect.
|
||||
- service: zwave_js.bulk_set_partial_config_parameters
|
||||
target:
|
||||
entity_id: "{{ entity_id }}"
|
||||
data:
|
||||
parameter: "{{ parameter }}"
|
||||
value: 0
|
||||
|
||||
# Start the new effect.
|
||||
- service: zwave_js.bulk_set_partial_config_parameters
|
||||
target:
|
||||
entity_id: "{{ entity_id }}"
|
||||
data:
|
||||
parameter: "{{ parameter }}"
|
||||
value: "{{ inovelli_math }}"
|
||||
|
||||
# # The OZW integration requires this service call.
|
||||
# - conditions:
|
||||
# - '{{ zwave_integration == "ozw" }}'
|
||||
# sequence:
|
||||
# # Clear the previous effect.
|
||||
# - service: ozw.set_config_parameter
|
||||
# data:
|
||||
# node_id: "{{ node_id }}"
|
||||
# parameter: "{{ parameter }}"
|
||||
# value: 0
|
||||
|
||||
# # Start the new effect.
|
||||
# - service: ozw.set_config_parameter
|
||||
# data:
|
||||
# node_id: "{{ node_id }}"
|
||||
# parameter: "{{ parameter }}"
|
||||
# value: "{{ inovelli_math }}"
|
||||
|
||||
# # The Z-wave integration requires this service call.
|
||||
# default:
|
||||
# # Clear the previous effect.
|
||||
# - service: zwave.set_config_parameter
|
||||
# data:
|
||||
# node_id: "{{ node_id }}"
|
||||
# parameter: "{{ parameter }}"
|
||||
# size: 4
|
||||
# value: 0
|
||||
|
||||
# # Start the new effect.
|
||||
# - service: zwave.set_config_parameter
|
||||
# data:
|
||||
# node_id: "{{ node_id }}"
|
||||
# parameter: "{{ parameter }}"
|
||||
# size: 4
|
||||
# value: "{{ inovelli_math }}"
|
||||
|
||||
fields:
|
||||
entity_id:
|
||||
description: Light or switch which represents
|
||||
example: light.red_series_dimmer
|
||||
selector:
|
||||
entity:
|
||||
#integration: zwave_js
|
||||
model:
|
||||
description: 'Device type: dimmer (default), switch, combo_light'
|
||||
example: dimmer
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- dimmer
|
||||
- switch
|
||||
- combo_light
|
||||
color:
|
||||
description: 'Choose a color.'
|
||||
example: purple
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- "Off"
|
||||
- Red
|
||||
- Orange
|
||||
- Yellow
|
||||
- Green
|
||||
- Cyan
|
||||
- Teal
|
||||
- Blue
|
||||
- Purple
|
||||
- Light Pink
|
||||
- Pink
|
||||
effect:
|
||||
description: 'Choose an effect.'
|
||||
example: blink
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- "Off"
|
||||
- Solid
|
||||
- Chase
|
||||
- Fast Blink
|
||||
- Slow Blink
|
||||
- Blink
|
||||
- Pulse
|
||||
- Breath
|
||||
duration:
|
||||
description: 'How long should the effect run?'
|
||||
example: 10 seconds
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- "Off"
|
||||
- 1 Second
|
||||
- 2 Seconds
|
||||
- 3 Seconds
|
||||
- 4 Seconds
|
||||
- 5 Seconds
|
||||
- 6 Seconds
|
||||
- 7 Seconds
|
||||
- 8 Seconds
|
||||
- 9 Seconds
|
||||
- 10 Seconds
|
||||
- 15 Seconds
|
||||
- 20 Seconds
|
||||
- 25 Seconds
|
||||
- 30 Seconds
|
||||
- 35 Seconds
|
||||
- 40 Seconds
|
||||
- 45 Seconds
|
||||
- 50 Seconds
|
||||
- 55 Seconds
|
||||
- 60 Seconds
|
||||
- 2 Minutes
|
||||
- 3 Minutes
|
||||
- 4 Minutes
|
||||
- 10 Minutes
|
||||
- 15 Minutes
|
||||
- 30 Minutes
|
||||
- 45 Minutes
|
||||
- 1 Hour
|
||||
- 2 Hours
|
||||
- Indefinitely
|
||||
Reference in New Issue
Block a user