home-assistant.io/source/_components/sensor.mysensors.markdown
Paulus Schoutsen 1f40fdb09d 0.22 (#570)
* Initial snmp sensor docs (#538)

* Fixed markdown and added logo (#551)

* Added documentation for router operating mode for asuswrt (#545)

* local_file camera component documenatation (#554)

* Documenation for local_file camera component

* Update camera.local_file.markdown

* Added information about voltage sensor

* Instructions for Pandora media player (#552)

* Add release

* Add pub_key

* Add BT Home Hub docs

* Markdown tweaks (#553)

* Add docs about MySensors IR switch (#556)

* Update sensor.mysensors docs, about moving V_IR_SEND type to switch
  platform.
* Update switch.mysensors docs. Add section about the new service and
  additional example sketch for the IR switch device.

* Update index.html

* plex sensor (#526)

* Add var descriptions

* Adds documentation for the Local File Camera (#482)

* Revert "Adds documentation for the Local File Camera" (#563)

* Minor changes

* Add Wink Rollershutter (#559)

* Added example of using template in shell_command. (#547)

* Add Documentation for Netatmo Welcome (#542)

* Reorganize  documentation for Netatmo

As Netatmo is now a Hub component, documentations has been splitted in several
parts betweent the hub, the sensors and the camera

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* Add configuration variables for Netatmo Welcome cameras

* Add ha_release information on new documentation pages

* Netatmo Weather Station is a weather sensor

* Add blog post 0.22
2016-06-18 13:24:52 -07:00

111 lines
3.3 KiB
Markdown

---
layout: page
title: "MySensors Sensor"
description: "Instructions how to integrate MySensors sensors into Home Assistant."
date: 2016-06-12 15:00 +0200
sidebar: true
comments: false
sharing: true
footer: true
logo: mysensors.png
ha_category: Sensor
featured: false
---
Integrates MySensors sensors into Home Assistant. See the [main component] for configuration instructions.
The following sensor types are supported:
##### MySensors version 1.4 and higher
S_TYPE | V_TYPE
-------------------|---------------------------------------
S_TEMP | V_TEMP
S_HUM | V_HUM
S_BARO | V_PRESSURE, V_FORECAST
S_WIND | V_WIND, V_GUST
S_RAIN | V_RAIN, V_RAINRATE
S_UV | V_UV
S_WEIGHT | V_WEIGHT, V_IMPEDANCE
S_POWER | V_WATT, V_KWH
S_DISTANCE | V_DISTANCE
S_LIGHT_LEVEL | V_LIGHT_LEVEL
S_IR | V_IR_RECEIVE
S_WATER | V_FLOW, V_VOLUME
S_AIR_QUALITY | V_DUST_LEVEL
S_CUSTOM | V_VAR1, V_VAR2, V_VAR3, V_VAR4, V_VAR5
S_DUST | V_DUST_LEVEL
S_SCENE_CONTROLLER | V_SCENE_ON, V_SCENE_OFF
##### MySensors version 1.5 and higher
S_TYPE | V_TYPE
---------------|----------------------------------
S_COLOR_SENSOR | V_RGB
S_MULTIMETER | V_VOLTAGE, V_CURRENT, V_IMPEDANCE
S_SOUND | V_LEVEL
S_VIBRATION | V_LEVEL
S_MOISTURE | V_LEVEL
S_LIGHT_LEVEL | V_LEVEL
S_AIR_QUALITY | V_LEVEL (replaces V_DUST_LEVEL)
S_DUST | V_LEVEL (replaces V_DUST_LEVEL)
### {% linkable_title Custom unit of measurement %}
Some sensor value types are not specific for a certain sensor type. These do not have a default unit of measurement in Home Assistant. For example, the V_LEVEL type can be used for different sensor types, dust, sound, vibration etc.
By using V_UNIT_PREFIX, it's possible to set a custom unit for any sensor. The string value that is sent for V_UNIT_PREFIX will be used in preference to any other unit of measurement, for the defined sensors. V_UNIT_PREFIX can't be used as a standalone sensor value type. Sending a supported value type and value from the tables above is also required. V_UNIT_PREFIX is available with MySensors version 1.5 and later.
For more information, visit the [serial api] of MySensors.
### {% linkable_title Example sketch %}
```cpp
/**
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
* http://www.mysensors.org/build/light
*/
#include <SPI.h>
#include <MySensor.h>
#include <BH1750.h>
#include <Wire.h>
#define SN "LightLuxSensor"
#define SV "1.0"
#define CHILD_ID 1
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
BH1750 lightSensor;
MySensor gw;
MyMessage msg(CHILD_ID, V_LEVEL);
MyMessage msgPrefix(CHILD_ID, V_UNIT_PREFIX); // Custom unit message.
uint16_t lastlux = 0;
void setup()
{
gw.begin();
gw.sendSketchInfo(SN, SV);
gw.present(CHILD_ID, S_LIGHT_LEVEL);
lightSensor.begin();
gw.send(msg.set(lastlux));
gw.send(msgPrefix.set("lux")); // Set custom unit.
}
void loop()
{
uint16_t lux = lightSensor.readLightLevel(); // Get Lux value
if (lux != lastlux) {
gw.send(msg.set(lux));
lastlux = lux;
}
gw.sleep(SLEEP_TIME);
}
```
[main component]: /components/mysensors/
[serial api]: https://www.mysensors.org/download/serial_api_15