Comments (7)
The example ino mqtt file does not support direct keypad entry. If you have some coding familiarity you can try adding support for it by adding the code snippet below to the ino file in the "mqttcallback" function after the disarm if statement. Note that that I have not tested this on a dsc system as I use something similar to the code below on my vista implementation so adapted it for this use. You might need to tweak it and debug it. This should add the ability to recognize when a direct keypad command is sent by using an exclamation mark '!' as a trigger . eg. !1234 where 1234 is your code to be sent directly to the panel. You can then send anything you want. If you want to send to as specific partition, you would enter 1!1234 where the first character is the partition, then the ! as the direct code flag, then your digits.
For example to disarm partition 1, instead of sending "1D", you would send 1!1234 where 1234 is your disarm code.
// direct command
if (payload[payloadIndex] == '!' && payloadIndex+1<length) {
payload[length] = '\0';
dsc.write((char * ) &payload[payloadIndex+1]);
}
from dsckeybusinterface.
My HomeAssistant-MQTT.ino file now looks like:
// Arm night
else if (payload[payloadIndex] == 'N' && !dsc.armed[partition] && !dsc.exitDelay[partition]) {
dsc.writePartition = partition + 1; // Sets writes to the partition number
dsc.write('n'); // Virtual keypad arm away
}
// Disarm
else if (payload[payloadIndex] == 'D' && (dsc.armed[partition] || dsc.exitDelay[partition] || dsc.alarm[partition])) {
dsc.writePartition = partition + 1; // Sets writes to the partition number
dsc.write(accessCode);
}
// direct command
// Added per https://github.com/taligentx/dscKeybusInterface/issues/304
if (payload[payloadIndex] == '!' && payloadIndex+1<length) {
payload[length] = '\0';
dsc.write((char * ) &payload[payloadIndex+1]);
}
And my HA config now looks like:
mqtt:
alarm_control_panel:
- name: Alarm Partition 1
state_topic: dsc/Get/Partition1
command_topic: dsc/Set
availability:
topic: dsc/Status
code: REMOTE_CODE
command_template: >
{{ action }}{{ code }}
payload_disarm: 1!
payload_arm_home: 1S
payload_arm_away: 1A
payload_arm_night: 1N
Now I can successfully pass the user code to disarm the panel. However, this creates a new issue with HA where it wants to pass "1S{code}" to MQTT. Of course this is expected given the "command_template", so that begs the question... What would be the direct command for "S", "A", and "N" for home, away, and night respectively? I looked through the code, but couldn't find an obvious answer.
Side note:
This whole project is amazing. Great work on both the hardware and software! I had an AD2Pi module that was damaged due to a close lightning strike. I was tempted to replace it with an EV4 from EyezOn, but with some components I had laying around, an old Arduino Uno, and an Ethernet shield, I have a fully functioning MQTT based interface for my PC1864. The best part - no proprietary firmware limitations!
from dsckeybusinterface.
The following snippet works on the HA side as a hackish way to solve the issue I mentioned above:
mqtt:
alarm_control_panel:
- name: Alarm Partition 1
state_topic: dsc/Get/Partition1
command_topic: dsc/Set
availability:
topic: dsc/Status
code: REMOTE_CODE
command_template: >
{% if action == "1D" %}
1!{{ code }}
{% else %}
{{ action }}
{% endif %}
payload_disarm: 1D
payload_arm_home: 1S
payload_arm_away: 1A
payload_arm_night: 1N
from dsckeybusinterface.
The S, A and N are the direct commands for those modes as they simulate the DSC panel keys assigned to those functions.
Since you are using homeassistant you might also be interested in using ESPHome instead of MQTT. Here's a link to my implementation of this library adapted to ESPHome.
https://github.com/Dilbert66/esphome-dsckeybus/tree/new
Edit: Other direct commands you can send such as *0 to quick arm your system (that's assuming quick arming is enabled on your panel).
*9 will arm your system in Stay mode with no entry delay, *1 to bypass zones,etc. See your user manual for those.
from dsckeybusinterface.
@Dilbert66 I saw your ESPHome implementation before I built my Arduino shield. Nice work there, especially with the example PCBs. The only thing that stopped me, aside from not having the hardware on hand, was a lack of simple implementation using Ethernet instead of WiFi. I really need a hard wired Ethernet connection. Perhaps I should ask about that on your github repo instead of here.
from dsckeybusinterface.
There's a few boards that are out that include an esp32 with built in ethernet connectivity such as :
https://www.aliexpress.com/item/4001122992446.html
Then you configure esphome to use ethernet:
https://esphome.io/components/ethernet.html
Edit: the WT32-ETH01 is also a good less expensive board but needs an external usb to serial adapter to flash initially.
from dsckeybusinterface.
@Dilbert66 I tried your direct command example to bypass a zone with the following changes:
- I changed '!' to "|" to be able to use mosquitto_pub for testing. '!' is sort of reserved in bash.
- I also had to set blockingWrite to true in the dsc.write() call.
With these changes "|*102#" bypasses zone 2.
Thanks for the suggestion .
from dsckeybusinterface.
Related Issues (20)
- Question ) Module message for fir, auxiliary and panic alarm
- question HOT 3
- [Contribution] New Status on Set 0x16 / Module PC5200 HOT 4
- Status not properly reported for "stay no entry delay"
- PC3000 Testing HOT 9
- esp32-Poe adapter support? HOT 1
- Temperature display HOT 2
- QR Code
- VirtualKeypad-Web compilation error HOT 1
- VirtualKeypad WEB, serial output.
- Keybus Error / Address? HOT 3
- OpenHab MQTT esp8266 issue
- DSC PC1550 Clasic Series 6 digit code compile ok but keep rebooting HOT 2
- Make your own input expander
- Debugging disarm not working overnight HOT 3
- Ignore
- Lastest version outgrew UNO?? HOT 3
- Unable to request states for Zone 9 and 11+ (1-8 and 10 working fine) PC3000 HOT 1
- PC3000 - Zones 9-16 not updating HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dsckeybusinterface.