Update entity from http get request

I have a poe switch that has APIs I can access. There are APIs for poe port status. I want to make a port as an entity in-home assistant and update it with the data received in the HTTP Get request.

I want an entity in-home assistant with several variables for each port.

msg.payload from http get request.

{
    "poe_detection_status": "PPDS_DELIVERING",
    "port_id": "18",
    "port_voltage_in_volts": 55,
    "mps_absent_count": 8,
    "actual_power_in_watts": 5,

}

I setup a sensor template in hassio and gave it some custom variables as placeholders.
In NodeRed I am able to trigger the flow and receive the payload but when I try to pass this to a service node to update the entity… it fails to pass the variable.

So… the ask is
I’d like a custom entity in home assist that is updated on a timely basis with the variables from the GET request.

Am I doing this totally wrong?

Well, you are missing something here. The Service node in node-red doesn’t automatically pick up the variables from a message and assign them to appropriate attributes. Rather you have to order your message in this format:
{"data":{"entity_id":"eg_entity","attribute1":"eg_at1","attribute2":"eg_at2",and so on}

You have to define each attribute accordingly for the service node to understand them.

Hope it helps

Thank you so much for the reply :-). I simplified it for testing.

Inject----svc:homeassistant:update_entity-----msg.payload

Inject node contains the following. I have also tried to add it to the svc node

{    "data": {        
    
"entity_id":"sensor.lab_poe_18",     
"poe_detection_status": "PPDS_DELIVERING", 
"port_id": "18",
"port_voltage_in_volts": 55,  
"mps_absent_count": 8,
"actual_power_in_watts": 5
}}

I get this reply in the debug
“Call-service API error. Error Message: extra keys not allowed @ data[‘data’]”

You’re going to want to use the http api /api/states/entity_id.

https://developers.home-assistant.io/docs/en/external_api_rest.html#post-api-states-lt-entity_id

[{"id":"c94ca237.4d078","type":"inject","z":"fac037bf.a42d78","name":"","topic":"","payload":"{\"poe_detection_status\":\"PPDS_DELIVERING\",\"port_id\":\"18\",\"port_voltage_in_volts\":55,\"mps_absent_count\":8,\"actual_power_in_watts\":5}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":242,"y":560,"wires":[["b0f73f8b.cae39"]]},{"id":"b0f73f8b.cae39","type":"ha-api","z":"fac037bf.a42d78","name":"","protocol":"http","method":"post","path":"states/sensor.lab_poe_{{payload.port_id}}","data":"{\"state\":\"{{payload.poe_detection_status}}\",\"attributes\":{\"port_voltage_in_volts\":\"{{payload.port_voltage_in_volts}}\",\"mps_absent_count\":\"{{payload.mps_absent_count}}\",\"actual_power_in_watts\":\"{{payload.actual_power_in_watts}}\"}}","location":"payload","locationType":"msg","responseType":"json","x":370,"y":560,"wires":[[]]}]
2 Likes

Amazing! Thank you.

2019-07-17_0-42-12

Now to add in the actual payload from the HTTP Get request to obtain fresh data.
—doing this now— ok done

Unplugged cable from port 18… and triggered the flow
Sweet! it works!

2019-07-17_0-47-49

Now to put it on a timmer. But I do not want to overburden my hassio running on Rpie.

But how can I view the variables as graphs or see them in the UI?

I currently have this in my hassio config

sensor:
  - platform: template
    sensors:
      lab_poe_18:
        friendly_name: "LAB-POE-18"
        value_template: "{{ state_attr('poe_detection_status', 'port_voltage_in_volts','actual_power_in_watts') }}"

When I add the entity to a card it only shows the state and or a graph of the state. How do I see the variables in the frontend?

Also, would it be best to query each switchport independently? I have an API request that gives me stats of all ports. How could I create one a single flow like above with one GET request to update all entities?

Thanks a tone for the learning!

{
    "collection_result": {
        "total_elements_count": 48,
        "filtered_elements_count": 48
    },
    "port_poe_stats": [
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/1/poe/stats",
            "port_id": "1",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/2/poe/stats",
            "port_id": "2",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_DELIVERING",
            "uri": "/rest/v1/ports/3/poe/stats",
            "port_id": "3",
            "port_voltage_in_volts": 55,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 9,
            "power_class": 4
        },
        {
            "poe_detection_status": "PPDS_DELIVERING",
            "uri": "/rest/v1/ports/4/poe/stats",
            "port_id": "4",
            "port_voltage_in_volts": 55,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 13,
            "power_class": 4
        },
        {
            "poe_detection_status": "PPDS_DELIVERING",
            "uri": "/rest/v1/ports/5/poe/stats",
            "port_id": "5",
            "port_voltage_in_volts": 55,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 13,
            "power_class": 4
        },
        {
            "poe_detection_status": "PPDS_DELIVERING",
            "uri": "/rest/v1/ports/6/poe/stats",
            "port_id": "6",
            "port_voltage_in_volts": 55,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 9,
            "power_class": 4
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/7/poe/stats",
            "port_id": "7",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_DELIVERING",
            "uri": "/rest/v1/ports/8/poe/stats",
            "port_id": "8",
            "port_voltage_in_volts": 56,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 13,
            "power_class": 4
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/9/poe/stats",
            "port_id": "9",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/10/poe/stats",
            "port_id": "10",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/11/poe/stats",
            "port_id": "11",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/12/poe/stats",
            "port_id": "12",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/13/poe/stats",
            "port_id": "13",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_DELIVERING",
            "uri": "/rest/v1/ports/14/poe/stats",
            "port_id": "14",
            "port_voltage_in_volts": 55,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 4,
            "power_class": 4
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/15/poe/stats",
            "port_id": "15",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/16/poe/stats",
            "port_id": "16",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/17/poe/stats",
            "port_id": "17",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_DELIVERING",
            "uri": "/rest/v1/ports/18/poe/stats",
            "port_id": "18",
            "port_voltage_in_volts": 55,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 10,
            "short_count": 0,
            "actual_power_in_watts": 5,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/19/poe/stats",
            "port_id": "19",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/20/poe/stats",
            "port_id": "20",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/21/poe/stats",
            "port_id": "21",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/22/poe/stats",
            "port_id": "22",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/23/poe/stats",
            "port_id": "23",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/24/poe/stats",
            "port_id": "24",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/25/poe/stats",
            "port_id": "25",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/26/poe/stats",
            "port_id": "26",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/27/poe/stats",
            "port_id": "27",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/28/poe/stats",
            "port_id": "28",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/29/poe/stats",
            "port_id": "29",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/30/poe/stats",
            "port_id": "30",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/31/poe/stats",
            "port_id": "31",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/32/poe/stats",
            "port_id": "32",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/33/poe/stats",
            "port_id": "33",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/34/poe/stats",
            "port_id": "34",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/35/poe/stats",
            "port_id": "35",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/36/poe/stats",
            "port_id": "36",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/37/poe/stats",
            "port_id": "37",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/38/poe/stats",
            "port_id": "38",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/39/poe/stats",
            "port_id": "39",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/40/poe/stats",
            "port_id": "40",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/41/poe/stats",
            "port_id": "41",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/42/poe/stats",
            "port_id": "42",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/43/poe/stats",
            "port_id": "43",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/44/poe/stats",
            "port_id": "44",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/45/poe/stats",
            "port_id": "45",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/46/poe/stats",
            "port_id": "46",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/47/poe/stats",
            "port_id": "47",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        },
        {
            "poe_detection_status": "PPDS_SEARCHING",
            "uri": "/rest/v1/ports/48/poe/stats",
            "port_id": "48",
            "port_voltage_in_volts": 0,
            "power_denied_count": 0,
            "over_current_count": 0,
            "mps_absent_count": 0,
            "short_count": 0,
            "actual_power_in_watts": 0,
            "power_class": 0
        }
    ]
}

For now I used individual requests.

[{"id":"f5f52f44.80bab","type":"inject","z":"fac037bf.a42d78","name":"","topic":"","payload":"{\"collection_result\":{\"total_elements_count\":48,\"filtered_elements_count\":48},\"port_poe_stats\":[{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/1/poe/stats\",\"port_id\":\"1\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/2/poe/stats\",\"port_id\":\"2\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_DELIVERING\",\"uri\":\"/rest/v1/ports/3/poe/stats\",\"port_id\":\"3\",\"port_voltage_in_volts\":55,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":9,\"power_class\":4},{\"poe_detection_status\":\"PPDS_DELIVERING\",\"uri\":\"/rest/v1/ports/4/poe/stats\",\"port_id\":\"4\",\"port_voltage_in_volts\":55,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":13,\"power_class\":4},{\"poe_detection_status\":\"PPDS_DELIVERING\",\"uri\":\"/rest/v1/ports/5/poe/stats\",\"port_id\":\"5\",\"port_voltage_in_volts\":55,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":13,\"power_class\":4},{\"poe_detection_status\":\"PPDS_DELIVERING\",\"uri\":\"/rest/v1/ports/6/poe/stats\",\"port_id\":\"6\",\"port_voltage_in_volts\":55,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":9,\"power_class\":4},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/7/poe/stats\",\"port_id\":\"7\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_DELIVERING\",\"uri\":\"/rest/v1/ports/8/poe/stats\",\"port_id\":\"8\",\"port_voltage_in_volts\":56,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":13,\"power_class\":4},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/9/poe/stats\",\"port_id\":\"9\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/10/poe/stats\",\"port_id\":\"10\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/11/poe/stats\",\"port_id\":\"11\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/12/poe/stats\",\"port_id\":\"12\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/13/poe/stats\",\"port_id\":\"13\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_DELIVERING\",\"uri\":\"/rest/v1/ports/14/poe/stats\",\"port_id\":\"14\",\"port_voltage_in_volts\":55,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":4,\"power_class\":4},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/15/poe/stats\",\"port_id\":\"15\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/16/poe/stats\",\"port_id\":\"16\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/17/poe/stats\",\"port_id\":\"17\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_DELIVERING\",\"uri\":\"/rest/v1/ports/18/poe/stats\",\"port_id\":\"18\",\"port_voltage_in_volts\":55,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":10,\"short_count\":0,\"actual_power_in_watts\":5,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/19/poe/stats\",\"port_id\":\"19\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/20/poe/stats\",\"port_id\":\"20\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/21/poe/stats\",\"port_id\":\"21\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/22/poe/stats\",\"port_id\":\"22\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/23/poe/stats\",\"port_id\":\"23\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/24/poe/stats\",\"port_id\":\"24\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/25/poe/stats\",\"port_id\":\"25\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/26/poe/stats\",\"port_id\":\"26\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/27/poe/stats\",\"port_id\":\"27\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/28/poe/stats\",\"port_id\":\"28\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/29/poe/stats\",\"port_id\":\"29\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/30/poe/stats\",\"port_id\":\"30\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/31/poe/stats\",\"port_id\":\"31\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/32/poe/stats\",\"port_id\":\"32\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/33/poe/stats\",\"port_id\":\"33\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/34/poe/stats\",\"port_id\":\"34\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/35/poe/stats\",\"port_id\":\"35\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/36/poe/stats\",\"port_id\":\"36\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/37/poe/stats\",\"port_id\":\"37\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/38/poe/stats\",\"port_id\":\"38\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/39/poe/stats\",\"port_id\":\"39\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/40/poe/stats\",\"port_id\":\"40\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/41/poe/stats\",\"port_id\":\"41\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/42/poe/stats\",\"port_id\":\"42\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/43/poe/stats\",\"port_id\":\"43\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/44/poe/stats\",\"port_id\":\"44\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/45/poe/stats\",\"port_id\":\"45\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/46/poe/stats\",\"port_id\":\"46\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/47/poe/stats\",\"port_id\":\"47\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0},{\"poe_detection_status\":\"PPDS_SEARCHING\",\"uri\":\"/rest/v1/ports/48/poe/stats\",\"port_id\":\"48\",\"port_voltage_in_volts\":0,\"power_denied_count\":0,\"over_current_count\":0,\"mps_absent_count\":0,\"short_count\":0,\"actual_power_in_watts\":0,\"power_class\":0}]}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":178,"y":704,"wires":[["fbeba28b.1aba6"]]},{"id":"a3645312.7bf2f","type":"split","z":"fac037bf.a42d78","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":482,"y":704,"wires":[["496aebae.f03ae4"]]},{"id":"496aebae.f03ae4","type":"debug","z":"fac037bf.a42d78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":704,"wires":[]},{"id":"fbeba28b.1aba6","type":"change","z":"fac037bf.a42d78","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.port_poe_stats","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":336,"y":704,"wires":[["a3645312.7bf2f"]]}]
1 Like

Wow! You are great at this. I have been a network/wireless engineer. Enjoying this API stuff.

How do you rename a state or attribute? Example: change PPDS_DELIVERING to simply On. Or is that easier in hassio frontend?

drop a change node after split

1 Like

Thanks again. How would I go about this one bellow? It is structured a little differently.

I do not really need all the info. Just to update homeassistant entity similarly to:

The entity ID could be the MAC address portion of

                "sta_eth_mac": {
                    "addr": "FCDBB36D34FB"

And attributes like

{
    "state": "{{payload.poe_detection_status}}",
    "attributes": {
        "username": "{{username}}",
        "role": "{{role}}",
        "bssid": "{{bssid}}"
        "device_type": "{{device_type}}",
        "sta_ip_address": "{{sta_ip_address}}",
        "ap_name": "{{ap_name}}"
    }
}

Here is what I get from my Get request. It is structured a little differently than the other request I had. Not sure how to actually get the right data.

{
    "Station_result": [
        {
            "msg": {
                "sta_eth_mac": {
                    "addr": "FCDBB36D34FB"
                },
                "username": "fcdbb36d34fb",
                "role": "iot-default-psk",
                "bssid": {
                    "addr": "A8BD27CC1132"
                },
                "device_type": "Android",
                "sta_ip_address": {
                    "af": "ADDR_FAMILY_INET",
                    "addr": "10.1.2.157"
                },
                "hashed_sta_eth_mac": "760DCCF8F7827A533FD542C607C4C4AE93A161DA",
                "hashed_sta_ip_address": "C63BBBA59BFEA09D8ECD375A60AC9D58CB3EDEDC",
                "ap_name": "LB-AP-335"
            },
            "ts": 1585691661
        },
        {
            "msg": {
                "sta_eth_mac": {
                    "addr": "F4F5D8CBC890"
                },
                "username": "iot-ds-speaker",
                "role": "media-player",
                "bssid": {
                    "addr": "A8BD27CC1136"
                },
                "device_type": "Linux",
                "sta_ip_address": {
                    "af": "ADDR_FAMILY_INET",
                    "addr": "10.1.2.115"
                },
                "hashed_sta_eth_mac": "B8E0A83F812DB3B3F5AEF35E82EDE88DD2044997",
                "hashed_sta_ip_address": "27A5C2D4C2E6615D798B68401D05F8704EC6EA9D",
                "ap_name": "LB-AP-335"
            },
            "ts": 1585668511
        },
        {
            "msg": {
                "sta_eth_mac": {
                    "addr": "F4F5D8B50466"
                },
                "username": "iot-lr-speaker",
                "role": "media-player",
                "bssid": {
                    "addr": "A8BD27CBAB12"
                },
                "device_type": "Linux",
                "sta_ip_address": {
                    "af": "ADDR_FAMILY_INET",
                    "addr": "10.1.2.100"
                },
                "hashed_sta_eth_mac": "83B15F61356CB196867C81D67E3342962FBF7099",
                "hashed_sta_ip_address": "A8CDE96149FB2F5EE4AAFDAF5279368F0C1A780E",
                "ap_name": "LR-AP-325-Point"
            },
            "ts": 1585702901
        },

Or even if some one can point me to a youtube series where I can learn how to manipulate data to get it into the format I need. :slight_smile:

To all, I also cross referenced this at the link below. I dont mind giving a little donation if this type of thing is easy for you.