Comments (2)
Here's a workaround I use for controlling my Sonos volume. The trick is to create a helper input_number to use as your entity for Stream Deck and then do the automation in Home Assistant. For me, I want to add or subtract the number of "ticks" to the current volume. In your case, you'd probably use a slightly different method, such as choose if the number is positive, send one IR code, and negative send a different IR code. Either way, it's a good idea to reset your input_number after each automation so that when you turn the dial a second time, HA knows it's a different value. Here's my code for you to modify. If you need help, let me know what your automation is for each IR code and I'll try to help with something more specific. Anyways, here's what I use:
-
Create an input_number helper with a min value of -100 and a max value of 100.
-
From the Stream Deck config, go to the Encoder actions and under Rotation, select your input_number, use the "Set" service and the Service Data contains the following:
{
"value":{{ticks}}
}
- From Home Assistant, create an automation that reads the current value of your speaker volume, adds the increment (negative values will subtract) from the input_number, waits a few milliseconds then resets to 0. For example, here's what I have for my Sonos speaker. In your case, instead of :
alias: Media Stream Deck Volume Dial Sonos
description: ""
trigger:
- platform: state
entity_id:
- input_number.stream_deck_sonos_volume
condition:
- condition: not
conditions:
- condition: state
entity_id: input_number.stream_deck_sonos_volume
state: "0"
action:
- service: media_player.volume_set
data:
volume_level: >-
{% set increment = states('input_number.stream_deck_sonos_volume') |
float / 100 | round(2) %} {% set current =
state_attr('media_player.sonos_flex_room', 'volume_level') %} {{current
+ increment}}
target:
entity_id: media_player.sonos_flex_room
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 10
- service: input_number.set_value
data:
value: 0
target:
entity_id: input_number.stream_deck_sonos_volume
mode: single
from streamdeck-homeassistant.
Thanks for your "workaround" (wich is in fact it is a valid approach to the problem).
@zeekens Of course it would be possible to add different service configurations for left/right rotations. The problem is, that the configuration is getting more and more complex. I am not yet sure, if and how i want to add this feature...
from streamdeck-homeassistant.
Related Issues (20)
- Addon keeps disconnecting HOT 4
- Set Icon image based on value in HA (i.e. Spofity album cover)
- Feature Request - Display Multiple sensors on one button HOT 1
- Only showing status, not able to activate HOT 7
- Stream Deck + Enhancements HOT 1
- Question - Climate Control for Stream Deck Plus HOT 5
- QtWebEngine crash HOT 1
- Actions now require (Optional) Entity HOT 2
- [Feature] Remove button background (-> transparent on dial display)
- [Feature] Add "heat" as active state for custom icons.
- Custom title ignored on knobs? HOT 3
- Not all HA icons are supported? HOT 2
- Plugin failing to communicate HOT 30
- Weather domain is showing wrong unit HOT 1
- Custom icon entities ignore actual state when pressed HOT 5
- Plugin Starts Disconnected HOT 5
- Improve Entity selection
- Update not in Elgato Store HOT 2
- Improve display image rendering. HOT 1
- Unable to use any actions HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streamdeck-homeassistant.