Page 1 of 1

New rules, about RULES for using " or '

Posted: 27 Jul 2020, 21:12
by JR01
A previously working publish in rules worked (sort-of...), with the new rules of RULES, I am trying to send a formatted text string which Node-RED can change into a json format - and send onto HomeBridge. In the example below, the message must look like this, for 5 possible Relays, in below case Relay 1 must switch off, and ig gets the value from a variable.:

Code: Select all

 Publish homebridge/to/set,{"name":"ESP62.Leg1.Relay","service_name":"Sprinkler Relay1","characteristic":"Valve","value":0}
I have tried to play around on where to put the " " or ' ' - but cannot get it right. This is my last attempt - it does not work.

Code: Select all

  
 event,notifyHomeKit=1
 ...

 On notifyHomeKit Do
   Publish homebridge/to/set,'{"name":"'ESP62.Leg'%eventvalue%'.Relay'","service_name":"Sprinkler Leg"%eventvalue%","characteristic":"Valve","value":[VAR#11#D1.0]}'
Any pointers please?

Re: New rules, about RULES for using " or '

Posted: 27 Jul 2020, 21:29
by Ath
Have you read this support issue: https://github.com/letscontrolit/ESPEasy/issues/2724 ?

You have your quotes mixed up, no need to combine ' and " around a single token.

something like this, copied from your post and quoted as intended

Code: Select all

 Publish homebridge/to/set,'{"name":"ESP62.Leg1.Relay","service_name":"Sprinkler Relay1","characteristic":"Valve","value":0}'

Code: Select all

On notifyHomeKit Do
   Publish homebridge/to/set,'{"name":"'ESP62.Leg'%eventvalue%.Relay'","service_name":"Sprinkler Leg%eventvalue%","characteristic":"Valve","value":[VAR#???]}'
endon
In the place of the ??? you should put the name of the value-variable, like [VAR#State], 11 isn't working. The decimals must be defined at the plugin.