Split a string of a Location Payload from Datacake and pass it to Home Assistant as coordinates

Pass the msg through a function node

v1: Return Array...

msg.payload = msg.payload.state.replace('(','').replace(')','').split(',').map(Number)
return msg

OR

v2: Return object...

const coords = msg.payload.state.replace('(','').replace(')','').split(',').map(Number)
msg.payload = {
  latitude: coords[0],
  longitude: coords[1],
}
return msg

Most of the regulars I know on here dont use HA - you should try the forum.


Tip

When copying a payload to show on the forum, please use the copy value button so that it is valid JSON...
chrome_qw2LJ5Gp6I