Again, FTR: Eclipse Community Forums: Eclipse SmartHome » Device configuration system
Hello,
I use paper UI for discovering things and I use sitemap, rule and things for DEV in files.
The two system speak very well (only a little thing on motion alarm by zwave is not working, but Chris is a very well software engineer and will resolve ).
I use Zwave things with key usb, hue bulbs and squeezebox for sound. All enabled by voice with android app.
I paste my code (now it’s not working because yesterday I did some change fot the alarm and I have to debug) maybe can help you:
I write my “resolution of problems” on post Little help for new users OH2
items:
Number Scena "Scena" <scena>
Number Giardino "Giardino" <Giardino>
String VoiceCommand
Switch squeezeboxOn { channel="squeezebox:squeezeboxplayer:D758D8B6-0D7F-490E-BCCF-8BB89A4E9938:000420296210:power" }
String squeezeboxStream { channel="squeezebox:squeezeboxplayer:D758D8B6-0D7F-490E-BCCF-8BB89A4E9938:000420296210:stream" }
String cucinaMotion { channel="161955dc:node28:alarm_motion" }
String Luce1Sala { channel="hue:0210:00178828f4ed:1:color" }
String Luce2Sala { channel="hue:0210:00178828f4ed:2:color" }
String LuceDivano { channel="hue:0210:00178828f4ed:3:color" }
String LuceCucina { channel="hue:0210:00178828f4ed:4:color" }
String LuceGiardino { channel="hue:0210:00178828f4ed:5:color" }
Switch alarm_Keypad { channel="zwave:device:161955dc:node14:alarm_access"}
Switch alarm_Voice
Number allarme_Fired
Switch contatto_cucina { channel="zwave:device:161955dc:node28:sensor_door" }
Switch contatto_sala { channel="zwave:device:161955dc:node8:sensor_door" }
Switch contatto_bagno { channel="zwave:device:161955dc:node11:sensor_door" }
rules
rule testVoice
when
Item VoiceCommand received command
then
var String command = VoiceCommand.state.toString.toLowerCase
var HSBType lucegiardino = new HSBType(new DecimalType(68),new PercentType(88),new PercentType(30))
var HSBType lucerelax = new HSBType(new DecimalType(74),new PercentType(78),new PercentType(36))
var HSBType luceoff = new HSBType(new DecimalType(0),new PercentType(0),new PercentType(0))
var HSBType luce = new HSBType(new DecimalType(181),new PercentType(20),new PercentType(100))
var HSBType lucelettura = new HSBType(new DecimalType(84),new PercentType(47),new PercentType(100))
if (command.contains("relax")) {
Luce1Sala.sendCommand(lucerelax)
Luce2Sala.sendCommand(lucerelax)
LuceDivano.sendCommand(lucerelax)
LuceCucina.sendCommand(lucerelax)
Scena.sendCommand(1)
}
if (command.contains("lettura")) {
Luce1Sala.sendCommand(lucelettura)
Luce2Sala.sendCommand(lucelettura)
LuceDivano.sendCommand(lucelettura)
LuceCucina.sendCommand(lucelettura)
Scena.sendCommand(2)
}
if (command.contains("luce")) {
if ((Scena.state == 4)) {
Luce1Sala.sendCommand(luce)
Luce2Sala.sendCommand(luce)
LuceDivano.sendCommand(luce)
LuceCucina.sendCommand(luce)
Scena.sendCommand(0)
squeezeboxStream.sendCommand("http://www.voicerss.org/controls/speech.ashx?hl=it-it&src=allarme%20attivo&c=mp3")
}else{
Luce1Sala.sendCommand(luceoff)
Luce2Sala.sendCommand(luceoff)
LuceDivano.sendCommand(luceoff)
LuceCucina.sendCommand(luceoff)
Scena.sendCommand(4)
}
}
if (command.contains("giardino")) {
if ((Giardino.state == 1)) {
LuceGiardino.sendCommand(luceoff)
Giardino.sendCommand(0)
}else{
LuceGiardino.sendCommand(lucegiardino)
Giardino.sendCommand(1)
}
}
if (command.contains("radio")) {
if(squeezeboxOn.state == ON){
squeezeboxOn.sendCommand(OFF)
}else{
squeezeboxOn.sendCommand(ON)
squeezeboxStream.sendCommand("http://onair18.xdevel.com:8014/")
}
}
if (command.contains("allarme")) {
if(alarm_Voice.state == ON){
alarm_Voice.sendCommand(OFF)
}else{
alarm_Voice.sendCommand(ON)
}
}
end
rule "door_contact"
when
Item contatto_cucina changed
or Item contatto_sala changed
or Item contatto_bagno changed
or Item alarm_voice changed
or alarm_keypad changed
then
if (contatto_cucina.state = ON or contatto_cucina.state = ON or contatto_cucina.state = ON ){
if (alarm_voice = ON or alarm_keypad = ON){
allarme_Fired.sendCommand(1)
}else{
allarme_Fired.sendCommand(0)
}
}
end
rule "Alarm"
when
Item allarme_Fired changed
then
if (allarme_Fired.state = 0){
LuceGiardino.sendCommand(luceoff)
}else{
LuceGiardino.sendCommand(lucelettura)
}
end
and sitemap
sitemap demo label="Casa" {
Frame label="Scene" {
Switch item=Scena label="Scene casa" mappings=[0="Luce", 1="Relax", 2="Lettura", 4="Spegni"]
}
Frame label="Allarme" {
Switch item=zwave_device_161955dc_node14_alarm_access label="Allarme keypad" mappings=["OFF"="OFF", "ON"="ON"] icon="alarm"
Switch item=alarm_Voice label="Allarme voce" mappings=["OFF"="OFF", "ON"="ON"] icon="alarm"
}
Frame label="Temperature" {
Text item=VoiceCommand label="Voice"
Text item=zwave_device_161955dc_node28_sensor_temperature label="Temperatura cucina [%.1f °C]" icon="temperature"
Text item=zwave_device_161955dc_node26_sensor_temperature label="Temperatura esterna [%.1f °C]" icon="temperature"
Text item=zwave_device_161955dc_node8_sensor_temperature label="Temperatura sala [%.1f °C]" icon="temperature"
Text item=zwave_device_161955dc_node11_sensor_temperature label="Temperatura bagno [%.1f °C]" icon="temperature"
}
Frame label="Sicurezza" {
Switch item=zwave_device_161955dc_node28_alarm_motion label="Movimento cucina" mappings=["OFF"="OFF", "ON"="ON"] icon="motion"
Switch item=zwave_device_161955dc_node8_alarm_motion label="Movimento sala" mappings=["OFF"="OFF", "ON"="ON"] icon="motion"
Switch item=zwave_device_161955dc_node11_alarm_motion label="Movimento bagno" mappings=["OFF"="OFF", "ON"="ON"] icon="motion"
Switch item=zwave_device_161955dc_node26_sensor_binary label="Movimento esterno" mappings=["OFF"="OFF", "ON"="ON"] icon="motion"
Switch item=zwave_device_161955dc_node28_sensor_door label="Finestra cucina" mappings=["CLOSED"="OFF", "OPEN"="ON"] icon="window"
Switch item=zwave_device_161955dc_node8_sensor_door label="Finestrone sala" mappings=["CLOSED"="OFF", "OPEN"="ON"] icon="window"
Switch item=zwave_device_161955dc_node11_sensor_door label="Finestra bagno" mappings=["CLOSED"="OFF", "OPEN"="ON"] icon="window"
}
Frame {
Chart item=zwave_device_161955dc_node26_sensor_temperature period=W refresh=86400 label="Temperatura esterna"
}
}