Help with payload to homeassistant entity attributes

Hi
Could anyone please help me with getting that below payload divided into attributes that i could then push to home assistant entity?

I got that payload from running ssh to my server:
{"topic":"192.168.1.80","_msgid":"9ae507a7.3fea68","payload":"\r-\r \r\r-\r \rStatus: Connected\nCurrent server: pl141.nordvpn.com\nCountry: Poland\nCity: Warsaw\nYour new IP: 5.253.206.91\nCurrent technology: NordLynx\nTransfer: 1.17 GiB received, 23.16 MiB sent\nUptime: 9 hours 31 minutes 28 seconds\n","rc":{"code":0}}
It gives me status about NordVPN connection. I would like to have all these as attributes in one entity under HA.So lets say entity called sensor.nordvpn with below attributes:

  • Status
    Current server
    Country
    City
    Your new IP
    Current technology
    Transfer received
    Transfer sent
    Uptime

Already have this:
var lines = msg.payload.split("\n");
lines[0] = lines[0].replace("\r-\r \r\r-\r \r","");
var outp = ;
outp[0] = {payload:lines[0]};
outp[1] = {payload:lines[1]};
outp[2] = {payload:lines[2]};
outp[3] = {payload:lines[3]};
outp[4] = {payload:lines[4]};
outp[5] = {payload:lines[5]};
outp[6] = {payload:lines[6]};
outp[7] = {payload:lines[7]};
return [outp];

That gives me 8 different payloads- so how do i get these payloads now to one enitity with attributes?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.