Skip to content

Add mysensors types #1031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 59 additions & 55 deletions source/_components/climate.mysensors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
layout: page
title: "MySensors HVAC"
description: "Instructions how to integrate MySensors climate into Home Assistant."
date: 2016-09-14 18:20 +0100
date: 2016-10-01 15:00 +0200
sidebar: true
comments: false
sharing: true
footer: true
logo: mysensors.png
ha_category: Climate
featured: false
ha_release: 0.29
---

Expand All @@ -19,18 +18,18 @@ The following actuator types are supported:

##### MySensors version 1.5 and higher

S_TYPE | V_TYPE
------------|-------------
S_HVAC | V_HVAC_FLOW_STATE*, V_HVAC_SETPOINT_HEAT, V_HVAC_SETPOINT_COOL, V_HVAC_SPEED
S_TYPE | V_TYPE
-------|-----------------------------------------------------------------------------
S_HVAC | V_HVAC_FLOW_STATE*, V_HVAC_SETPOINT_HEAT, V_HVAC_SETPOINT_COOL, V_HVAC_SPEED

V_HVAC_FLOW_STATE is mapped to the state of the Climate component in HA as follows:

Home Assistant State | MySensors State
-----------------------|----------------------
STATE_COOL | CoolOn
STATE_HEAT | HeatOn
STATE_AUTO | Off
STATE_OFF | AutoChangeOver
Home Assistant State | MySensors State
---------------------|----------------
STATE_COOL | CoolOn
STATE_HEAT | HeatOn
STATE_AUTO | Off
STATE_OFF | AutoChangeOver

Currently humidity, away_mode, aux_heat, swing_mode is not supported. This will be included in later versions as feasible.

Expand All @@ -44,67 +43,72 @@ For more information, visit the [serial api] of MySensors.

```cpp
/*
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
*/
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*/

#include <MySensor.h>
/* Include all the other Necessary code here. The example code is limited to message exchange for mysensors with the controller (ha)*/
/*
* Include all the other Necessary code here.
* The example code is limited to message exchange for mysensors
* with the controller (ha).
*/

#define CHILD_ID_HVAC 0 // childId
MyMessage msgHVACSetPointC(CHILD_ID_HVAC, V_HVAC_SETPOINT_COOL);
MyMessage msgHVACSpeed(CHILD_ID_HVAC, V_HVAC_SPEED);
MyMessage msgHVACFlowState(CHILD_ID_HVAC, V_HVAC_FLOW_STATE);

/* Include all the other Necessary code here. The example code is limited to message exchange for mysensors with the controller (ha)*/
/*
* Include all the other Necessary code here.
* The example code is limited to message exchange for mysensors
* with the controller (ha).
*/

void setup()
{
// Startup and initialize MySensors library.
// Set callback for incoming messages.
gw.begin(incomingMessage);

// Startup and initialize MySensors library. Set callback for incoming messages.
gw.begin(incomingMessage);

// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("HVAC", "0.1");
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("HVAC", "0.1");

gw.present(CHILD_ID_HVAC, S_HVAC, "Thermostat");
gw.send(msgHVACFlowState.set("Off"));
gw.send(msgHVACSetPointC.set(target_temp));
gw.send(msgHVACSpeed.set("Max"));
}

void incomingMessage(const MyMessage &message) {
String recvData = message.data;
recvData.trim();
switch (message.type) {
case V_HVAC_SPEED:
if(recvData.equalsIgnoreCase("auto")) fan_speed = 0;
else if(recvData.equalsIgnoreCase("min")) fan_speed = 1;
else if(recvData.equalsIgnoreCase("normal")) fan_speed = 2;
else if(recvData.equalsIgnoreCase("max")) fan_speed = 3;
processHVAC();
break;
case V_HVAC_SETPOINT_COOL:
target_temp = message.getFloat();
processHVAC();
break;
case V_HVAC_FLOW_STATE:
if(recvData.equalsIgnoreCase("coolon") && (!Present_Power_On )){
togglePower();
}
else if(recvData.equalsIgnoreCase("off") && Present_Power_On ){
togglePower();
}
break;
}
gw.present(CHILD_ID_HVAC, S_HVAC, "Thermostat");
gw.send(msgHVACFlowState.set("Off"));
gw.send(msgHVACSetPointC.set(target_temp));
gw.send(msgHVACSpeed.set("Max"));
}

void loop() {
// Process incoming messages (like config from server)
gw.process();
}

// Process incoming messages (like config from server)
gw.process();

void incomingMessage(const MyMessage &message) {
String recvData = message.data;
recvData.trim();
switch (message.type) {
case V_HVAC_SPEED:
if(recvData.equalsIgnoreCase("auto")) fan_speed = 0;
else if(recvData.equalsIgnoreCase("min")) fan_speed = 1;
else if(recvData.equalsIgnoreCase("normal")) fan_speed = 2;
else if(recvData.equalsIgnoreCase("max")) fan_speed = 3;
processHVAC();
break;
case V_HVAC_SETPOINT_COOL:
target_temp = message.getFloat();
processHVAC();
break;
case V_HVAC_FLOW_STATE:
if(recvData.equalsIgnoreCase("coolon") && (!Present_Power_On )){
togglePower();
}
else if(recvData.equalsIgnoreCase("off") && Present_Power_On ){
togglePower();
}
break;
}
}
```

Expand Down
18 changes: 10 additions & 8 deletions source/_components/cover.mysensors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,31 @@
layout: page
title: "MySensors Cover"
description: "Instructions how to integrate MySensors covers into Home Assistant."
date: 2016-09-25 11:30 +0100
date: 2016-10-01 15:00 +0200
sidebar: true
comments: false
sharing: true
footer: true
logo: mysensors.png
ha_category: Cover
ha_release: 0.30
ha_release: "0.30"
---

Integrates MySensors covers into Home Assistant. See the [main component] for configuration instructions.

The following actuator types are supported:

##### MySensors version 1.4
S_TYPE | V_TYPE
------------|-------------
S_COVER | V_UP, V_DOWN, V_STOP, [V_DIMMER or V_LIGHT]

S_TYPE | V_TYPE
--------|--------------------------------------------
S_COVER | V_UP, V_DOWN, V_STOP, [V_DIMMER or V_LIGHT]

##### MySensors version 1.5 and higher
S_TYPE | V_TYPE
------------|-------------
S_COVER | V_UP, V_DOWN, V_STOP, [V_PERCENTAGE or V_STATUS]

S_TYPE | V_TYPE
--------|-------------------------------------------------
S_COVER | V_UP, V_DOWN, V_STOP, [V_PERCENTAGE or V_STATUS]

All V_TYPES above are required. Use V_PERCENTAGE (or V_DIMMER) if you know the exact position of the cover in percent, use V_STATUS (or V_LIGHT) if you don't.

Expand Down
3 changes: 1 addition & 2 deletions source/_components/light.mysensors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
layout: page
title: "MySensors Light"
description: "Instructions how to integrate MySensors lights into Home Assistant."
date: 2016-04-13 14:20 +0100
date: 2016-10-01 15:00 +0200
sidebar: true
comments: false
sharing: true
footer: true
logo: mysensors.png
ha_category: Light
featured: false
ha_release: 0.13
---

Expand Down
4 changes: 2 additions & 2 deletions source/_components/mysensors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
layout: page
title: "MySensors"
description: "Instructions how to integrate MySensors sensors into Home Assistant."
date: 2016-08-26 23:00 +0200
date: 2016-10-01 15:00 +0200
sidebar: true
comments: false
sharing: true
footer: true
logo: mysensors.png
ha_category: Hub
featured: true
ha_iot_class: "Local Polling"
ha_iot_class: "Local Push"
---

The [MySensors](https://www.mysensors.org) project combines Arduino boards with NRF24L01 radio boards to build sensor networks. The component will automatically add all available devices to Home Assistant, after [presentation](#presentation) is done.
Expand Down
11 changes: 10 additions & 1 deletion source/_components/sensor.mysensors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: page
title: "MySensors Sensor"
description: "Instructions how to integrate MySensors sensors into Home Assistant."
date: 2016-06-12 15:00 +0200
date: 2016-10-01 15:00 +0200
sidebar: true
comments: false
sharing: true
Expand Down Expand Up @@ -50,6 +50,15 @@ S_LIGHT_LEVEL | V_LEVEL
S_AIR_QUALITY | V_LEVEL (replaces V_DUST_LEVEL)
S_DUST | V_LEVEL (replaces V_DUST_LEVEL)

##### MySensors version 2.0 and higher

S_TYPE | V_TYPE
----------------|--------------------------
S_INFO | V_TEXT
S_GAS | V_FLOW, V_VOLUME
S_GPS | V_POSITION
S_WATER_QUALITY | V_TEMP, V_PH, V_ORP, V_EC

### {% 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.
Expand Down
12 changes: 9 additions & 3 deletions source/_components/switch.mysensors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: page
title: "MySensors Switch"
description: "Instructions how to integrate MySensors switches into Home Assistant."
date: 2016-06-12 15:00 +0200
date: 2016-10-01 15:00 +0200
sidebar: true
comments: false
sharing: true
Expand All @@ -19,7 +19,7 @@ The following actuator types are supported:
##### MySensors version 1.4 and higher

S_TYPE | V_TYPE
---------|--------------
---------|-------------------
S_DOOR | V_ARMED
S_MOTION | V_ARMED
S_SMOKE | V_ARMED
Expand All @@ -30,7 +30,7 @@ S_IR | V_IR_SEND, V_LIGHT
##### MySensors version 1.5 and higher

S_TYPE | V_TYPE
-------------|------------------
-------------|----------------------
S_LIGHT | V_STATUS
S_BINARY | [V_STATUS or V_LIGHT]
S_SPRINKLER | V_STATUS
Expand All @@ -39,6 +39,12 @@ S_SOUND | V_ARMED
S_VIBRATION | V_ARMED
S_MOISTURE | V_ARMED

##### MySensors version 2.0 and higher

S_TYPE | V_TYPE
----------------|---------
S_WATER_QUALITY | V_STATUS

All V_TYPES for each S_TYPE above are required to activate the actuator for the platform. Use either V_LIGHT or V_STATUS depending on library version for cases where that V_TYPE is required.

For more information, visit the [serial api] of MySensors.
Expand Down