Sorry if this isn't the right place but can anyone tell me why this code creates errors?
if (msg.payload === "on") msg.payload = {"service":"turn_on"}
if (msg.payload === "off") msg.payload = {"service":"turn_off"}
if (msg.payload === "play") msg.payload = {"service":"media_play"}
if (msg.payload === "pause") msg.payload = {"service":"media_pause"}
return msg
When I comment out two of the "if" lines then it runs perfectly. So, I assume I have a syntax issue?