10
10
*/
11
11
/*
12
12
* @title Espalexa library
13
- * @version 2.4.1
13
+ * @version 2.4.2
14
14
* @author Christian Schwinne
15
15
* @license MIT
16
16
* @contributors d-999
49
49
#include < WiFiUdp.h>
50
50
51
51
#ifdef ESPALEXA_DEBUG
52
- #pragma message "Espalexa 2.4.1 debug mode"
52
+ #pragma message "Espalexa 2.4.2 debug mode"
53
53
#define EA_DEBUG (x ) Serial.print (x)
54
54
#define EA_DEBUGLN (x ) Serial.println (x)
55
55
#else
@@ -118,7 +118,7 @@ class Espalexa {
118
118
case EspalexaDeviceType::color: return " LST001" ;
119
119
case EspalexaDeviceType::extendedcolor: return " LCT015" ;
120
120
}
121
- return " Plug 01 " ;
121
+ return " Plug" ;
122
122
}
123
123
124
124
// device JSON string: color+temperature device emulates LCT015, dimmable device LWB010, (TODO: on/off Plug 01, color temperature device LWT010, color device LST001)
@@ -148,9 +148,9 @@ class Espalexa {
148
148
json += " \" type\" :\" " + typeString (dev->getType ());
149
149
json += " \" ,\" name\" :\" " + dev->getName ();
150
150
json += " \" ,\" modelid\" :\" " + modelidString (dev->getType ());
151
- json += " \" ,\" manufacturername\" :\" Espalexa \" ,\" productname\" :\" E" + String (static_cast <uint8_t >(dev->getType ()));
151
+ json += " \" ,\" manufacturername\" :\" Philips \" ,\" productname\" :\" E" + String (static_cast <uint8_t >(dev->getType ()));
152
152
json += " \" ,\" uniqueid\" :\" " + WiFi.macAddress () +" -" + (deviceId+1 );
153
- json += " \" ,\" swversion\" :\" 2.4.0 \" }" ;
153
+ json += " \" ,\" swversion\" :\" espalexa- 2.4.2 \" }" ;
154
154
155
155
return json;
156
156
}
@@ -174,7 +174,7 @@ class Espalexa {
174
174
}
175
175
res += " \r\n Free Heap: " + (String)ESP.getFreeHeap ();
176
176
res += " \r\n Uptime: " + (String)millis ();
177
- res += " \r\n\r\n Espalexa library v2.4.1 by Christian Schwinne 2019" ;
177
+ res += " \r\n\r\n Espalexa library v2.4.2 by Christian Schwinne 2019" ;
178
178
server->send (200 , " text/plain" , res);
179
179
}
180
180
#endif
@@ -557,6 +557,13 @@ class Espalexa {
557
557
return escapedMac;
558
558
}
559
559
560
+ // convert brightness (0-255) to percentage
561
+ uint8_t toPercent (uint8_t bri)
562
+ {
563
+ uint16_t perc = bri * 100 ;
564
+ return perc / 255 ;
565
+ }
566
+
560
567
~Espalexa (){delete devices;} // note: Espalexa is NOT meant to be destructed
561
568
};
562
569
0 commit comments