hklages / node-red-contrib-sonos-plus

A set of Node-RED nodes to control SONOS player in your local network.
MIT License
76 stars 14 forks source link

Trying to escape an apostrophe #302

Open cwesterfield opened 1 month ago

cwesterfield commented 1 month ago

Description

I think I'm having an escaping problem.

What node/command (topic)/state (payload)

I feed a message to a get node with just the Player name

{"event_type":"zha_event",
"_msgid":"5e589f9d4abb5bc2",
"_event":"node:ddb82b72a11a8932",
"playerName":"Charley's Room"}

I get an error:

group.get.state: could not find given player in any group :: Details: none

node: Universal command: group.get.state

I've tried it a couple ways

// Play/Pause
if (msg.payload.event.command == "toggle") {
        delete msg.payload;
        delete msg.topic;
        msg.playerName = 'Charley\'s Room'
    return [null,msg];
}
// Play/Pause
if (msg.payload.event.command == "toggle") {
        delete msg.payload;
        delete msg.topic;
        msg.playerName = "Charley's Room"
    return [null,msg];
}

In case of a bug: Are you able to reproduce the error

yes

Versions and Infrastructure

what system: Home assistant addon node-red-contrib-sonos-plus version: 6.9.0 Node-RED version: Current version: 18.0.2 NodeJS version: maybe v18.20.3

see: [https://flows.nodered.org/flow/a5c42641bf33dd0da9bfd4426a06950a]

hklages commented 1 month ago

Is it possible for you to rename the players name to something like CharlysRooom and try it with that name again. Some special characters such as ü, ö work but some dont. Grüße Henning Klages

On Sat, Jul 13, 2024, 00:18 Colby Westerfield @.***> wrote:

Description

I think I'm having an escaping problem. What node/command (topic)/state (payload)

I feed a message to a get node with just the Player name

{"event_type":"zha_event", "_msgid":"5e589f9d4abb5bc2", "_event":"node:ddb82b72a11a8932", "playerName":"Charley's Room"}

I get an error:

group.get.state: could not find given player in any group :: Details: none

node: Universal command: group.get.state

I've tried it a couple ways

// Play/Pause if (msg.payload.event.command == "toggle") { delete msg.payload; delete msg.topic; msg.playerName = 'Charley\'s Room' return [null,msg]; }

// Play/Pause if (msg.payload.event.command == "toggle") { delete msg.payload; delete msg.topic; msg.playerName = "Charley's Room" return [null,msg]; }

In case of a bug: Are you able to reproduce the error

yes Versions and Infrastructure

what system: Home assistant addon node-red-contrib-sonos-plus version: 6.9.0 Node-RED version: Current version: 18.0.2 NodeJS version: maybe v18.20.3

see: [https://flows.nodered.org/flow/a5c42641bf33dd0da9bfd4426a06950a]

— Reply to this email directly, view it on GitHub https://github.com/hklages/node-red-contrib-sonos-plus/issues/302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDZCH7CA5CLH3FSO5UMO5DZMBI4XAVCNFSM6AAAAABKZU66PCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYDMNBRHEYTQOA . You are receiving this because you were assigned.Message ID: @.***>

cwesterfield commented 1 month ago

I'll think on it. That may cause all sorts of heck else where, so if apostrophe's and not possible, thats just good info to have.