Skip to content

Commit

Permalink
[asuswrt] added interface thing
Browse files Browse the repository at this point in the history
* revised complete code

Signed-off-by: Christian Wild <christian@wildclan.de>
  • Loading branch information
wildcs committed Nov 25, 2022
1 parent 398f934 commit 3bfeddd
Show file tree
Hide file tree
Showing 24 changed files with 1,073 additions and 370 deletions.
121 changes: 72 additions & 49 deletions bundles/org.openhab.binding.asuswrt/README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,99 @@
# asuswrt Binding
# Asuswrt Binding

_Give some details about what this binding is meant for - a protocol, system, specific device._
This binding adds support to control get informations from ASUS-Router (Copyright © ASUS).

_If possible, provide some resources like pictures (only PNG is supported currently), a video, etc. to give an impression of what can be done with this binding._
_You can place such resources into a `doc` folder next to this README.md._
# !! EARLY BETA !!

_Put each sentence in a separate line to improve readability of diffs._
# BINDING AND REDME NOT FULLY WORKING/COMPLETED

## Supported Things

_Please describe the different supported things / devices including their ThingTypeUID within this section._
_Which different types are supported, which models were tested etc.?_
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
Binding supports ASUS-Router with AsusWRT or -AsusWRT-Merlin Firmware.
Firmware 5.x.x (some DSL models) is NOT supported (not AsusWRT).

- `bridge`: Short description of the Bridge, if any
- `sample`: Short description of the Thing with the ThingTypeUID `sample`
| ThingType | Name | Descripion |
|---------------|------------|-----------------------------------------|
| bridge | router | router binding is connecting |
| - | interface | network interface of router |
| - | client | client is connected to the bridge |

## Discovery
### `router` Thing Configuration

_Describe the available auto-discovery features here._
_Mention for what it works and what needs to be kept in mind when using it._
| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------------------|----------|----------|
| hostname | text | Hostname or IP address of the device | router.asus.com | yes | no |
| username | text | Username to access the device | N/A | yes | no |
| password | text | Password to access the device | N/A | yes | no |
| useSSL | boolean | Connect over SSL or use http:// | false | no | no |
| refreshInterval | integer | Interval the device is polled in sec. | 20 | no | yes |
| httpPort | integer | HTTP-Port | 80 | no | yes |
| httpsPort | integer | HTTPS-Port | 443 | no | yes |

## Binding Configuration
### `interface` Thing Configuration

_If your binding requires or supports general configuration settings, please create a folder ```cfg``` and place the configuration file ```<bindingId>.cfg``` inside it._
_In this section, you should link to this file and provide some information about the options._
_The file could e.g. look like:_
| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------------------|----------|----------|
| interfaceName | text | options name of interface (wan/lan) | N/A | yes | no |

```
# Configuration for the asuswrt Binding
#
# Default secret key for the pairing of the asuswrt Thing.
# It has to be between 10-40 (alphanumeric) characters.
# This may be changed by the user for security reasons.
secret=openHABSecret
```
### `client` Thing Configuration

_Note that it is planned to generate some part of this based on the information that is available within ```src/main/resources/OH-INF/binding``` of your binding._
| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------------------|----------|----------|
| macAddress | text | Unique MAC-Address of the device | N/A | yes | no |
| clientNick | text | Nickname used by OH | N/A | no | no |

_If your binding does not offer any generic configurations, you can remove this section completely._

## Thing Configuration
## Properties

_Describe what is needed to manually configure a thing, either through the UI or via a thing-file._
_This should be mainly about its mandatory and optional configuration parameters._
All devices support some of the following properties:

_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
| property | description | things supporting this channel |
|------------------|------------------------------|---------------------------------------|
| vendor | Vendor of device | router, client |
| dnsName | DNS-Name of device | router, client |

### `sample` Thing Configuration

| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------|----------|----------|
| hostname | text | Hostname or IP address of the device | N/A | yes | no |
| password | text | Password to access the device | N/A | yes | no |
| refreshInterval | integer | Interval the device is polled in sec. | 600 | no | yes |

## Channels

_Here you should provide information about available channel types, what their meaning is and how they can be used._
All devices support some of the following channels:

| group | channel |type | description | things supporting this channel |
|------------------|--------------------|------------------------|--------------------------------------------|-----------------------------------|
| networkInfo | macAddress | text (RO) | HW-Address | interface, client |
| | ipAddress | text (RO) | IP-Address | interface |
| | ipMethod | text (RO) | Ip-Method (static/dhcp) | interface, client |
| | subnet | text (RO) | Subnetmask | interface |
| | gateway | text (RO) | Default-Gateway | interface |
| | dnsServers | text (RO) | DNS-Servers | interface |
| | networkState | Switch (RO) | Client is online | interface, client |
| | internetState | Switch (RO) | Client connected to Internet | client |
| sysInfoGroup | memTotal | Number:DataAmountype | Total memory in MB | router |
| | memUsed | Number:DataAmountype | Used memory in MB | router |
| | memFree | Number:DataAmountype | Free memory in MB | router |
| | memUsedPercent | Number:Dimensionles | Used memory in % | router |
| | cpuUsedPercent | Number:Dimensionles | Total CPU usage in percent over all cores | router |
| clientListGroup | knownClients | text (RO) | Known clients with name and MAC-Addresses | router |
| | onlineClients | text (RO) | Online clients with name and MAC-Addresses | router |
| | onlineMACs | text (RO) | List with mac-addresses of online clients | router |
| | onlineClientsCount | Number:Dimensionless | Count of online clients | router |


## Events

All devices support some of the following Events:
| group | event |kind | description | things supporting this event |
|------------------|-----------------|------------|------------------------------------------------------------------------|---------------------------------|
| networkInfo | connectionEvent | Trigger | Fired if Client leaves ('gone') or enters ('connected') the network | interface, client |



_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._
## Debugging and Tracing

| Channel | Type | Read/Write | Description |
|---------|--------|------------|-----------------------------|
| control | Switch | RW | This is the control channel |
If you want to see what's going on in the binding, switch the loglevel to TRACE in the Karaf console

## Full Example
`log:set TRACE org.openhab.binding.asuswrt`

_Provide a full usage example based on textual configuration files._
_*.things, *.items examples are mandatory as textual configuration is well used by many users._
_*.sitemap examples are optional._
Set the logging back to normal

## Any custom content here!
`log:set INFO org.openhab.binding.asuswrt`+

_Feel free to add additional sections for whatever you think should also be mentioned about your binding!_
98 changes: 98 additions & 0 deletions bundles/org.openhab.binding.asuswrt/README.md.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Asuswrt Binding

This binding adds support to control get informations from ASUS-Router (Copyright © ASUS).

# !! EARLY BETA !!
# BINDING AND REDME NOT FULLY WORKING/COMPLETED

## Supported Things

Binding supports ASUS-Router with AsusWRT or -AsusWRT-Merlin Firmware.
Firmware 5.x.x (some DSL models) is NOT supported (not AsusWRT).

| ThingType | Name | Descripion |
|---------------|------------|-----------------------------------------|
| bridge | router | router binding is connecting |
| - | interface | network interface of router |
| - | client | client is connected to the bridge |

### `router` Thing Configuration

| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------------------|----------|----------|
| hostname | text | Hostname or IP address of the device | router.asus.com | yes | no |
| username | text | Username to access the device | N/A | yes | no |
| password | text | Password to access the device | N/A | yes | no |
| useSSL | boolean | Connect over SSL or use http:// | false | no | no |
| refreshInterval | integer | Interval the device is polled in sec. | 20 | no | yes |
| httpPort | integer | HTTP-Port | 80 | no | yes |
| httpsPort | integer | HTTPS-Port | 443 | no | yes |

### `interface` Thing Configuration

| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------------------|----------|----------|
| interfaceName | text | options name of interface (wan/lan) | N/A | yes | no |

### `client` Thing Configuration

| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------------------|----------|----------|
| macAddress | text | Unique MAC-Address of the device | N/A | yes | no |
| clientNick | text | Nickname used by OH | N/A | no | no |


## Properties

All devices support some of the following properties:

| property | description | things supporting this channel |
|------------------|------------------------------|---------------------------------------|
| vendor | Vendor of device | router, client |
| dnsName | DNS-Name of device | router, client |


## Channels

All devices support some of the following channels:

| group | channel |type | description | things supporting this channel |
|------------------|--------------------|------------------------|--------------------------------------------|-----------------------------------|
| networkInfo | macAddress | text (RO) | HW-Address | interface, client |
| | ipAddress | text (RO) | IP-Address | interface |
| | ipMethod | text (RO) | Ip-Method (static/dhcp) | interface, client |
| | subnet | text (RO) | Subnetmask | interface |
| | gateway | text (RO) | Default-Gateway | interface |
| | dnsServers | text (RO) | DNS-Servers | interface |
| | networkState | Switch (RO) | Client is online | interface, client |
| | internetState | Switch (RO) | Client connected to Internet | client |
| sysInfoGroup | memTotal | Number:DataAmountype | Total memory in MB | router |
| | memUsed | Number:DataAmountype | Used memory in MB | router |
| | memFree | Number:DataAmountype | Free memory in MB | router |
| | memUsedPercent | Number:Dimensionles | Used memory in % | router |
| | cpuUsedPercent | Number:Dimensionles | Total CPU usage in percent over all cores | router |
| clientListGroup | knownClients | text (RO) | Known clients with name and MAC-Addresses | router |
| | onlineClients | text (RO) | Online clients with name and MAC-Addresses | router |
| | onlineMACs | text (RO) | List with mac-addresses of online clients | router |
| | onlineClientsCount | Number:Dimensionless | Count of online clients | router |



## Events

All devices support some of the following Events:
| group | event |kind | description | things supporting this event |
|------------------|-----------------|------------|------------------------------------------------------------------------|---------------------------------|
| networkInfo | connectionEvent | Trigger | Fired if Client leaves ('gone') or enters ('connected') the network | interface, client |



## Debugging and Tracing

If you want to see what's going on in the binding, switch the loglevel to TRACE in the Karaf console

`log:set TRACE org.openhab.binding.asuswrt`

Set the logging back to normal

`log:set INFO org.openhab.binding.asuswrt`
Loading

0 comments on commit 3bfeddd

Please sign in to comment.