🔘

volume_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 because of requests to extend the function of my BP's with how to convert cube rotation to volume in other places. Research found me this Post from Petro which had a very elegant solution to the problem, It was very easy decision to adopt it here.

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 and provide action data. This script has one !input in the Blueprint screen to set the sensitivity of the rotation to volume changes. 30 seemed about right, but adjust as needed.

Because all the data is added to control the action live at each use this is the only !input. This requires you call this generated script wth 2 data values when you want it to run. 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 media_player 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.

Sample call / use of this script for ZHA:
yaml - service: script.cube_dimmer_control_bp data: angle: '{{ trigger.event.data.args.relative_degrees | default(0.1) | float(0.2) }}' mp: media_player.farg

Sample call / use of this script for Z2M:
yaml - service: script.cube_dimmer_control_bp data: angle: '{{ trigger.payload_json.action_angle | default(0.1) | float(0.2) }}' mp: media_player.farg

🗿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.

200
Stars
7.3K
Views
964
Imports

Import to Home Assistant

Click to import this blueprint directly into your Home Assistant instance.

Configuration

Requires 1 input to configure

Number

Source Code

View on GitHub

Details

Complexity
Simple
Author
SirGoodenough
Last Updated
Nov 4, 2025

Related Blueprints

More button actions automations you might like

View all
🔘
Button Actions
complex
17 inputs

Send a mobile notification when add-on update is available

Send a mobile notification when add-on update is available

Send a notification to the provided mobile devices whenever an update for the given Home Assistant add-on is available. Supports full notification customization, notification groups, auto-dismissal when the add-on is updated and button for starting the update directly from your notification tray, with optional notification after the update completed succesfully. 📕 Full documentation regarding this blueprint is available here. 🚀 This blueprint is part of the Awesome HA Blueprints project. ℹ️ Version 2021.10.26
addon
text
entity
+2
1.2K1.6K2.5K
🔘
Button Actions
complex
37 inputs

Controller - IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote

Controller - IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote

Controller automation for executing any kind of action triggered by the provided IKEA E1524/E1810 TRÅDFRI Wireless 5-Button Remote. Allows to optionally loop an action on a button long press. Supports deCONZ, ZHA, Zigbee2MQTT. Automations created with this blueprint can be connected with one or more Hooks supported by this controller. Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

More Info

ℹ️ Version 2025.04.19 📝 Changelog 📕 Full documentation regarding this blueprint is available here. 🚀 This blueprint is part of the Awesome HA Blueprints project. Please consider leaving a star on GitHub! 🌟
select
device
entity
+3
1.2K9.2K702
🔘
Button Actions
complex
19 inputs

Controller - IKEA E1743 TRÅDFRI On/Off Switch & Dimmer

Controller - IKEA E1743 TRÅDFRI On/Off Switch & Dimmer

Controller automation for executing any kind of action triggered by the provided IKEA E1743 TRÅDFRI On/Off Switch & Dimmer. Allows to optionally loop an action on a button long press. Supports deCONZ, ZHA, Zigbee2MQTT. Automations created with this blueprint can be connected with one or more Hooks supported by this controller. Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

More Info

ℹ️ Version 2025.04.19 📝 Changelog 📕 Full documentation regarding this blueprint is available here. 🚀 This blueprint is part of the Awesome HA Blueprints project. Please consider leaving a star on GitHub! 🌟
select
device
entity
+3
1.2K1.7K786
🔘
Button Actions
complex
15 inputs

Controller - IKEA E1744 SYMFONISK Rotary Remote

Controller - IKEA E1744 SYMFONISK Rotary Remote

Controller automation for executing any kind of action triggered by the provided IKEA E1744 SYMFONISK Rotary Remote. Allows to optionally loop a custom action during controller rotation. Supports deCONZ, ZHA, Zigbee2MQTT. Automations created with this blueprint can be connected with one or more Hooks supported by this controller. Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

More Info

ℹ️ Version 2025.04.19 📝 Changelog 📕 Full documentation regarding this blueprint is available here. 🚀 This blueprint is part of the Awesome HA Blueprints project. Please consider leaving a star on GitHub! 🌟
select
device
entity
+3
1.2K6.0K4.8K
🔘
Button Actions
complex
13 inputs

Controller - IKEA E1766 TRÅDFRI Open/Close Remote

Controller - IKEA E1766 TRÅDFRI Open/Close Remote

Controller automation for executing any kind of action triggered by the provided IKEA E1766 TRÅDFRI Open/Close Remote. Supports deCONZ, ZHA, Zigbee2MQTT. Automations created with this blueprint can be connected with one or more Hooks supported by this controller. Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

More Info

ℹ️ Version 2025.04.19 📝 Changelog 📕 Full documentation regarding this blueprint is available here. 🚀 This blueprint is part of the Awesome HA Blueprints project. Please consider leaving a star on GitHub! 🌟
select
device
entity
+3
1.2K10.6K4.0K