From 67068a2a232911cbcf1efe168c5ea42cc210f4f5 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sun, 8 Jan 2017 16:53:23 +0000 Subject: [PATCH] Site updated at 2017-01-08 16:53:23 UTC --- atom.xml | 2 +- blog/categories/community/atom.xml | 2 +- blog/categories/device-tracking/atom.xml | 2 +- blog/categories/esp8266/atom.xml | 2 +- blog/categories/how-to/atom.xml | 2 +- blog/categories/ibeacons/atom.xml | 2 +- blog/categories/internet-of-things/atom.xml | 2 +- blog/categories/iot-data/atom.xml | 2 +- blog/categories/micropython/atom.xml | 2 +- blog/categories/mqtt/atom.xml | 2 +- blog/categories/organisation/atom.xml | 2 +- blog/categories/owntracks/atom.xml | 2 +- blog/categories/presence-detection/atom.xml | 2 +- .../public-service-announcement/atom.xml | 2 +- blog/categories/release-notes/atom.xml | 2 +- blog/categories/survey/atom.xml | 2 +- blog/categories/talks/atom.xml | 2 +- blog/categories/technology/atom.xml | 2 +- blog/categories/user-stories/atom.xml | 2 +- blog/categories/video/atom.xml | 2 +- blog/categories/website/atom.xml | 2 +- components/light.mysensors/index.html | 138 +++++++++++++++++- sitemap.xml | 30 ++-- 23 files changed, 171 insertions(+), 39 deletions(-) diff --git a/atom.xml b/atom.xml index 44d058e6ea..ec1d69f033 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/community/atom.xml b/blog/categories/community/atom.xml index 504545ed06..5ad458bb9c 100644 --- a/blog/categories/community/atom.xml +++ b/blog/categories/community/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: community | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/device-tracking/atom.xml b/blog/categories/device-tracking/atom.xml index 2e46e0fee4..750f6c131a 100644 --- a/blog/categories/device-tracking/atom.xml +++ b/blog/categories/device-tracking/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Device-Tracking | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/esp8266/atom.xml b/blog/categories/esp8266/atom.xml index 8fdc22b62e..d1436195f1 100644 --- a/blog/categories/esp8266/atom.xml +++ b/blog/categories/esp8266/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: ESP8266 | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/how-to/atom.xml b/blog/categories/how-to/atom.xml index 1d21baf3a2..c0d5afa90b 100644 --- a/blog/categories/how-to/atom.xml +++ b/blog/categories/how-to/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: How-To | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/ibeacons/atom.xml b/blog/categories/ibeacons/atom.xml index 5bf06a8611..3d29c0d3b4 100644 --- a/blog/categories/ibeacons/atom.xml +++ b/blog/categories/ibeacons/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: iBeacons | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/internet-of-things/atom.xml b/blog/categories/internet-of-things/atom.xml index b770f668f6..3908277511 100644 --- a/blog/categories/internet-of-things/atom.xml +++ b/blog/categories/internet-of-things/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Internet-of-Things | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/iot-data/atom.xml b/blog/categories/iot-data/atom.xml index 418d5c49d5..0f04d12f77 100644 --- a/blog/categories/iot-data/atom.xml +++ b/blog/categories/iot-data/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: IoT-Data | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/micropython/atom.xml b/blog/categories/micropython/atom.xml index 28af67db42..4648ae3c56 100644 --- a/blog/categories/micropython/atom.xml +++ b/blog/categories/micropython/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Micropython | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/mqtt/atom.xml b/blog/categories/mqtt/atom.xml index f75011bb6b..d76a2148f2 100644 --- a/blog/categories/mqtt/atom.xml +++ b/blog/categories/mqtt/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: MQTT | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/organisation/atom.xml b/blog/categories/organisation/atom.xml index 3165da05f3..2fe39fe893 100644 --- a/blog/categories/organisation/atom.xml +++ b/blog/categories/organisation/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Organisation | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/owntracks/atom.xml b/blog/categories/owntracks/atom.xml index f317a58173..c3b764a6ff 100644 --- a/blog/categories/owntracks/atom.xml +++ b/blog/categories/owntracks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: OwnTracks | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/presence-detection/atom.xml b/blog/categories/presence-detection/atom.xml index 425a7075e2..49a2df8158 100644 --- a/blog/categories/presence-detection/atom.xml +++ b/blog/categories/presence-detection/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Presence-Detection | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/public-service-announcement/atom.xml b/blog/categories/public-service-announcement/atom.xml index 162c1765ed..e6322fa403 100644 --- a/blog/categories/public-service-announcement/atom.xml +++ b/blog/categories/public-service-announcement/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Public-Service-Announcement | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/release-notes/atom.xml b/blog/categories/release-notes/atom.xml index f70455e6e3..c788787d93 100644 --- a/blog/categories/release-notes/atom.xml +++ b/blog/categories/release-notes/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Release-Notes | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/survey/atom.xml b/blog/categories/survey/atom.xml index b0bda9a19f..77721bae10 100644 --- a/blog/categories/survey/atom.xml +++ b/blog/categories/survey/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Survey | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/talks/atom.xml b/blog/categories/talks/atom.xml index afdd931f28..3b67a2b0a9 100644 --- a/blog/categories/talks/atom.xml +++ b/blog/categories/talks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Talks | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/technology/atom.xml b/blog/categories/technology/atom.xml index 85e42aec01..99c83b6115 100644 --- a/blog/categories/technology/atom.xml +++ b/blog/categories/technology/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Technology | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/user-stories/atom.xml b/blog/categories/user-stories/atom.xml index d83822859b..7dfc99340d 100644 --- a/blog/categories/user-stories/atom.xml +++ b/blog/categories/user-stories/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: User-Stories | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/video/atom.xml b/blog/categories/video/atom.xml index 82d0771685..851c210602 100644 --- a/blog/categories/video/atom.xml +++ b/blog/categories/video/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Video | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index b472b84400..72968bd0f5 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Website | Home Assistant]]> - 2017-01-07T14:49:44+00:00 + 2017-01-08T16:51:10+00:00 https://home-assistant.io/ diff --git a/components/light.mysensors/index.html b/components/light.mysensors/index.html index be31b3bb99..8724bb2ea1 100644 --- a/components/light.mysensors/index.html +++ b/components/light.mysensors/index.html @@ -132,11 +132,11 @@ -

V_TYPES with a star (*) denotes required V_TYPES. Use either V_LIGHT or V_STATUS and either V_DIMMER or V_PERCENTAGE for an applicable actuator.

+

V_TYPES with a star (*) denote V_TYPES that should be sent at sketch startup. For an S_DIMMER, send both a V_DIMMER/V_PERCENTAGE and a V_LIGHT/V_STATUS message. For an S_RGB_LIGHT, send both a V_RGB and a V_LIGHT/V_STATUS message with a V_DIMMER/V_PERCENTAGE message being optional. Sketch should acknowledge a command sent from controller with the same type. If command invokes a change to off state (including a V_PERCENTAGE or V_RGB message of zero), only a V_STATUS of zero message should be sent. See sketches below for examples.

-

For more information, visit the serial api of MySensors.

+

For more information, visit the serial api of MySensors.

-

Example sketch

+

MySensors 1.x example sketch

/*
  * Documentation: http://www.mysensors.org
@@ -210,7 +210,139 @@
 }
 
+

MySensors 2.x example sketch

+
/* 
+ * Example Dimmable Light
+ * Code adapted from http://github.com/mysensors/MySensors/tree/master/examples/DimmableLight
+ * 
+ * Documentation: http://www.mysensors.org
+ * Support Forum: http://forum.mysensors.org
+ *
+ */
+
+// Enable debug prints
+#define MY_DEBUG
+
+// Enable and select radio type attached
+#define MY_RADIO_NRF24
+//#define MY_RADIO_RFM69
+
+#include <MySensors.h>
+
+#define CHILD_ID_LIGHT 1
+
+#define LIGHT_OFF 0
+#define LIGHT_ON 1
+
+#define SN "Dimmable Light"
+#define SV "1.0"
+
+int16_t last_state = LIGHT_ON;
+int16_t last_dim = 100;
+
+MyMessage light_msg( CHILD_ID_LIGHT, V_STATUS );
+MyMessage dimmer_msg( CHILD_ID_LIGHT, V_PERCENTAGE );
+
+void setup()
+{
+  update_light();
+  Serial.println( "Node ready to receive messages..." );
+}
+
+void loop()
+{
+  //In MySensors2.x, first message must come from within loop()
+  static bool first_message_sent = false;
+  if ( first_message_sent == false ) {
+    Serial.println( "Sending initial state..." );
+    send_dimmer_message();
+    send_status_message();
+    first_message_sent = true;
+  }
+}
+
+void presentation()
+{
+  // Send the sketch version information to the gateway
+  sendSketchInfo( SN, SV );
+  present( CHILD_ID_LIGHT, S_DIMMER );
+}
+
+void receive(const MyMessage &message)
+{
+  //When receiving a V_STATUS command, switch the light between OFF 
+  //and the last received dimmer value  
+  if ( message.type == V_STATUS ) {
+    Serial.println( "V_STATUS command received..." );
+
+    int lstate = message.getInt();
+    if (( lstate < 0 ) || ( lstate > 1 )) {
+      Serial.println( "V_STATUS data invalid (should be 0/1)" );
+      return;
+    }
+    last_state = lstate;
+
+    //If last dimmer state is zero, set dimmer to 100
+    if (( last_state == LIGHT_ON ) && ( last_dim == 0 )) {
+      last_dim=100;
+    }
+
+    //Update constroller status
+    send_status_message();
+    
+  } else if ( message.type == V_PERCENTAGE ) {
+    Serial.println( "V_PERCENTAGE command received..." );
+    int dim_value = constrain( message.getInt(), 0, 100 );
+    if ( dim_value == 0 ) {
+      last_state = LIGHT_OFF;
+
+      //Update constroller with dimmer value & status
+      send_dimmer_message();
+      send_status_message();      
+    } else {
+      last_state = LIGHT_ON;
+      last_dim = dim_value;
+     
+      //Update constroller with dimmer value
+      send_dimmer_message();
+    }
+        
+  } else {
+    Serial.println( "Invalid command received..." );
+    return;
+  }
+
+  //Here you set the actual light state/level
+  update_light();
+}
+
+void update_light()
+{
+  //For this example, just print the light status to console.
+  if ( last_state == LIGHT_OFF ) {
+    Serial.println( "Light state: OFF" );
+  } else {
+    Serial.print( "Light state: ON, Level: " );
+    Serial.println( last_dim );
+  }
+}
+
+void send_dimmer_message()
+{
+  send( dimmer_msg.set( last_dim ) );
+}
+
+void send_status_message()
+{
+  if ( last_state == LIGHT_OFF ) {
+    send( light_msg.set( (int16_t)0) );
+  } else {
+    send( light_msg.set( (int16_t)1) );
+  }
+}
+
+
diff --git a/sitemap.xml b/sitemap.xml index 1e63734005..e6237f885f 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2509,62 +2509,62 @@ https://home-assistant.io/demo/frontend.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/index.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-event.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-info.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-service.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-state.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-template.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-history.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-iframe.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-logbook.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/demo/panels/ha-panel-map.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/googlef4f3693c209fe788.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00 https://home-assistant.io/static/mdi-demo.html -2017-01-07T14:49:04+00:00 +2017-01-08T16:50:28+00:00