dimmer_control_4_magic_cube_and_other_things - 2023-12-07 by SirGoodenough
This script was invented to be used with my Magic Cube Blueprints. I released it as a standalone Script Blueprint because I saw others struggling with how so convert cube rotation to light dimming in other places.
To use this blueprint, install it from the source in the normal way. After that add your unique name for the Script, and add an icon and change the entity_id if desired. You should only need to run the blueprint once, as you will be calling the unique name/entity you added above to use the code. This script has 2 inputs in the Blueprint screen to set the sensitivity of the rotation action and the minimum bbrightness level for your lights. If the rotation is too sensitive the lights will change from dim to bright in too short of a rotation so make it less sensitive. If the lights flicker at low brightness, raise the minimum brightness level to stop it. The data is sent to the generated script to control the action live at each use. You only need to ececute this blueprint generator script if you wish to change in input values or create another dimmer script.
This requires you call this script wth 2 data values. One is a positive or negative number between 360 and -360 that in the original, represents the input angle from the cube movement. The other data point is the entity of the light or light group that you are trying to control.
NOTE: the trigger variable below will be different for Z2M and ZHA and others. Look at my documentation for that cube integration help if you need it.
🗿Notice👮🏿♂️:
-
Copies of the original Blueprint that were converted via the 'Take Control' feature or other means are officially not supported by me.
-
I may or may not be able to support you when you have a problem after you make changes to my code, as some of the code is no longer mine.
-
I & my license also require attribution as a link back to the original should you use this code in your own creation.
-
Here is a link to my license & the original github post expected to be followed & referenced as attribution should you use this code elsewhere.
Sample call / use of this script for ZHA:
- service: script.cube_dimmer_control_bp data: angle: '{{ trigger.event.data.args.relative_degrees | default(0.1) | float(0.2) }}' light: light.grp_studioSample call / use of this script for Z2M:
- service: script.cube_dimmer_control_bp data: angle: '{{ trigger.payload_json.action_angle | default(0.1) | float(0.2) }}' light: light.grp_kitch
Import to Home Assistant
Click to import this blueprint directly into your Home Assistant instance.
Configuration
Requires 3 inputs to configure
Source Code
View on GitHubDetails
Explore More
Related Blueprints
More button actions automations you might like