home-assistant.io/source/_components/sensor.dweet.markdown
2016-04-30 22:47:36 +02:00

2.1 KiB

layout, title, description, date, sidebar, comments, sharing, footer, logo, ha_category, ha_release
layout title description date sidebar comments sharing footer logo ha_category ha_release
page Dweet.io Instructions how to integrate Dweet.io sensors within Home Assistant. 2015-12-10 10:15 true false true true dweet.png Sensor 0.10

The dweet sensor platform allows you to get details from your devices which are publishing their values to Dweet.io.

To use Dweet.io in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
sensor:
  platform: dweet
  name: Dweet.io Temperature
  device: THING_NAME
  value_template: '{% raw %}{{ value_json.VARIABLE }}{% endraw %}'
  unit_of_measurement: "°C"

Configuration variables:

  • device (Required): Identification of the device (also known as thing).
  • name (Optional): Let you overwrite the the name of the device in the frontend.
  • value_template (Required): The variable to extract a value from the content.
  • unit_of_measurement (Optional): Defines the unit of measurement of the sensor, if any.

{% linkable_title Interacting with Dweet.io %}

You can easily send dweets from the commandline to test your sensor.

$ curl -H 'Content-Type: application/json' -d '{"temperature": 40, "humidity": 65}' https://dweet.io/dweet/for/ha-sensor

will give you a response like the one below:

{"this":"succeeded","by":"dweeting","the":"dweet","with":{"thing":"ha-sensor","created":"2015-12-10T09:43:31.133Z","content":{"temperature":40,"humidity":65}}}

The dweepy module gives you another option to work with Dweet.io.

Send a dweet.

$ python3
>>> import dweepy
>>> dweepy.dweet_for('ha-sensor', {'temperature': '23', 'humiditiy':'81'})
{'thing': 'ha-sensor', 'created': '2015-12-10T09:46:08.559Z', 'content': {'humiditiy': 81, 'temperature': 23}}

Recieve the latest dweet.

>>> dweepy.get_latest_dweet_for('ha-sensor')
[{'thing': 'ha-sensor'', 'created': '2015-12-10T09:43:31.133Z', 'content': {'humidity': 65, 'temperature': 40}}]