Skip to content

Commit

Permalink
Ads (#4115)
Browse files Browse the repository at this point in the history
* add ads hub and switch

* add ads binary sensor

* add ADS sensor

* fix version numbers

* separate configuration tag

* remove device notification config

* fix configuration schema.

* replace tabs with spaces

* add type key-value-pairs
  • Loading branch information
Stefan Lehmann authored and MartinHjelmare committed Dec 5, 2017
1 parent 224088b commit 2eaaff4
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 0 deletions.
65 changes: 65 additions & 0 deletions source/_components/ads.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
layout: page
title: "ADS"
description: Connect Home Assistant to TwinCAT devices via the ADS interface
date: 2017-12-05 12:00
sidebar: true
comments: false
sharing: true
footer: true
logo: home-assistant.png
ha_category: Hub
ha_release: 0.60
ha_iot_class: "Local Push"
---

The ADS (automation device specification) describes a device-independent and
fieldbus-independent interface for communication between Beckhoff® automation
devices running TwinCAT® and other devices implementing this interface.

Configuration parameters:

{% configuration %}
device:
required: true
description: The AMS NetId that identifies the device
type: string
port:
required: true
description: The port that runs the AMS server on the device, typically this would be 801 or 851
type: integer
ip_address:
required: false
description: The IP-Address of the ADS device, if not set the first 4 bytes of the device id will be used
type: string
{% endconfiguration %}


```yaml
# Example configuration.yaml entry
ads:
device: '127.0.0.1.1.1'
port: 48898
```
## Service
The ADS component will register the service `write_by_name` allowing you to
write a value to a variable on your ADS device.

```json
{
"adsvar": ".myvariable",
"adstype": "int",
"value": 123
}
```

Service parameters:

- **adsvar**: name of the variable on the ADS device. To access global variables
on *TwinCAT2* use a prepending dot `.myvariable`, for TwinCAT3 use
`GBL.myvariable`
- **adstype**: specify the type of the variable. Use one of the following:
`int`, `byte`, `uint`, `bool`
- **value**: the value that will be written in the variable
44 changes: 44 additions & 0 deletions source/_components/binary_sensor.ads.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
layout: page
title: "ADS Binary Sensor"
description: "Instructions on how to set up ADS binary sensors within Home Assistant."
date: 2017-10-25 10:00
sidebar: true
comments: false
sharing: true
footer: true
logo: home-assistant.png
ha_category: Binary Sensor
ha_release: 0.60
ha_iot_class: "Local Push"
---

The binary sensor can be used to monitor a boolean value on your ADS device.

To use your ADS device, you first have to set up your [ADS
hub](/components/ads/) and then add the following to your `configuration.yaml`
file:

```yaml
# Example configuration.yaml entry
binary_sensor:
- platform: ads
adsvar: .boolean1
```
Configuration variables:
{% configuration %}
adsvar:
required: true
description: The name of the variable which you want to access on the ADS device
type: string
name:
required: false
description: An identifier for the light in the frontend
type: string
device_class:
required: false
description: The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend
type: string
{% endconfiguration %}
43 changes: 43 additions & 0 deletions source/_components/light.ads.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
layout: page
title: "ADS Light"
description: Instructions how to set up ADS lights within Home Assistant
date: 2017-10-25 10:00
sidebar: true
comments: false
sharing: true
footer: true
logo: home-assistant.png
ha_category: Light
ha_release: 0.60
ha_iot_class: "Local Push"
---

To use your ADS device, you first have to set up your [ADS
hub](/components/ads/) and then add the following to your `configuration.yaml`
file:

```yaml
# Example configuration.yaml entry
light:
- platform: ads
adsvar: GVL.enable_light
adsvar_brightness: GVL.brightness
```
Configuration variables:
{% configuration %}
adsvar:
required: true
description: The name of the boolean variable that switches the light on
type: string
adsvar_brightness:
required: false
description: The name of the variable that controls the brightness, use an unsigned integer on the PLC side
type: integer
name:
required: false
description: An identifier for the Light in the frontend
type: string
{% endconfiguration %}
57 changes: 57 additions & 0 deletions source/_components/sensor.ads.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
layout: page
title: "ADS Sensor"
description: "Instructions how to integrate ADS numeric values into Home Assistant."
date: 2017-10-25 10:00
sidebar: true
comments: false
sharing: true
footer: true
logo: home-assistant.png
ha_category: Sensor
ha_release: 0.60
ha_iot_class: "Local Push"
---

The `ADS` sensor platform allows reading the value of a numeric variable on
your ADS device. The variable can be of type *INT*, *UINT* or *BYTE*.

To use your ADS device, you first have to set up your [ADS
hub](/components/ads/) and then add the following to your `configuration.yaml`
file:

```yaml
# Example configuration.yaml entry
sensor:
- platform: ads
adsvar: GVL.temperature
unit_of_measurement: '°C'
adstype: int
```
Configuration variables:
{% configuration %}
adsvar:
required: true
description: The name of the variable which you want to access
type: string
adstype:
required: false
description: The datatype of the ADS variable, possible values are int, uint, byte
default: int
type: string
name:
required: false
description: An identifier for the sensor
type: string
factor:
required: false
description: A factor that divides the stored value before displaying in Home Assistant
default: 1
type: integer
{% endconfiguration %}
The *factor* can be used to implement fixed decimals. E.g., set *factor* to 100
if you want to display a fixed decimal value with two decimals. A variable
value of `123` will be displayed as `1.23`.
40 changes: 40 additions & 0 deletions source/_components/switch.ads.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
layout: page
title: "ADS Switch"
description: "Instructions on how to set up ADS switches within Home Assistant."
date: 2017-10-25 10:00
sidebar: true
comments: false
sharing: true
footer: true
logo: home-assistant.png
ha_category: Switch
ha_release: 0.60
ha_iot_class: "Local Push"
---

An ADS switch accesses a boolean variable on the connected ADS device. The
variable is identified by its name.

To use your ADS device, you first have to set up your [ADS
hub](/components/ads/) and then add the following to your `configuration.yaml`
file:

```yaml
# Example configuration.yaml entry
switch:
- platform: ads
adsvar: .global_bool
```
Configuration variables:
{% configuration %}
adsvar:
required: true
description: The name of the variable which you want to access on the ADS device
type: string
name:
required: false
description: An identifier for the switch in the frontend
type: string
{% endconfiguration %}

0 comments on commit 2eaaff4

Please sign in to comment.