1
1
/* todo:
2
2
3
3
save server and clients' ip addresses
4
+ AC auto temperature adjustment
4
5
relay1 supports temperature and countdown mode
5
6
auto open/close window with step motor
6
7
voice control: http://www.raspberrypi.org/meet-jasper-open-source-voice-computing/
@@ -9,7 +10,6 @@ to query all significient events
9
10
to startup automatically (/etc/rc.local is now fail)
10
11
//to shutdown -r now when disconnected for a long time
11
12
client can control by command line with username=control message=predefined
12
- AC auto temperature adjustment
13
13
PIR hardware adjust
14
14
*/
15
15
@@ -254,27 +254,32 @@ exec("gpio mode 29 in ; gpio mode 25 in ; gpio mode 22 out ; gpio mode 26 out ",
254
254
} ) ;
255
255
256
256
function relay1on ( ) {
257
+ exec ( "./speech_google.sh I am going to trun on the relay one." , function ( error , stdout , stderr ) { } ) ;
257
258
exec ( "gpio write 22 0" , function ( error , stdout , stderr ) { } ) ;
258
259
status . relay1countdown = 0 ;
259
260
}
260
261
261
262
function relay1off ( ) {
263
+ exec ( "./speech_google.sh I am going to trun off the relay one." , function ( error , stdout , stderr ) { } ) ;
262
264
exec ( "gpio write 22 1" , function ( error , stdout , stderr ) { } ) ;
263
265
status . relay1countdown = 0 ;
264
266
}
265
267
266
268
function relay2on ( ) {
269
+ exec ( "./speech_google.sh I am going to trun on the relay 2." , function ( error , stdout , stderr ) { } ) ;
267
270
exec ( "gpio write 26 0" , function ( error , stdout , stderr ) { } ) ;
268
271
status . relay2countdown = 0 ;
269
272
}
270
273
271
274
function relay2off ( ) {
275
+ exec ( "./speech_google.sh I am going to trun off the relay 2." , function ( error , stdout , stderr ) { } ) ;
272
276
exec ( "gpio write 26 1" , function ( error , stdout , stderr ) { } ) ;
273
277
status . relay2countdown = 0 ;
274
278
}
275
279
276
280
function ac ( action ) {
277
281
console . log ( action ) ;
282
+ exec ( "./speech_google.sh I am going to manipulate the air condition." , function ( error , stdout , stderr ) { } ) ;
278
283
status . lastACstatus = action ;
279
284
if ( action === 'ac_on' ) exec ( "irsend SEND_ONCE lircd_ac.conf power_on" , function ( error , stdout , stderr ) { } ) ;
280
285
else if ( action === 'ac_off' ) exec ( "irsend SEND_ONCE lircd_ac.conf power_off" , function ( error , stdout , stderr ) { } ) ;
@@ -345,5 +350,11 @@ var LOG = function (obj) {
345
350
}
346
351
}
347
352
353
+ /* current functions:
354
+ 2-way relay control
355
+ IR LED and receiver; air condition tested
356
+ web-based user interface with websocket
357
+ Google's Text to Speech engine
358
+ */
348
359
349
360
// end of file
0 commit comments