Closed ValonVN0 closed 3 weeks ago
I've used an empty scene for this.
I've used an empty scene for this.
You're absolutely right,
Super simple now I have my hands on the tech
Only oddity at the moment is I'm seeing the event getting called twice when a button is pressed, which isn't the event of the world I'm sure I can add a buffer there to reject additional messages for a second or so after the first.
This is how I've been suppressing the duplicate messages, in on_message()
stripping out lastCompleted
and lastTriggered
then comparing to the previous message. Those values will differ between the messages, so this is pretty easy unless you need them for something.
data.pop('lastCompleted', None)
data.pop('lastTriggered', None)
if data == previous_data: return
{your code here}
previous_data = data
Nice one, appreciate that like you say a nice easy workaround,
Only issue now seems to be stemming from the controllers only registering input from one of the buttons.
Tested with both STYRBAR and RODRET, attempting an int loop to just add scenes based on the button index,
Using an example value of 5 for testing, seems to reach 3 afterwhich if throws
{"error":"Error","message":"\"triggers[1]\" does not match any of the allowed types"}
Little weird as Styrbar has 4 buttons and Rodret has 2 but hey ho, regardless the hub only seems to be firing events for the one button, which seems to trigger all the scenes that were added for that device.
New to this module so quite posisble I'm missing the obvious but I'd assume when adding the scene triggers for the controller, buttonIndex would refer to the button on the controller, however perhaps the hub's taking the event in the literal sense given the app itself just links the controller and doesn't offer options for click type, which button it was, etc.
Makes sense for the app as these controllers are just meant to switch on/off/ or dim a light. Maybe this is a mistake on my part and I should've just gone with a SOMRIG for a dedicated shortcut button?
I haven't had much of a play around coding with the Styrbar or Rodret, but as they don't publish any events themselves, are you planning on polling them for their status? I found out for myself that they supported additional click patterns as when you switch the light on with a long press, it will start out dim and gradually get brighter the longer you press it.
At this moment in time I've just got a loop on startup which grabs the current controllers and attempts to assign fake scenes to each click type, using the device ID as reference for the scene name. So far it's been fantastic.
Effective within reason for the shortcut controller, dimmer, though it's a slight shame I can't utilise all 4 buttons on the styrabr.
It's put me off grabbing the SYMFONISK to be fair, I love the concept of one controller having no many options via the buttons but it's a lot to spend to find out it doesn't work to its full potential
Hey there,
First off, greatly appreciate the work put in here, both the main dev and those that are contributing,
I'm due to be receiving a handful of dirigera tech in the next few days that I'll be tinkering with but looking through the documentation here I can't seem to find how to accurately check for when the shortcut buttons are actually pressed.
I can see a way to get the list of controllers and their on/off boolean, however no function for when it's actually pressed.
Perhaps I need to have the button switch to a "scene" which I can then catch that via the hub events? Suppose I'll get a better idea once I have my hands on the tech itself.
Thanks in advance for the help!