|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: "Netio Switch" |
| 4 | +description: "Instructions how to integrate Netio switches into Home Assistant." |
| 5 | +date: 2016-09-02 19:00 |
| 6 | +sidebar: true |
| 7 | +comments: false |
| 8 | +sharing: true |
| 9 | +footer: true |
| 10 | +logo: netio.png |
| 11 | +ha_category: Switch |
| 12 | +ha_iot_class: "Local Polling" |
| 13 | +ha_release: 0.24 |
| 14 | +--- |
| 15 | + |
| 16 | + |
| 17 | +The `netio` switch platform allows you to control your [Netio](http://www.netio-products.com/en/overview/) Netio4, Netio4 All, and Netio 230B. These are smart outlets controllable through ethernet and/or WiFi that reports consumptions (Netio4all). |
| 18 | + |
| 19 | +To use Netio devices in your installation, add the following to your `configuration.yaml` file: |
| 20 | + |
| 21 | +``` |
| 22 | +# Example configuration.yaml entry |
| 23 | +switch: |
| 24 | + - platform: netio |
| 25 | + host: 192.168.1.43 |
| 26 | + port: 1234 |
| 27 | + username: user |
| 28 | + password: pwd |
| 29 | + outlets: |
| 30 | + 1: Free |
| 31 | + 2: TV |
| 32 | + 4: Lamp |
| 33 | +``` |
| 34 | + |
| 35 | +Configuration variables: |
| 36 | + |
| 37 | +- **host** (*Required*): The IP address of your Netio plug, eg. http://192.168.1.32 |
| 38 | +- **port** (*Optional*): The port to communicate with the switch. Defaults to `1234`. |
| 39 | +- **username** (*Required*): The username for your plug. |
| 40 | +- **password** (*Required*): The password for your plug. |
| 41 | +- **outlets** (*Required*) array: List of all outlets. |
| 42 | + - **[No.]: [Name]** (*Required*): Identification of an outlet. |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +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" |
| 47 | +with an 'Always' schedule: |
| 48 | + |
| 49 | + |
| 50 | +```lua |
| 51 | +-- this will send socket and consumption status updates via CGI |
| 52 | +-- to given address. Associate with 'System variables update' event |
| 53 | +-- to get consumption updates when they show up |
| 54 | + |
| 55 | +local address='ha:8123' |
| 56 | +local path = '/api/netio/<host>' |
| 57 | + |
| 58 | + |
| 59 | +local output = {} |
| 60 | +for i = 1, 4 do for _, what in pairs({'state', 'consumption', |
| 61 | + 'cumulatedConsumption', 'consumptionStart'}) do |
| 62 | + local varname = string.format('output%d_%s', i, what) |
| 63 | + table.insert(output, |
| 64 | + varname..'='..tostring(devices.system[varname]):gsub(" ","|")) |
| 65 | +end end |
| 66 | + |
| 67 | +local qs = table.concat(output, '&') |
| 68 | +local url = string.format('http://%s%s?%s', address, path, qs) |
| 69 | +devices.system.CustomCGI{url=url} |
| 70 | +``` |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +The `dlink` switch platform allows you to control the state of your [D-Link Wi-Fi Smart Plugs](http://us.dlink.com/product-category/home-solutions/connected-home/smart-plugs/). |
| 93 | + |
| 94 | +Supported devices (tested): |
| 95 | + |
| 96 | +- DSP-W215 |
| 97 | +- DSP-W110 |
| 98 | + |
| 99 | +To use your D-Link smart plugs in your installation, add the following to your `configuration.yaml` file: |
| 100 | + |
| 101 | +```yaml |
| 102 | +# Example configuration.yaml entry |
| 103 | +switch: |
| 104 | + platform: dlink |
| 105 | + host: IP_ADRRESS |
| 106 | + name: D-Link plug |
| 107 | + username: YOUR_USERNAME |
| 108 | + password: YOUR_PASSWORD |
| 109 | +``` |
| 110 | +
|
| 111 | +
|
| 112 | +
|
0 commit comments