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
This commit is contained in:
parent
7ecb13a8b8
commit
1f40fdb09d
29 changed files with 650 additions and 121 deletions
|
@ -2,7 +2,7 @@
|
|||
layout: page
|
||||
title: "MySensors Switch"
|
||||
description: "Instructions how to integrate MySensors switches into Home Assistant."
|
||||
date: 2016-04-21 13:30 +0100
|
||||
date: 2016-06-12 15:00 +0200
|
||||
sidebar: true
|
||||
comments: false
|
||||
sharing: true
|
||||
|
@ -25,6 +25,7 @@ S_MOTION | V_ARMED
|
|||
S_SMOKE | V_ARMED
|
||||
S_LIGHT | V_LIGHT
|
||||
S_LOCK | V_LOCK_STATUS
|
||||
S_IR | V_IR_SEND, V_LIGHT
|
||||
|
||||
##### MySensors version 1.5 and higher
|
||||
|
||||
|
@ -38,10 +39,47 @@ S_SOUND | V_ARMED
|
|||
S_VIBRATION | V_ARMED
|
||||
S_MOISTURE | V_ARMED
|
||||
|
||||
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.
|
||||
|
||||
### {% linkable_title Example sketch %}
|
||||
### {% linkable_title Services %}
|
||||
|
||||
The MySensors switch platform exposes a service to change an IR code attribute for an IR switch device and turn the switch on. The IR switch will automatically be turned off after being turned on, if `optimistic` is set to `true` in the [config](/components/mysensors/#configuration) for the MySensors component. This will simulate a push button on a remote. If `optimistic` is `false`, the MySensors device will have to report its updated state to reset the switch. See the [example sketch](#ir-switch-sketch) for the IR switch below.
|
||||
|
||||
| Service | Description |
|
||||
| ------- | ----------- |
|
||||
| mysensors_send_ir_code | Set an IR code as a state attribute for a MySensors IR device switch and turn the switch on.|
|
||||
|
||||
The service can be used as part of an automation script. For example:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml automation entry
|
||||
automation:
|
||||
- alias: turn hvac on
|
||||
trigger:
|
||||
platform: time
|
||||
after: '5:30:00'
|
||||
action:
|
||||
service: switch.mysensors_send_ir_code
|
||||
entity_id: switch.hvac_1_1
|
||||
data:
|
||||
V_IR_SEND: '0xC284' # the IR code to send
|
||||
|
||||
- alias: turn hvac off
|
||||
trigger:
|
||||
platform: time
|
||||
after: '0:30:00'
|
||||
action:
|
||||
service: switch.mysensors_send_ir_code
|
||||
entity_id: switch.hvac_1_1
|
||||
data:
|
||||
V_IR_SEND: '0xC288' # the IR code to send
|
||||
```
|
||||
|
||||
### {% linkable_title Example sketches %}
|
||||
|
||||
#### {% linkable_title Switch sketch %}
|
||||
```cpp
|
||||
/*
|
||||
* Documentation: http://www.mysensors.org
|
||||
|
@ -86,5 +124,76 @@ void incomingMessage(const MyMessage &message)
|
|||
}
|
||||
```
|
||||
|
||||
#### {% linkable_title IR switch sketch %}
|
||||
```cpp
|
||||
/*
|
||||
* Documentation: http://www.mysensors.org
|
||||
* Support Forum: http://forum.mysensors.org
|
||||
*
|
||||
* http://www.mysensors.org/build/ir
|
||||
*/
|
||||
|
||||
#include <MySensor.h>
|
||||
#include <SPI.h>
|
||||
#include <IRLib.h>
|
||||
|
||||
#define SN "IR Sensor"
|
||||
#define SV "1.0"
|
||||
#define CHILD_ID 1
|
||||
|
||||
MySensor gw;
|
||||
|
||||
char code[10] = "abcd01234";
|
||||
char oldCode[10] = "abcd01234";
|
||||
MyMessage msgCodeRec(CHILD_ID, V_IR_RECEIVE);
|
||||
MyMessage msgCode(CHILD_ID, V_IR_SEND);
|
||||
MyMessage msgSendCode(CHILD_ID, V_LIGHT);
|
||||
|
||||
void setup()
|
||||
{
|
||||
gw.begin(incomingMessage);
|
||||
gw.sendSketchInfo(SN, SV);
|
||||
gw.present(CHILD_ID, S_IR);
|
||||
// Send initial values.
|
||||
gw.send(msgCodeRec.set(code));
|
||||
gw.send(msgCode.set(code));
|
||||
gw.send(msgSendCode.set(0));
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
gw.process();
|
||||
// IR receiver not implemented, just a dummy report of code when it changes
|
||||
if (String(code) != String(oldCode)) {
|
||||
Serial.print("Code received ");
|
||||
Serial.println(code);
|
||||
gw.send(msgCodeRec.set(code));
|
||||
strcpy(oldCode, code);
|
||||
}
|
||||
}
|
||||
|
||||
void incomingMessage(const MyMessage &message) {
|
||||
if (message.type==V_LIGHT) {
|
||||
// IR sender not implemented, just a dummy print.
|
||||
if (message.getBool()) {
|
||||
Serial.print("Sending code ");
|
||||
Serial.println(code);
|
||||
}
|
||||
gw.send(msgSendCode.set(message.getBool() ? 1 : 0));
|
||||
// Always turn off device
|
||||
gw.wait(100);
|
||||
gw.send(msgSendCode.set(0));
|
||||
}
|
||||
if (message.type == V_IR_SEND) {
|
||||
// Retrieve the IR code value from the incoming message.
|
||||
String codestring = message.getString();
|
||||
codestring.toCharArray(code, sizeof(code));
|
||||
Serial.print("Changing code to ");
|
||||
Serial.println(code);
|
||||
gw.send(msgCode.set(code));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[main component]: /components/mysensors/
|
||||
[serial api]: https://www.mysensors.org/download/serial_api_15
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue