Skip to content

Commit

Permalink
Emoncms API now provides a Unit of Measurement (home-assistant#12153)
Browse files Browse the repository at this point in the history
* Update emoncms.markdown

Update to add a variable to use the Unit of measurment included in the Emoncms API call.

Minor other enhancements

* ✏️ Fix config variable layout

* ✏️ Tweak

* Remove invalid URL

* Update source/_integrations/emoncms.markdown

Co-Authored-By: Franck Nijhof <[email protected]>

* Update source/_integrations/emoncms.markdown

Co-Authored-By: Franck Nijhof <[email protected]>

* Update emoncms.markdown

Updated to reflect agreed code PR

Co-authored-by: Klaas Schoute <[email protected]>
Co-authored-by: Franck Nijhof <[email protected]>
  • Loading branch information
3 people authored Mar 5, 2020
1 parent 1a46f8c commit a70c1b8
Showing 1 changed file with 54 additions and 12 deletions.
66 changes: 54 additions & 12 deletions source/_integrations/emoncms.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,49 @@ sensor:
id: 1
```
As of Feb 2020, the integration will discover all sensors from Emoncms and will use the unit of measurement specified in the Feed from Emoncms, in preference to the one set in the configuration. Tested with [Emoncms](https://github.com/emoncms/emoncms) V10.1.13 - `unit` was added to the API around version V9.9.1.

## Configuration variables

- `api_key` (*Required*): The read API key for your Emoncms user.
- `url` (*Required*): The base URL of Emoncms, use <https://emoncms.org> for the cloud based version.
- `id` (*Required*): Positive integer identifier for the sensor. Must be unique if you specify multiple Emoncms sensors.
- `include_only_feed_id` (*Optional*): Positive integer list of Emoncms feed IDs. Only the feeds with feed IDs specified here will be displayed. Can not be specified if `exclude_feed_id` is specified.
- `exclude_feed_id` (*Optional*): Positive integer list of Emoncms feed IDs. All the feeds will be displayed as sensors except the ones listed here. Can not be specified if `include_only_feed_id` is specified.
- `sensor_names` (*Optional*): Dictionary of names for the sensors created that are created based on feed ID. The dictionary consists of `feedid: name` pairs. Sensors for feeds with their feed ID mentioned here will get the chosen name instead of the default name
- `value_template` (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to alter the feed value.
- `scan_interval` (*Optional*): Defines the update interval of the sensor in seconds.
- `unit_of_measurement` (*Optional*): Defines the unit of measurement of for all the sensors. default is "W".
{% configuration %}
api_key:
description: The read API key for your Emoncms user.
required: true
type: string
url:
description: "The base URL of Emoncms, use <https://emoncms.org> for the cloud-based version. For self-hosted Emoncms or EmonPi you may need a URL of `http://x.x.x.x/emoncms`."
required: true
type: string
id:
description: Positive integer identifier for the sensor. Must be unique if you specify multiple Emoncms sensors.
required: true
type: integer
include_only_feed_id:
description: Positive integer list of Emoncms feed IDs. Only the feeds with feed IDs specified here will be displayed. Can not be specified if `exclude_feed_id` is specified.
required: false
type: list
exclude_feed_id:
description: Positive integer list of Emoncms feed IDs. All the feeds will be displayed as sensors except the ones listed here. Can not be specified if `include_only_feed_id` is specified.
required: false
type: list
sensor_names:
description: "Dictionary of names for the sensors created that are created based on feed ID. The dictionary consists of `feedid: name` pairs. Sensors for feeds with their feed ID mentioned here will get the chosen name instead of the default name."
required: false
type: [integer, list]
value_template:
description: Defines a [template](/docs/configuration/templating/#processing-incoming-data) to alter the feed value.
required: false
type: template
scan_interval:
description: Defines the update interval of the sensor in seconds.
required: false
type: integer
unit_of_measurement:
description: Defines the unit of measurement to be used for any sensor where the unit is *not* set in Emoncms. If no unit is set in Emoncms or in the configuration, the default (W) will be used.
required: false
default: W
type: string
{% endconfiguration %}

## Default naming scheme

Expand All @@ -45,6 +77,16 @@ If `sensor_names` is used, any feeds with defined names will get those names exa

In this section you find some more examples of how this sensor can be used.

Minimal configuration. All Feeds are added as sensors with the unit of measurement being set by the Emoncms Feed or the default unit.

```yaml
sensor:
platform: emoncms
api_key: API_KEY
url: https://emoncms.org
id: 1
```

Display only feeds with their feed IDs specified in `include_only_feed_id`.

```yaml
Expand All @@ -69,7 +111,7 @@ sensor:
api_key: API_KEY
url: https://emoncms.org
id: 1
unit_of_measurement: "KWH"
unit_of_measurement: "kWh"
exclude_feed_id:
- 107
- 105
Expand All @@ -84,7 +126,7 @@ sensor:
api_key: API_KEY
url: https://emoncms.org
id: 1
unit_of_measurement: "KW"
unit_of_measurement: "kW"
include_only_feed_id:
- 5
- 120
Expand Down Expand Up @@ -126,7 +168,7 @@ sensor:
- 107
- 106
- platform: emoncms
api_key: put your emoncms read api key here
api_key: API_KEY
url: https://emoncms.org
id: 2
scan_interval: 60
Expand Down

0 comments on commit a70c1b8

Please sign in to comment.