Skip to content

Commit

Permalink
Merge pull request #23 from maragelis/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
maragelis authored Jan 6, 2019
2 parents 66d44ed + 6e44cc2 commit e699467
Show file tree
Hide file tree
Showing 5 changed files with 457 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .vscode/arduino.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"board": "esp8266:esp8266:huzzah",
"configuration": "CpuFrequency=80,VTable=flash,FlashSize=4M1M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,FlashErase=all,UploadSpeed=115200",
"configuration": "CpuFrequency=80,VTable=flash,FlashSize=4M1M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,FlashErase=none,UploadSpeed=115200",
"sketch": "ParadoxAlarmSystem/ParadoxAlarmSystemOTA/ParadoxAlarmSystemOTA.ino",
"port": "COM5",
"output": "../ArduinoOutput"
Expand Down
55 changes: 52 additions & 3 deletions ParadoxAlarmSystem/ParadoxAlarmSystemOTA/ParadoxAlarmSystemOTA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define LED LED_BUILTIN

#define TRACE 0
#define Hassio 1

const char *root_topicOut = "paradoxdCTL/out";
const char *root_topicStatus = "paradoxdCTL/status";
Expand Down Expand Up @@ -173,11 +174,59 @@ void StartSSDP()
}
}


bool sleepflag;
void SendJsonString(byte armstatus, byte event,byte sub_event ,String dummy)
{
String retval = "{ \"armstatus\":" + String(armstatus) + ", \"event\":" + String(event) + ", \"sub_event\":" + String(sub_event) + ", \"dummy\":\"" + String(dummy) + "\"}";
sendMQTT(root_topicOut,retval);
if (Hassio)
{
char ZoneTopic[80];
char stateTopic[80];

String zone = String(root_topicOut) + "/zone";
zone.toCharArray(ZoneTopic, 80);

String state_topic = String(root_topicOut) + "/state";
state_topic.toCharArray(stateTopic, 80);

if (event == 1 || event == 0)
{

zone = String(ZoneTopic) + String(sub_event);
zone.toCharArray(ZoneTopic, 80);

String zonestatus="OFF";

if (event==1 )
{
zonestatus = "ON";
}

sendMQTT(ZoneTopic, zonestatus);
}
else if (event ==2 )
{

if (sub_event==4 )
sendMQTT(stateTopic, "triggered");
if (sub_event == 11){
sendMQTT(stateTopic, "disarmed");
sleepflag = false;
}
if (sub_event == 12 && sleepflag==false)
sendMQTT(stateTopic, "armed_away");
}
else if (event == 6)
{

if (sub_event == 3 || sub_event == 4){
sendMQTT(stateTopic, "armed_home");
sleepflag=true;
}
}
}
String retval = "{ \"armstatus\":" + String(armstatus) + ", \"event\":" + String(event) + ", \"sub_event\":" + String(sub_event) + ", \"dummy\":\"" + String(dummy) + "\"}";
sendMQTT(root_topicOut,retval);


}

Expand Down
Binary file not shown.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This project uses a wemos esp8266 to read events of the serial bus of any Parado
paradoxRX gpio13 wemos d7

Debug messages can be read through usb on the wemos.


Set Hassio flag to 1 for Home assistant see wiki (Home Assistant in V2)


The 37 byte message is broken down into a json message with "Event Group" and "Sub-group"
Expand Down
Loading

0 comments on commit e699467

Please sign in to comment.