Netio
The netio
switch integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] allows you to control your Netio
To use Netio devices in your installation, add the following to your configuration.yaml
The configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file.
After changing the configuration.yaml
The configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file, restart Home Assistant to apply the changes. The integration is now shown on the integrations page under Settings > Devices & services. Its entities are listed on the integration card itself and on the Entities tab.
# Example configuration.yaml entry
switch:
- platform: netio
host: 192.168.1.43
username: YOUR_USERNAME
password: YOUR_PASSWORD
outlets:
1: Free
2: TV
4: Lamp
To get pushed updates from the Netio devices, one can add this Lua code in the device interface as an action triggered on “Netio” “System variables updated” with an ‘Always’ schedule:
-- this will send socket and consumption status updates via CGI
-- to given address. Associate with 'System variables update' event
-- to get consumption updates when they show up
local address='ha:8123'
local path = '/api/netio/<host>'
local output = {}
for i = 1, 4 do for _, what in pairs({'state', 'consumption',
'cumulatedConsumption', 'consumptionStart'}) do
local varname = string.format('output%d_%s', i, what)
table.insert(output,
varname..'='..tostring(devices.system[varname]):gsub(" ","|"))
end end
local qs = table.concat(output, '&')
local url = string.format('http://%s%s?%s', address, path, qs)
devices.system.CustomCGI{url=url}