New rules, about RULES for using " or '

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
JR01
Normal user
Posts: 260
Joined: 14 Feb 2016, 21:04
Location: South Africa

New rules, about RULES for using " or '

#1 Post by JR01 » 27 Jul 2020, 21:12

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?
-----------
IOTPLAY. Tinkerer, my projects are @ http://GitHub.com/IoTPlay, and blog https://iotplay.org. Using RPi, Node-Red, ESP8266 to prove Industry 4.0 concepts.

User avatar
Ath
Normal user
Posts: 3483
Joined: 10 Jun 2018, 12:06
Location: NL

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

#2 Post by Ath » 27 Jul 2020, 21:29

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.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 31 guests