Hi, so I’ve purchased couple of Netio devices, since I’ve needed to make power management of several devices a bit more reliable and shift away from zigbee only managment, just in case HASS craps it’s bed and I need to remotely power cycle stuff.
Still I wanted to have a nice interface for home assistant. Unfortunately, they claim it’s mqtt compatible and configurable, but the configuration is done via rather obscure mqtt-flex interface that doesn’t clearly allow defining a payload field, and if you try to stick a quote mark into a payload field it will get upset about it. Their WIKI is also NOT very helpfull.
I had to scour the interwebz, this forum, mqtt-flex doc etc, to figure out a way to make those damn things automatically connect to HASS MQTT broker, and autoconfigure in HASS.
So, below are MQTT-FLEX configs that you can use for those device. Unfortunatelly they have a limit of 6000 characters - so you will have to take this pretty JSON format, change few IP addresses, usernames and passwords and then use some inline JSON minify to smash down character count via removal of white spaces.
So for each config you will need to change:
- in Broker section:
“password”: “password”,
“port”: your_port,
“ssl”: true / false - depending on what you rock,
“url”: “XXX.XXX.XXX.XXX”, - preferably your static IP addess
“username”: “username” - in first instance of “Total power” sensor - change the IP address to IP address of your device AND change the device model to what you have.
- upgrade the firmware to minimum 4.0.5
- change device name in device web interface setting to something that you recognise like “comms cabines pdu 1” - white spaces here are allowed.
- never forget to minify your config after you made those changes.
After that you should be able enable the mqtt-flex in M2M section, paste your mqtt-flex config into the empty field and hit SAVE and enjoy the device showing up in your home assistant.
This is config for dual output device like PowerCable 2KZ
{
"broker": {
"clientid": "netio-${DEVICE_SN}",
"keepalive": 30,
"password": "password",
"port": 1883,
"protocol": "mqtt",
"ssl": false,
"type": "generic",
"url": "XXX.XXX.XXX.XXX",
"username": "username"
},
"publish": [
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"], \"name\":\"${DEVICE_NAME}\", \"manufacturer\":\"Netio\", \"model\":\"PowerCable 2KZ\", \"configuration_url\": \"http://XXX.XXX.XXX.XXX\"}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Total power\", \"unit_of_meas\":\"W\", \"dev_cla\":\"power\", \"uniq_id\":\"${DEVICE_SN}-total-power\", \"val_tpl\":\"{{ value_json.GlobalMeasure.TotalLoad }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/total-power/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Total energy\", \"unit_of_meas\":\"kWh\", \"dev_cla\":\"energy\", \"uniq_id\":\"${DEVICE_SN}-total-energy\", \"val_tpl\":\"{{ value_json.GlobalMeasure.TotalEnergy | float / 1000}}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/total-energy/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Voltage\", \"unit_of_meas\":\"V\", \"dev_cla\":\"voltage\", \"uniq_id\":\"netio-${DEVICE_SN}-voltage\", \"val_tpl\":\"{{ value_json.GlobalMeasure.Voltage }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/voltage/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Total current\", \"unit_of_meas\":\"mA\", \"dev_cla\":\"current\", \"uniq_id\":\"${DEVICE_SN}-total-current\", \"val_tpl\":\"{{ value_json.GlobalMeasure.TotalCurrent }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/total-current/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 1 power\", \"unit_of_meas\":\"W\", \"dev_cla\":\"power\", \"uniq_id\":\"${DEVICE_SN}-output-1-power\", \"val_tpl\":\"{{ value_json.Outputs[0].Load }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/output-1-power/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 2 power\", \"unit_of_meas\":\"W\", \"dev_cla\":\"power\", \"uniq_id\":\"${DEVICE_SN}-output-2-power\", \"val_tpl\":\"{{ value_json.Outputs[1].Load }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/output-2-power/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 1\", \"uniq_id\":\"${DEVICE_SN}-output-1\", \"val_tpl\":\"{{ value_json.Outputs[0].State }}\", \"cmd_t\":\"~/output-1/action\", \"stat_on\":1,\"stat_off\":0,\"pl_on\":1,\"pl_off\":0}",
"topic": "homeassistant/switch/netio-${DEVICE_SN}/output-1/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"name\":\"Output 1 restart\", \"uniq_id\":\"${DEVICE_SN}-output-1-restart\", \"cmd_t\":\"~/output-1/action\", \"pl_prs\":2}",
"topic": "homeassistant/button/netio-${DEVICE_SN}/output-1-restart/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 2\", \"uniq_id\":\"${DEVICE_SN}-output-2\", \"val_tpl\":\"{{ value_json.Outputs[1].State }}\", \"cmd_t\":\"~/output-2/action\", \"stat_on\":1,\"stat_off\":0,\"pl_on\":1,\"pl_off\":0}",
"topic": "homeassistant/switch/netio-${DEVICE_SN}/output-2/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"name\":\"Output 2 restart\", \"uniq_id\":\"${DEVICE_SN}-output-2-restart\", \"cmd_t\":\"~/output-2/action\", \"pl_prs\":2}",
"topic": "homeassistant/button/netio-${DEVICE_SN}/output-2-restart/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "${INOUT_STATUS}",
"topic": "netio-${DEVICE_SN}/global",
"qos": 0,
"retain": true,
"events": [
{
"type": "timer",
"period": 5
}
]
}
],
"subscribe":[
{
"topic":"netio-${DEVICE_SN}/output-1/action",
"qos":0,
"target":"OUTPUTS/1/ACTION",
"action":"${payload}"
},
{
"topic":"netio-${DEVICE_SN}/output-2/action",
"qos":0,
"target":"OUTPUTS/2/ACTION",
"action":"${payload}"
}
]
}
And this is a config for quad output device like PowerPDU 4KS, PowerBOX 4KG. Just be warned that even after minify, this will be about 7000 characters, while limit is 6000 characters, just ignore the warning it worked for me (damn the torpedos - but I take no responsibility if you brick your device)
{
"broker": {
"clientid": "netio-${DEVICE_SN}",
"keepalive": 30,
"password": "password",
"port": 1883,
"protocol": "mqtt",
"ssl": false,
"type": "generic",
"url": "XXX.XXX.XXX.XXX",
"username": "username"
},
"publish": [
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"], \"name\":\"${DEVICE_NAME}\", \"manufacturer\":\"Netio\", \"model\":\"PowerPDU 4KS\", \"configuration_url\": \"http://XXX.XXX.XXX.XXX\"}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Total power\", \"unit_of_meas\":\"W\", \"dev_cla\":\"power\", \"uniq_id\":\"${DEVICE_SN}-total-power\", \"val_tpl\":\"{{ value_json.GlobalMeasure.TotalLoad }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/total-power/config",
"qos": 2,
"retain": true,
"events": [
{
"source": "DEVICE_NAME",
"type": "change"
}
]
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Total energy\", \"unit_of_meas\":\"kWh\", \"dev_cla\":\"energy\", \"uniq_id\":\"${DEVICE_SN}-total-energy\", \"val_tpl\":\"{{ value_json.GlobalMeasure.TotalEnergy | float / 1000}}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/total-energy/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Voltage\", \"unit_of_meas\":\"V\", \"dev_cla\":\"voltage\", \"uniq_id\":\"netio-${DEVICE_SN}-voltage\", \"val_tpl\":\"{{ value_json.GlobalMeasure.Voltage }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/voltage/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Total current\", \"unit_of_meas\":\"mA\", \"dev_cla\":\"current\", \"uniq_id\":\"${DEVICE_SN}-total-current\", \"val_tpl\":\"{{ value_json.GlobalMeasure.TotalCurrent }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/total-current/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 1 power\", \"unit_of_meas\":\"W\", \"dev_cla\":\"power\", \"uniq_id\":\"${DEVICE_SN}-output-1-power\", \"val_tpl\":\"{{ value_json.Outputs[0].Load }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/output-1-power/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 2 power\", \"unit_of_meas\":\"W\", \"dev_cla\":\"power\", \"uniq_id\":\"${DEVICE_SN}-output-2-power\", \"val_tpl\":\"{{ value_json.Outputs[1].Load }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/output-2-power/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 3 power\", \"unit_of_meas\":\"W\", \"dev_cla\":\"power\", \"uniq_id\":\"${DEVICE_SN}-output-3-power\", \"val_tpl\":\"{{ value_json.Outputs[2].Load }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/output-3-power/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 4 power\", \"unit_of_meas\":\"W\", \"dev_cla\":\"power\", \"uniq_id\":\"${DEVICE_SN}-output-4-power\", \"val_tpl\":\"{{ value_json.Outputs[3].Load }}\"}",
"topic": "homeassistant/sensor/netio-${DEVICE_SN}/output-4-power/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 1\", \"uniq_id\":\"${DEVICE_SN}-output-1\", \"val_tpl\":\"{{ value_json.Outputs[0].State }}\", \"cmd_t\":\"~/output-1/action\", \"stat_on\":1,\"stat_off\":0,\"pl_on\":1,\"pl_off\":0}",
"topic": "homeassistant/switch/netio-${DEVICE_SN}/output-1/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 2\", \"uniq_id\":\"${DEVICE_SN}-output-2\", \"val_tpl\":\"{{ value_json.Outputs[1].State }}\", \"cmd_t\":\"~/output-2/action\", \"stat_on\":1,\"stat_off\":0,\"pl_on\":1,\"pl_off\":0}",
"topic": "homeassistant/switch/netio-${DEVICE_SN}/output-2/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 3\", \"uniq_id\":\"${DEVICE_SN}-output-3\", \"val_tpl\":\"{{ value_json.Outputs[2].State }}\", \"cmd_t\":\"~/output-3/action\", \"stat_on\":1,\"stat_off\":0,\"pl_on\":1,\"pl_off\":0}",
"topic": "homeassistant/switch/netio-${DEVICE_SN}/output-3/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"stat_t\":\"~/global\", \"name\":\"Output 4\", \"uniq_id\":\"${DEVICE_SN}-output-4\", \"val_tpl\":\"{{ value_json.Outputs[3].State }}\", \"cmd_t\":\"~/output-4/action\", \"stat_on\":1,\"stat_off\":0,\"pl_on\":1,\"pl_off\":0}",
"topic": "homeassistant/switch/netio-${DEVICE_SN}/output-4/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"name\":\"Output 1 restart\", \"uniq_id\":\"${DEVICE_SN}-output-1-restart\", \"cmd_t\":\"~/output-1/action\", \"pl_prs\":2}",
"topic": "homeassistant/button/netio-${DEVICE_SN}/output-1-restart/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"name\":\"Output 2 restart\", \"uniq_id\":\"${DEVICE_SN}-output-2-restart\", \"cmd_t\":\"~/output-2/action\", \"pl_prs\":2}",
"topic": "homeassistant/button/netio-${DEVICE_SN}/output-2-restart/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"name\":\"Output 3 restart\", \"uniq_id\":\"${DEVICE_SN}-output-3-restart\", \"cmd_t\":\"~/output-3/action\", \"pl_prs\":2}",
"topic": "homeassistant/button/netio-${DEVICE_SN}/output-3-restart/config",
"qos": 2,
"retain": true
},
{
"payload": "{\"~\":\"netio-${DEVICE_SN}\", \"dev\":{\"ids\":[\"netio-${DEVICE_SN}\"]}, \"en\":true, \"name\":\"Output 4 restart\", \"uniq_id\":\"${DEVICE_SN}-output-4-restart\", \"cmd_t\":\"~/output-4/action\", \"pl_prs\":2}",
"topic": "homeassistant/button/netio-${DEVICE_SN}/output-4-restart/config",
"qos": 2,
"retain": true
},
{
"payload": "${INOUT_STATUS}",
"topic": "netio-${DEVICE_SN}/global",
"qos": 0,
"retain": true,
"events": [
{
"type": "timer",
"period": 5
}
]
}
],
"subscribe":[
{
"topic":"netio-${DEVICE_SN}/output-1/action",
"qos":0,
"target":"OUTPUTS/1/ACTION",
"action":"${payload}"
},
{
"topic":"netio-${DEVICE_SN}/output-2/action",
"qos":0,
"target":"OUTPUTS/2/ACTION",
"action":"${payload}"
},
{
"topic":"netio-${DEVICE_SN}/output-3/action",
"qos":0,
"target":"OUTPUTS/3/ACTION",
"action":"${payload}"
},
{
"topic":"netio-${DEVICE_SN}/output-4/action",
"qos":0,
"target":"OUTPUTS/4/ACTION",
"action":"${payload}"
}
]
}