Advanced Command & Feedback Reference – MyURemote

Advanced Command & Feedback Reference

This page explains how commands, responses, query timing and UI feedback parsing work inside MyURemote.

MyURemote is not command-driven. It is a response-driven execution system. Commands trigger communication. Responses determine UI state.

A command can work perfectly on the network while the UI still shows nothing. In that case, the transport is usually correct and the feedback parsing is wrong.

Contents

1. The real execution model 2. Action commands vs query commands 3. Which queries are called by the UI? 4. Feedback fields used by MyURemote 5. The feedback parser model 6. StopSign rules 7. Hex, text and escaped values 8. HEOS example: title, artist, station, volume 9. What OK really means 10. Troubleshooting checklist

1. The real execution model

UI action
  → sendCommandFromDevice()
  → extender.executeCommand()
  → localhost gateway
  → socket / websocket / secure transport
  → device
  → raw response
  → AnalyseFeedback()
  → display_line update
A successful write does not update the display. Only a response that is parsed correctly updates the display.

2. Action commands vs query commands

Action command

PLAY → player/set_play_state?pid={pid}&state=play
  • Changes device state.
  • May return only success or nothing useful.
  • Does not automatically update title, artist, volume or power state.

Query command

TITLE QUERY → player/get_now_playing_media?pid={pid}
  • Requests current device state.
  • Returns raw data.
  • Feeds AnalyseFeedback().
If a button works but the display does not change, check the query and feedback settings, not only the action command.

3. Which queries are called by the UI?

MyURemote does not continuously run every possible query. The active zone, input and enabled feedback flags determine which queries are called.

Main scheduler

fnQueryState()
  → fnQueryStateAmplifier()       immediately
  → fnQueryRow1()                 after 2 seconds
  → fnQueryStateAmplifier()       after 3 seconds
  → fnQueryRow2()                 after 5 seconds
  → fnQueryStateAmplifier()       after 6 seconds
  → fnQueryRow3()                 after 8 seconds
  → fnQueryStateAmplifier()       after 9 seconds
  → fnQueryRow4()                 after 11 seconds

Amplifier queries

FunctionCommand nameFeedback functionPurpose
fnQueryStateAmplifier() SRC QUERY GetFeedbackSRC() Detect amplifier input/source.
fnQueryStatePWR() PWR QUERY GetFeedbackPWR() Detect amplifier power state.
fnQueryStateVolume() Vol QUERY GetFeedbackVolume() Read volume and update volume display.

Current input device queries

FunctionCommand nameFeedback variablesPurpose
fnQueryTitle() TITLE QUERY TitlePrefix, TitleHex, TitlePos, TitleDig, TitleStopSign Read title/song name and update display line 3 and 6.
fnQueryArtist() ARTIST QUERY ArtistPrefix, ArtistHex, ArtistPos, ArtistDig, ArtistStopSign Read artist name and update display line 3 and 6.
fnQueryStation() STATION QUERY StationPrefix, StationHex, StationPos, StationDig, StationStopSign Read station/source name and update display line 3 and 6.
fnQueryAmpDispInfo() DISPINFO QUERY DispInfoPrefix, DispInfoHex, DispInfoPos, DispInfoDig, DispInfoStopSign Read display information from the amplifier.
fnQueryStateRDS() RDS QUERY rdsPrefix, rdsHex, rdsPos, rdsDig, rdsStopSign Read FM/RDS text.
The command name must exist in devices.js. For example, TITLE QUERY is not magic. It is a configured command that is sent to the current input device.

4. Feedback fields used by MyURemote

Each feedback type has its own command and parsing settings. The parser does not know what a title, artist or volume is. It only receives a raw response and extraction rules.

UI valueQuery commandPrefix settingStopSign settingHex setting
Volume Vol QUERY VOL Prefix VOL StopSign VOL Hex
Power PWR QUERY PWR Prefix PWR StopSign PWR Hex
Source SRC QUERY SRC Prefix SRC StopSign SRC Hex
Title TITLE QUERY TITLE PREFIX TITLE STOPSIGN TITLE HEX
Artist ARTIST QUERY ARTIST PREFIX ARTIST STOPSIGN ARTIST HEX
Station STATION QUERY STATION PREFIX STATION STOPSIGN STATION HEX

5. The feedback parser model

The generic parser is AnalyseFeedback(response, Prefix, Hex, Position, Digits, StopSign, WhatFeedback).

Meaning of each setting

SettingMeaningTypical value
Prefix Text that appears before the value. level=, song, artist
Position Extra offset after the prefix. 0, 3, 4, 5
Digits Maximum or fixed length when no stopsign is found. 1, 2, 50
StopSign Marker where the value ends. &, \x22\x2C, ,
Hex Whether the response must be interpreted as hex/binary. false for JSON/text, true for binary/hex protocols.

Text extraction logic

value starts at:
  indexOf(Prefix) + Prefix.length + Position

value ends at:
  StopSign

if StopSign is empty or not usable:
  Digits is used
Position is not an absolute position in the response. It is an offset after the prefix.

6. StopSign rules

StopSign is the marker that tells MyURemote where the extracted value ends. It is often more important than Digits.

Common StopSigns

SituationResponse exampleStopSignNotes
URL-style message level=13&mute=off & Stops before the next parameter.
Normal JSON string "song":"Re-Rewind","station": ", Stops before the closing quote and comma.
Escaped JSON string \"song\":\"Re-Rewind\",\"station\": \x22\x2C Safer when quotes cannot be stored directly in devices.js.
Fixed-length numeric value level=13 empty Use Digits, for example 2.

Important ASCII / HEX references

CharacterMeaningDecimalHexEscaped form
"double quote3422\x22
,comma442C\x2C
&ampersand3826\x26
:colon583A\x3A
\backslash925C\x5C
Do not store a raw " in a command or setting when it breaks the generated JavaScript. Use the escaped form, such as \x22, when the configuration is exported to devices.js.

7. Hex, text and escaped values

Text / JSON response

{"heos":{"message":"pid=123&level=13"}}

Use Hex = false. Extract with Prefix, Position and StopSign.

Pure hex string response

1b920318080210021a

Use hex parsing only when the response is actually a hex string or binary protocol data.

Binary / raw byte response

\x02\x01\xFF

Some protocols return non-printable bytes. In that case MyURemote may convert the raw string to bytes before parsing.

Hex = false is normally correct for HEOS, because HEOS responses are JSON/text, not binary.

8. HEOS example: title, artist, station, volume

HEOS is a good example because the command succeeds, but the display only works when the response is parsed correctly.

HEOS transport commands

ActionCommand
Playplayer/set_play_state?pid={pid}&state=play
Pauseplayer/set_play_state?pid={pid}&state=pause
Stopplayer/set_play_state?pid={pid}&state=stop
Nextplayer/play_next?pid={pid}
Previousplayer/play_previous?pid={pid}
Volume queryplayer/get_volume?pid={pid}
Now playing queryplayer/get_now_playing_media?pid={pid}
Play state queryplayer/get_play_state?pid={pid}

HEOS volume response

{"heos":{"command":"player/get_volume","result":"success","message":"pid=123&level=13"}}
SettingValueReason
VOL Prefixlevel=Value starts after level=.
VOL Position0No extra offset needed.
VOL Digits2HEOS volume can be one or two digits.
VOL StopSign\x26 or empty\x26 is &. Empty also works when Digits is enough.
VOL HexfalseHEOS is text/JSON.

HEOS now playing response

{"heos":{"command":"player/get_now_playing_media","result":"success"},"payload":{"type":"station","song":"Re-Rewind","station":"Nostalgie 90's & 00's","album":"","artist":"Artful Dodger"}}

Recommended HEOS text settings when the response remains escaped

This is recommended when raw quotes cannot safely be stored in devices.js.

FieldPrefixPositionDigitsStopSignHex
Titlesong550\x22\x2Cfalse
Artistartist550\x22false
Stationstation550\x22\x2Cfalse
Why Position = 5? In escaped JSON, after song comes \":\". That is five characters: backslash, quote, colon, backslash, quote.

Alternative HEOS settings when quotes are unescaped

If heos.js converts \" to ", then the response becomes normal JSON text. In that case use:

FieldPrefixPositionDigitsStopSignHex
Titlesong350",false
Artistartist350"false
Stationstation350",false
Use one strategy consistently. Either keep HEOS escaped and use \x22-style stopsigns, or unescape HEOS and use normal text stopsigns. Mixing both causes off-by-one and wrong-stop problems.

HEOS play state as power status

player/get_play_state?pid={pid}

HEOS does not provide a classic amplifier power state. For UI purposes, play state can be used as a logical power/activity state.

HEOS stateSuggested MyURemote meaning
playOn / active
pauseOn / active but paused
stopStopped / inactive

9. What OK really means

OK only means:

  • The gateway accepted the request.
  • The connection/write probably succeeded.

It does not mean:

  • The device executed the command.
  • The device state changed.
  • The UI has enough data to update.
Real state must be verified with a query command and parsed feedback.

10. Troubleshooting checklist

SymptomLikely causeWhat to check
Command works but display does not update Feedback parser mismatch Raw response, Prefix, Position, StopSign, Hex.
Only first characters appear StopSign matches too early Use a more specific StopSign, for example \x22\x2C instead of only \x22.
Value includes ", Substring includes the StopSign Parser end-index logic. JavaScript substring(start, end) excludes end.
No response Device did not answer in time, or gateway read timing is too short Timeout, keepOpen, Wireshark, raw gateway response.
Raw length is 1024 with null bytes Gateway returns fixed buffer instead of received bytes Native socket read/result conversion.
Quotes break devices.js Unescaped quote in generated JavaScript Use \x22 or keep response escaped.

Recommended debug logging inside AnalyseFeedback

console.log("varPrefix:", varPrefix);
console.log("varPosition:", varPosition);
console.log("varDigits before:", varDigits);
console.log("varStopSign:", varStopSign);
console.log("mResultBrut:", mResultBrut);

varPositionPrefix = (mResultBrut.indexOf(varPrefix) + 1 + varPrefix.length);
console.log("indexOf prefix:", mResultBrut.indexOf(varPrefix));
console.log("varPositionPrefix:", varPositionPrefix);
console.log("text from prefix:", mResultBrut.substring(varPositionPrefix - 1, varPositionPrefix + 80));

if (varStopSign != "") {
  var stopIndex = mResultBrut.indexOf(varStopSign, varPositionPrefix);
  console.log("stopIndex:", stopIndex);
  console.log("text at stop:", mResultBrut.substring(stopIndex - 10, stopIndex + 10));
}
Debug order: first prove the raw response, then prove the prefix, then prove the start position, then prove the stopsign.

Final model

transport + query + parsing = UI state

MyURemote integrations become reliable when commands, responses and feedback settings are treated as one deterministic chain.