Added Oregon protocoll

Former-commit-id: ad6e4110a0338bdc1190f593cb3bd1c64ac4965c
This commit is contained in:
Ziver Koc 2015-11-19 01:27:18 +01:00
parent af01fb9ae9
commit 2df55ef214
1076 changed files with 4042 additions and 379 deletions

0
src/se/koc/hal/HALClient.java Normal file → Executable file
View file

0
src/se/koc/hal/bot/AliceBot.java Normal file → Executable file
View file

0
src/se/koc/hal/intf/HalBot.java Normal file → Executable file
View file

0
src/se/koc/hal/intf/HalSpeachToText.java Normal file → Executable file
View file

0
src/se/koc/hal/intf/HalTextToSpeach.java Normal file → Executable file
View file

View file

2
src/se/koc/hal/plugin/tellstick/TellstickParser.java Normal file → Executable file
View file

@ -23,6 +23,7 @@
package se.koc.hal.plugin.tellstick;
import se.koc.hal.plugin.tellstick.protocols.NexaSelfLearning;
import se.koc.hal.plugin.tellstick.protocols.Oregon0x1A2D;
import zutil.converters.Converter;
import java.util.HashMap;
@ -35,6 +36,7 @@ public class TellstickParser {
static {
registerProtocol(NexaSelfLearning.class);
registerProtocol(Oregon0x1A2D.class);
}

0
src/se/koc/hal/plugin/tellstick/TellstickProtocol.java Normal file → Executable file
View file

View file

@ -121,46 +121,4 @@ public class TellstickSerialComm extends Thread{
}
return instance;
}
public static void main(String[] args) {
try {
// http://developer.telldus.com/doxygen/TellStick.html
TellstickSerialComm comm = new TellstickSerialComm();
comm.connect("COM6");
try{Thread.sleep(1000);}catch(Exception e){}
NexaSelfLearning nexa = new NexaSelfLearning();
//nexa.setHouse(11772006);
nexa.setHouse(15087918);
nexa.setGroup(0);
nexa.setUnit(0);
while(true) {
nexa.setEnable(true);
nexa.setUnit(0);
comm.write(nexa);
Thread.sleep(2000);
nexa.setUnit(1);
comm.write(nexa);
Thread.sleep(2000);
nexa.setEnable(false);
nexa.setUnit(0);
comm.write(nexa);
Thread.sleep(2000);
nexa.setUnit(1);
comm.write(nexa);
Thread.sleep(2000);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

View file

@ -0,0 +1,77 @@
package se.koc.hal.plugin.tellstick.protocols;
import se.koc.hal.plugin.tellstick.TellstickProtocol;
/**
* Created by Ziver on 2015-11-19.
*/
public class Oregon0x1A2D implements TellstickProtocol {
double temperature = 0;
double humidity = 0;
@Override
public String encode() {
return null;
}
@Override
public void decode(byte[] data) {
//class:sensor;protocol:oregon;model:0x1A2D;data:20BA000000002700;
// checksum2 not used yet
// int checksum2 = data[0];
int checksum1 = data[1];
int checksum = ((data[2] >> 4) & 0xF) + (data[2] & 0xF);
int hum1 = data[2] & 0xF;
checksum += ((data[3] >> 4) & 0xF) + (data[3] & 0xF);
boolean negative = (data[3] & (1 << 3)) > 0;
int hum2 = (data[3] >> 4) & 0xF;
checksum += ((data[4] >> 4) & 0xF) + (data[4] & 0xF);
int temp2 = data[4] & 0xF;
int temp1 = (data[4] >> 4) & 0xF;
checksum += ((data[5] >> 4) & 0xF) + (data[5] & 0xF);
int temp3 = (data[5] >> 4) & 0xF;
checksum += ((data[6] >> 4) & 0xF) + (data[6] & 0xF);
int address = data[6] & 0xFF;
checksum += ((data[7] >> 4) & 0xF) + (data[7] & 0xF);
// channel not used
// uint8_t channel = (data[7] >> 4) & 0x7;
checksum += 0x1 + 0xA + 0x2 + 0xD - 0xA;
if (checksum != checksum1) {
return;
}
temperature = ((temp1 * 100) + (temp2 * 10) + temp3)/10.0;
if (negative)
temperature = -temperature;
humidity = (hum1 * 10.0) + hum2;
}
@Override
public String getProtocolName() {
return "oregon";
}
@Override
public String getModelName() {
return "0x1A2D";
}
public double getTemperature(){
return temperature;
}
public double getHumidity(){
return humidity;
}
}

0
src/se/koc/hal/struct/Dimmer.java Normal file → Executable file
View file

0
src/se/koc/hal/struct/Switch.java Normal file → Executable file
View file

0
src/se/koc/hal/struct/Trigger.java Normal file → Executable file
View file

0
src/se/koc/hal/stt/GoogleSTTClient.java Normal file → Executable file
View file

0
src/se/koc/hal/stt/ManualSTTClient.java Normal file → Executable file
View file

0
src/se/koc/hal/stt/Sphinx4STTClient.java Normal file → Executable file
View file

0
src/se/koc/hal/tts/GoogleTTSClient.java Normal file → Executable file
View file

0
src/se/koc/hal/tts/MaryLocalTTSClient.java Normal file → Executable file
View file

0
src/se/koc/hal/tts/MaryRemoteTTSClient.java Normal file → Executable file
View file