From 6bcf3f002ed1b80095c422d428b7eb205b92defc Mon Sep 17 00:00:00 2001 From: Alex Mekkering Date: Mon, 2 Jan 2017 20:47:02 +0100 Subject: [PATCH 1/3] Add support for remote (TCP/IP) DSMR sensors (i.e. via ser2net) --- source/_components/sensor.dsmr.markdown | 28 +++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/source/_components/sensor.dsmr.markdown b/source/_components/sensor.dsmr.markdown index d71e6aa083ed..3a80865984b9 100644 --- a/source/_components/sensor.dsmr.markdown +++ b/source/_components/sensor.dsmr.markdown @@ -46,13 +46,14 @@ sensor: Configuration variables: -- **port** string (*Optional*): Serial port to which Smartmeter is connected (default: /dev/ttyUSB0). -- **dsmr_version_** string (*Optional*): Version of DSMR used by meter, choices: 2.2, 4 (default: 2.2). +- **port** string (*Optional*): Serial port to which Smartmeter is connected (default: /dev/ttyUSB0 (connected to USB port)). For remote (i.e. ser2net) connections, use TCP port number to connect to (i.e. 2001). +- **host** string (*Optional*): Host to which Smartmeter is connected (default: '' (connected via serial or USB, see **port**)). For remote connections, use IP address of host to connect to (i.e. 192.168.1.13). +- **dsmr_version** string (*Optional*): Version of DSMR used by meter, choices: 2.2, 4 (default: 2.2). -A full configuration example can be found below: +Full configuration examples can be found below: ```yaml -# Example configuration.yaml entry +# Example configuration.yaml entry for USB connected Smartmeter sensor: - platform: dsmr port: /dev/ttyUSB1 @@ -69,6 +70,25 @@ group: - sensor.gas_consumption ``` +```yaml +# Example configuration.yaml entry for remote (TCP/IP, i.e. via ser2net) connection to host which is connected to Smartmeter +sensor: + - platform: dsmr + host: 192.168.1.13 + port: 2001 + dsmr_version: 4 + +group: + meter_readings: + name: Meter readings + entities: + - sensor.power_consumption_low + - sensor.power_consumption_normal + - sensor.power_production_low + - sensor.power_production_normal + - sensor.gas_consumption +``` + [HASSbian](/getting-started/installation-raspberry-pi-image/) users have to give dialout permission to the user `homeassistant`: ``` From 034450b908d58d9508a9f6488a81fd11f2d8aa6c Mon Sep 17 00:00:00 2001 From: Alex Mekkering Date: Wed, 4 Jan 2017 13:35:20 +0100 Subject: [PATCH 2/3] Processed review comment and added ser2net config --- source/_components/sensor.dsmr.markdown | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/_components/sensor.dsmr.markdown b/source/_components/sensor.dsmr.markdown index 3a80865984b9..b8f864e90d08 100644 --- a/source/_components/sensor.dsmr.markdown +++ b/source/_components/sensor.dsmr.markdown @@ -33,10 +33,15 @@ This component is known to work for: - Kaifa E0026 - Kamstrup 382JxC (DSMR 2.2) -And USB serial converters: +,USB serial converters: - Cheap (Banggood/ebay) Generic PL2303 - https://sites.google.com/site/nta8130p1smartmeter/webshop +- https://www.sossolutions.nl/slimme-meter-kabel + +And Serial to network proxies: + +- ser2net - http://ser2net.sourceforge.net/ ```yaml # Example configuration.yaml entry @@ -53,7 +58,7 @@ Configuration variables: Full configuration examples can be found below: ```yaml -# Example configuration.yaml entry for USB connected Smartmeter +# Example configuration.yaml entry for USB/serial connected Smartmeter sensor: - platform: dsmr port: /dev/ttyUSB1 @@ -89,6 +94,12 @@ group: - sensor.gas_consumption ``` +Optional configuration example for ser2net: +```sh +# Example /etc/ser2net.conf for proxying USB/serial connections to DSMRv4 smart meters +2001:raw:600:/dev/ttyUSB0:115200 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS +``` + [HASSbian](/getting-started/installation-raspberry-pi-image/) users have to give dialout permission to the user `homeassistant`: ``` From 04bc5f59376061a4bfd9980a0d122a034b8dc7ed Mon Sep 17 00:00:00 2001 From: Alex Mekkering Date: Sun, 18 Jun 2017 21:18:27 +0200 Subject: [PATCH 3/3] added optional node_id to MQTT discovery --- source/_docs/mqtt/discovery.markdown | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/_docs/mqtt/discovery.markdown b/source/_docs/mqtt/discovery.markdown index b32043a6229f..38be23ffab08 100644 --- a/source/_docs/mqtt/discovery.markdown +++ b/source/_docs/mqtt/discovery.markdown @@ -37,15 +37,18 @@ Configuration variables: The discovery topic need to follow a specific format: ```text -///<> +//[/]/<> ``` - ``: One of the supported components, eg. `binary_sensor`. +- ``: (*Optional*) id of the node providing the topic. - ``: The ID of the device. This will become the `entity_id` in Home Assistant. - `<>`: The topic `config` or `state` which defines the current action. The payload will be checked like an entry in your `configuration.yaml` file if a new device is added. This means that missing variables will be filled with the platform's default values. All configuration variables which are *required* must be present in the initial payload send to `/config`. +The `` level can be used by clients to only subscribe to their own (command) topics by using one wildcard topic like `/+//+/set`. + ### {% linkable_title Examples %} A motion detection device which can be represented by a [binary sensor](/components/binary_sensor.mqtt/) for your garden would sent its configuration as JSON payload to the Configuration topic. After the first message to `config`, then the MQTT messages sent to the state topic will update the state in Home Assistant.