openHAB-Alignment-Tool icon indicating copy to clipboard operation
openHAB-Alignment-Tool copied to clipboard

Issue with escaped characters in item file

Open CWempe opened this issue 4 years ago • 3 comments

Found another bug.

This might be a tricky one, because it includes escaped characters.

Example:

String  AAA  "BBB"    {mqtt=">[mosquitto:ccc:command:open:{\"x\"\\: \"y\"}]"}

Result:

String  AAA  "BBB"  {mqtt=">[mosquitto:ccc:command:open:{\"}

And here is my real life example:

String  Therm_AZ_Preset  "AZ Preset"                 <thermostat>  (Thermostat)  {mqtt=">[mosquitto:zigbee2mqtt/Therm_AZ/set:command:schedule:{\"preset\"\\: \"schedule\"}],
                                                                                        >[mosquitto:zigbee2mqtt/Therm_AZ/set:command:manual:{\"preset\"\\: \"manual\"}],
                                                                                        >[mosquitto:zigbee2mqtt/Therm_AZ/set:command:boost:{\"preset\"\\: \"boost\"}],
                                                                                        >[mosquitto:zigbee2mqtt/Therm_AZ/set:command:complex:{\"preset\"\\: \"complex\"}],
                                                                                        >[mosquitto:zigbee2mqtt/Therm_AZ/set:command:comfort:{\"preset\"\\: \"comfort\"}],
                                                                                        >[mosquitto:zigbee2mqtt/Therm_AZ/set:command:eco:{\"preset\"\\: \"eco\"}],
                                                                                        <[mosquitto:zigbee2mqtt/Therm_AZ:state:JSONPATH($.preset)]"}

Addon version: 2.1.5

CWempe avatar Apr 27 '21 21:04 CWempe

I think the curly brackets are the issue.

This example also does not work:

Switch	aaa	"bbb"	{mqtt=">[mosquitto:ccc:command:ON:{test123}],>[mosquitto:ccc:command:OFF:{test456}]"}

Result:

Switch  aaa  "bbb"  {mqtt=">[mosquitto:ccc:command:ON:{test123}

It works without the curly brackets. Example:

Switch	aaa	"bbb"			{mqtt=">[mosquitto:ccc:command:ON:test123],>[mosquitto:ccc:command:OFF:test456]"}

And it seems to have worked previously. At least you closed this issue.

CWempe avatar Apr 30 '21 20:04 CWempe

Hey,

yeah the channel part is pretty tricky because there is nearly "anything" possible in the string there...

maxbec avatar May 01 '21 08:05 maxbec

https://github.com/MaxBec/openHAB-Alignment-Tool/issues/62#issuecomment-830648972 I think the same applies to this issue.

The item configuration might get simpler with the new mqtt binding. But this vscode addon should at least not destroy a working configuration. 😉

Wasn't there a a group tag like // #OHNG# to prevent a group from getting formatted? This could be used as a workaround. If not, I will create an issue for that. 😄

CWempe avatar May 01 '21 15:05 CWempe