-
-
Notifications
You must be signed in to change notification settings - Fork 553
Description
Make sure you're on the latest stable or beta build
- I have tested this on the latest stable or beta release
Is this a bug in companion itself or a module?
- I believe this to be a bug in companion and not a specific module
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I am trying to parse incoming serial data to extract the current volume level and display the value on a streamdeck with a raspberry pi. I want to display the current volume level integer on a button of the stream deck.
I have a trigger monitoring the serial responses coming in from an iTach IP2SL (named SL3-02). I have done much troubleshooting. The trigger will assign a text or value to the integer, so long as I do not try to manipulate the incoming string.
Here is my original attempt, input into the value field in expression mode:
includes($(SL3-02:response), "4112") ? parseInt(substr($(SL3-02:response), includes($(SL3-02:response), "4112") + 4, 2), 16) : $(custom:display_vol55)
Subsequent tests that also fail:
(slice($(SL3-02:response), 12, 14), 16)
parseInt(slice($(SL3-02:response), 12, 14), 16)
parseInt(slice($(SL3-02:response).toString(), 12, 14), 16)
parseInt($(SL3-02:response).split("4112")[1].slice(0,2), 16)
parseInt($(SL3-02:response)[12].toString() + $(SL3-02:response)[13].toString(), 16)
parseInt(slice(String($(SL3-02:response)), indexOf(String($(SL3-02:response)), "4112") + 4, indexOf(String($(SL3-02:response)), "4112") + 6), 16)
substr(String($(SL3-02:response)), indexOf(String($(SL3-02:response)), "4112") + 4, 2)
parseInt(regEx($(SL3-02:response), /4112([0-9a-fA-F]{2})/, 1), 16)
I also tried forcing lower case, no change.
When I ran ' includes($(SL3-02:response), "4112") ? "FOUND_IT" : "NOT_FOUND" ', my custom variable printed "FOUND_IT" which makes me think the issues lies with the actual parsing and/or hex conversion.
Serial response is printed in the variable because I had $(SL3-02:response) in the value field.
Maybe I am missing something, maybe this is a bug.
Thank you for your time.
Steps To Reproduce
- Create custom variable (ie 'display_vol')
- Create trigger.
- Add event to trigger: 'On variable change.' My 'variable to watch' is my iTach serial device connection (so SL3-02:response)
- Add action: 'internal: Custom Variable: Set value' and set 'Custom variable' to 'display_vol'
- Put 'Value' into expression mode, then try to parse the response string with string manipulation and hex conversion.
Expected Behavior
I expect it to pull characters 12 & 13 from my serial response string (for example, aaff000341124da2). In this string the characters are '4' and 'd'. Then run a hex conversion on 4d to convert it to its integer value, here it would be 77 (current display volume). My end goal is just to print the variable value on a button so they can see the current volume on the stream deck.
Environment (please complete the following information)
- OS: Windows 10
- Browser: Chrome 144.0.7559.59
- Companion Version: v4.3.0+8950Additional context
Display in question is a Samsung QM55C. I am changing button feedbacks based on power responses with success, but that doesn't require string manipulation.
includes($(SL3-02:response), "411101") ? 1 : $(custom:display_power55)
includes($(SL3-02:response), "411100") ? 0 : $(custom:display_power55)
if 1 then power is on
if 0 then power is off