Hi Olddawgpowers
Sorry about that. It’s [email protected]. Since I was hacked I try not to any info over the open Internet.
5310H
Hi Olddawgpowers
Sorry about that. It’s [email protected]. Since I was hacked I try not to any info over the open Internet.
5310H
@olympia , what branch of the code are you using? Are you using the latest version? There is something odd with your logs. It shows your system alternatively showing ready and secure system on partition 1. At this point, I do not know what is causing this.
@Dilbert66 I am using the new branch/latest.
Maybe I was providing misleading info when I was saying I have the same issue.
I actually see this when system is disarmed, but a motion zone gets triggered.
I.e. any zones gets opened (e.g. 03: Zones open), then Partition 1 status gets unavailable. As soon as the triggered zone gets back to normal/closed, then Partition 1 status gets back to disarmed.
Ok, that’s normal for a partition status to go unavailable when a zone is open /triggered since the system can’t be armed with a zone open. Either way, your logs do not look right. You should not be seeing this:
[15:50:56][D][text_sensor:067]: ‘dscalarm line1’: Sending state ‘System is Ready’
[15:50:56][D][text_sensor:067]: ‘dscalarm line2’: Sending state ‘Zone 17 <>’
The line 2 should not show the zone 17, it should be showing Ready to Arm. That’s very odd. I suppose it could be a code issue, but I’m running the same version here on my test system and not seeing this. Your line 2 messages are not working as they should . Can you post your yaml config.
Sure, here it is (I don’t even know what Zone 17 is/ should be and where it is coming from):
#for documentation see project at https://github.com/Dilbert66/esphome-dsckeybus
#you can enter a list of user codes mapped to their names for display in armed/disarmed event messages
globals:
- id: userCodes
type: std::string
restore_value: no
initial_value: '"1:John,2:Sally,3:Bob"'
substitutions:
# change the name to suit your needs. This is what esphome will use as the friendly name for your component.
# also used as a prefix for all fields
systemName: "dscalarm"
#Only comes into effect if a password prompt occurs when arming eg. night mode
accessCode: !secret access_code
#used to select the default partition associated with the alarm panel messages
defaultPartition: "1"
#zone expander addresses:
# 9 - zones 9-16
# 10 - zones 17-24
# 11 - zones 25-32
# 12 - zones 33-40 (for systems with 64 zone support)
# 13 - zones 41-48 (for systems with 64 zone support)
# 14 - zones 49-56 (for systems with 64 zone support)
# 16 - zones 57-64 (for systems with 64 zone support)
expanderAddr1: "0" # 1st zone expander emulator address to use . Set to 0 to disable.
expanderAddr2: "0" # 2nd expander emulator address to use . Set to 0 to disable.
#WT32-ETH01 Pins
dscClockPin: "15"
dscReadPin: "14"
dscWritePin: "4"
maxZones: "32" # maximum amount of zones your system supports
esphome:
name: $systemName
platform: ESP32
board: esp-wrover-kit
includes:
# subdirectory path where custom component *.h and *.cpp files are located
- dscKeybusInterface/
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_IN
phy_addr: 1
power_pin: GPIO16
domain: .localdomain
logger:
baud_rate: 115200
level: DEBUG
# Home Assistant API communication
api:
ota:
safe_mode: True
on_begin:
then:
- switch.turn_off: connection_status_switch
#status_led:
# pin:
# number: GPIO2
# inverted: no
time:
- platform: sntp
id: sntp_time
custom_component:
- id: dsckeybus
lambda: |-
auto DSCkeybus = new DSCkeybushome($dscClockPin,$dscReadPin,$dscWritePin);
DSCkeybus->accessCode="$accessCode";
DSCkeybus->maxZones=$maxZones;
DSCkeybus->defaultPartition=$defaultPartition;
DSCkeybus->debug=2; // 0 = off, 1 = minimal, 2 = all packets shown on console 3 = + serial port debugging
DSCkeybus->expanderAddr1=$expanderAddr1; //zone expander
DSCkeybus->expanderAddr2=$expanderAddr2;
DSCkeybus->onSystemStatusChange([&](std::string statusCode) {
id(system_status).publish_state(statusCode);
});
// if you only have one partition, remove the case 2 and corresponding p2 sensor. You can also add more partitions if needed
DSCkeybus->onPartitionStatusChange([&](std::string statusCode, int partition) {
switch(partition) {
case 1: id(p1).publish_state(statusCode); break;
}
});
DSCkeybus->onPartitionMsgChange([&](std::string msg,uint8_t partition) {
switch(partition) {
case 1: id(m1).publish_state(msg); break;
} // if you only have one partition, remove the case 2 statement and corresponding p2 sensor. You can also add more partitions if needed
});
DSCkeybus->onPanelStatusChange([&](panelStatus ps,bool open,int partition) {
switch (partition) {
case 0: // all partitions hardware statuses
switch(ps) {
case trStatus: id(tr).publish_state(open);break;
case batStatus: id(bat).publish_state(open);break;
case acStatus: id(ac).publish_state(open);break;
case panicStatus: id(panic).publish_state(open);break;
default: break;
};break;
case 1: //partition 1 armed/ready
switch(ps) {
case rdyStatus: id(rdy).publish_state(open);break;
case armStatus: id(arm).publish_state(open);break;
default: break;
};break;
};
});
DSCkeybus->onZoneMsgStatus([&](std::string msg) {
id(zone_status).publish_state(msg);
});
DSCkeybus->onLine1Display([&](std::string msg,int partition) {
switch(partition) {
case 1: id(line1).publish_state(msg);break;
}
});
DSCkeybus->onLine2Display([&](std::string msg,int partition) {
switch(partition) {
case 1: id(line2).publish_state(msg);break;
}
});
DSCkeybus->onEventInfo([&](std::string msg) {
id(event).publish_state(msg);
});
DSCkeybus->onBeeps([&](std::string beep,int partition) {
switch(partition) {
case 1: id(beeps).publish_state(beep);break;
}
});
DSCkeybus->onFireStatusChange([&](bool open,int partition) {
switch (partition) {
case 1: id(f1).publish_state(open); break;
}
});
DSCkeybus->onTroubleMsgStatus([&](std::string msg) {
id(tr_msg).publish_state(msg); //non partition specific trouble messages
});
DSCkeybus->onZoneStatusChange([&](uint8_t zone, bool open) {
switch (zone) {
case 1: id(z1).publish_state(open); break;
case 2: id(z2).publish_state(open); break;
case 3: id(z3).publish_state(open); break;
case 4: id(z4).publish_state(open); break;
case 5: id(z5).publish_state(open); break;
case 6: id(z6).publish_state(open); break;
case 8: id(z8).publish_state(open); break;
case 9: id(z9).publish_state(open); break;
} // add or delete any zone you need above. Add the coresponding sensor id in the binary_sensor section
});
DSCkeybus->onRelayChannelChange([&](uint8_t channel, bool state) {
switch (channel) {
case 1: id(r1).publish_state(state); break;
case 2: id(r2).publish_state(state); break;
case 3: id(r3).publish_state(state); break;
case 4: id(r4).publish_state(state); break;
}
});
return {DSCkeybus};
#ESP32 only . Calls a public function within the custom component above. In this case syncs the time
#interval:
# - interval: 3600s
# then:
# - lambda: |-
# static_cast< DSCkeybushome*> (id(dsckeybus).get_component(0))->set_panel_time();
# add or remove any zone you need. Please ensure you also add/remove the corresonponding case statement above
# change the name to match your own zone configurations
# if you don't want to delete a zone, you can also comment out the name: field to hide it from home assistant
binary_sensor:
#zone status open/close for each zone
- platform: template
id: z1
name: "$systemName Előszoba (z1)"
device_class: motion
- platform: template
id: z2
name: "$systemName Garázs (z2)"
device_class: motion
- platform: template
id: z3
name: "$systemName Konyha (z3)"
device_class: motion
- platform: template
id: z4
name: "$systemName Üvegtörés (z4)"
device_class: motion
- platform: template
id: z5
name: "$systemName Nappali (z5)"
device_class: motion
- platform: template
id: z6
name: "$systemName Gaming Room (z6)"
device_class: motion
- platform: template
id: z8
name: "$systemName Szabotázs (z8)"
device_class: motion
- platform: template
id: z9
name: "$systemName Emelet (z9)"
device_class: motion
- platform: template
id: rdy
name: "$systemName Partition 1 Ready"
- platform: template
id: arm
name: "$systemName Partition 1 Armed"
#panel trouble status on/off
- platform: template
id: tr
name: "$systemName Trouble Status"
device_class: problem
#battery status ok/low
- platform: template
id: bat
name: "$systemName Battery Status"
device_class: problem
#AC power status ok/no power
- platform: template
id: ac
name: "$systemName AC Status"
device_class: plug
#panic alarm on/off
- platform: template
id: panic
name: "$systemName Panic Status"
device_class: safety
#fire alarm on/off
- platform: template
id: f1
device_class: safety
name: "$systemName Fire partition 1 Status"
#fire alarm on/off
#relay PGM channels. Will show the state of the activate relay channel on/off
#uncomment the name: field if you wish to see it in home assistant
- platform: template
id: r1
name: "$systemName PGM 1"
- platform: template
id: r2
name: "$systemName PGM 2"
- platform: template
id: r3
name: "$systemName PGM 3"
- platform: template
id: r4
name: "$systemName PGM 4"
# this sensor below is optional - example use of pin d8 as a zone trigger pin for the emulated zone expander
# this emulates the hardware connection for a pc5108 board. Use a pull down/pull up resistor. Adjust logic accordingly for the correct logic output. ie invert
# - platform: gpio
# pin: D8
# id: pind8
# device_class: window
# on_press: #pin high=on(open), pin low=off(closed)
# - lambda: |-
# dsc.setZoneFault(17,1); #set zone 17 as open
# on_release:
# - lambda: |-
# dsc.setZoneFault(17,0); #set zone 17 as closed
text_sensor:
#general system status online/disconnected
- platform: template
id: system_status
name: "$systemName System Status"
icon: "mdi:shield"
#battery level status for wireless channels, tamper , in alarm, etc for individual zones
- platform: template
id: zone_status
name: "$systemName zone status "
icon: "mdi:shield"
# partition status ie read/unavailable, in alarm, etc
- platform: template
id: p1
name: "$systemName Partition 1 Status "
icon: "mdi:shield"
# more verbose message regarding the partition status. ie zones open, bypassed, etc
- platform: template
id: m1
name: "$systemName Partition 1 Msg "
icon: "mdi:alert-box"
- platform: template
id: line1
name: "$systemName line1"
icon: "mdi:alert-box"
- platform: template
id: line2
name: "$systemName line2"
icon: "mdi:alert-box"
- platform: template
id: event
name: "$systemName event"
icon: "mdi:alert-box"
- platform: template
id: beeps
name: "$systemName beeps"
icon: "mdi:alert-box"
- platform: template
id: tr_msg
name: "$systemName Trouble Msg " # uncomment to show in home assistant
icon: "mdi:alert-box"
switch:
#shows status of connection status to panel. You can disconnect before upload using the switch.
- platform: template
name: "$systemName Connection"
id: connection_status_switch
lambda: |-
return dsc.keybusConnected;
icon: "mdi:shield-link-variant"
turn_on_action:
- switch.toggle: restart_switch
turn_off_action:
- lambda: |-
disconnectKeybus();
- platform: restart
id: restart_switch
Regarding the partition status: shouldn’t this showing “Zones Open” or something similar instead of Unavailable? Or maybe just stay “Disarmed”?
Checking the logs again, now I don’t see the references with the above config in there. Not sure what happened as the config didn’t change. Is this looking better?
[18:24:23][I][Paneldata: :976]: 27: 27 00 81 01 00 C7 10 80 00 00 00 00 00 00 00 00
[18:24:23][D][info:1778]: status 01, last status 01,line2status 00,selection 01,partition=1,skip=0
[18:24:23][D][text_sensor:067]: 'dscalarm line1': Sending state 'System is Ready'
[18:24:23][D][text_sensor:067]: 'dscalarm line2': Sending state 'Ready to Arm <>'
[18:24:23][D][binary_sensor:036]: 'dscalarm Nappali (z5)': Sending state ON
[18:24:23][D][text_sensor:067]: 'dscalarm zone status ': Sending state 'OP:5'
[18:24:23][I][Paneldata: :976]: 05: 05 00 80 03 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:24:23][D][info:1778]: status 03, last status 01,line2status 00,selection 01,partition=1,skip=0
[18:24:23][D][text_sensor:067]: 'dscalarm line1': Sending state 'Secure System'
[18:24:23][D][text_sensor:067]: 'dscalarm line2': Sending state 'Before Arming <>'
[18:24:24][D][text_sensor:067]: 'dscalarm Partition 1 Msg ': Sending state '03: Zones open'
[18:24:24][D][text_sensor:067]: 'dscalarm Partition 1 Status ': Sending state 'unavailable'
[18:24:24][D][binary_sensor:036]: 'dscalarm Partition 1 Ready': Sending state OFF
[18:24:24][D][text_sensor:067]: 'dscalarm Partition 1 Msg ': Sending state '03: Zones open'
[18:24:24][D][text_sensor:067]: 'dscalarm Trouble Msg ': Sending state ''
[18:24:25][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:24:25][I][Moduledata::976]: 11: FF 01 3F FC FF FF FF FF FF 03 00 00 00 00 00 00
[18:24:25][I][Paneldata: :976]: 27: 27 00 80 03 00 C7 00 71 00 00 00 00 00 00 00 00
[18:24:25][D][info:1778]: status 03, last status 03,line2status 00,selection 01,partition=1,skip=0
[18:24:25][D][text_sensor:067]: 'dscalarm line1': Sending state 'Secure System'
[18:24:25][D][text_sensor:067]: 'dscalarm line2': Sending state 'Before Arming <>'
[18:24:25][D][binary_sensor:036]: 'dscalarm Nappali (z5)': Sending state OFF
[18:24:25][D][text_sensor:067]: 'dscalarm zone status ': Sending state 'OK'
[18:24:25][I][Paneldata: :976]: 05: 05 00 81 01 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:24:25][D][info:1778]: status 01, last status 03,line2status 00,selection 01,partition=1,skip=0
[18:24:25][D][text_sensor:067]: 'dscalarm line1': Sending state 'System is Ready'
[18:24:25][D][text_sensor:067]: 'dscalarm line2': Sending state 'Ready to Arm <>'
[18:24:25][D][text_sensor:067]: 'dscalarm Partition 1 Msg ': Sending state '01: Ready'
[18:24:25][D][text_sensor:067]: 'dscalarm Partition 1 Status ': Sending state 'disarmed'
[18:24:26][D][binary_sensor:036]: 'dscalarm Partition 1 Ready': Sending state ON
[18:24:26][I][Paneldata: :976]: 05: 05 00 81 01 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:24:26][D][info:1778]: status 01, last status 01,line2status 00,selection 01,partition=1,skip=0
[18:24:26][D][text_sensor:067]: 'dscalarm line1': Sending state 'System is Ready'
[18:24:26][D][text_sensor:067]: 'dscalarm line2': Sending state 'Ready to Arm <>'
[18:24:26][D][text_sensor:067]: 'dscalarm Partition 1 Status ': Sending state 'disarmed'
[18:24:26][D][text_sensor:067]: 'dscalarm zone status ': Sending state 'OK'
[18:24:28][D][text_sensor:067]: 'dscalarm event': Sending state ''
[18:24:28][I][Paneldata: :976]: 27: 27 00 81 01 00 C7 04 74 00 00 00 00 00 00 00 00
[18:24:28][D][info:1778]: status 01, last status 01,line2status 00,selection 01,partition=1,skip=0
[18:24:28][D][text_sensor:067]: 'dscalarm line1': Sending state 'System is Ready'
[18:24:28][D][text_sensor:067]: 'dscalarm line2': Sending state 'Ready to Arm <>'
[18:24:28][D][binary_sensor:036]: 'dscalarm Konyha (z3)': Sending state ON
[18:24:28][D][text_sensor:067]: 'dscalarm zone status ': Sending state 'OP:3'
[18:24:28][I][Paneldata: :976]: 05: 05 00 80 03 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:24:28][D][info:1778]: status 03, last status 01,line2status 00,selection 01,partition=1,skip=0
[18:24:28][D][text_sensor:067]: 'dscalarm line1': Sending state 'Secure System'
[18:24:28][D][text_sensor:067]: 'dscalarm line2': Sending state 'Before Arming <>'
[18:24:28][D][text_sensor:067]: 'dscalarm Partition 1 Msg ': Sending state '03: Zones open'
[18:24:28][D][text_sensor:067]: 'dscalarm Partition 1 Status ': Sending state 'unavailable'
[18:24:28][D][binary_sensor:036]: 'dscalarm Partition 1 Ready': Sending state OFF
[18:24:29][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:24:29][I][Moduledata::976]: 11: FF 01 3F FC FF FF FF FF FF 03 00 00 00 00 00 00
[18:24:31][I][Paneldata: :976]: 27: 27 00 80 03 00 C7 00 71 00 00 00 00 00 00 00 00
[18:24:31][D][info:1778]: status 03, last status 03,line2status 00,selection 01,partition=1,skip=0
[18:24:31][D][text_sensor:067]: 'dscalarm line1': Sending state 'Secure System'
[18:24:31][D][text_sensor:067]: 'dscalarm line2': Sending state 'Before Arming <>'
[18:24:31][D][binary_sensor:036]: 'dscalarm Konyha (z3)': Sending state OFF
[18:24:31][D][text_sensor:067]: 'dscalarm zone status ': Sending state 'OK'
[18:24:31][I][Paneldata: :976]: 05: 05 00 81 01 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:24:31][D][info:1778]: status 01, last status 03,line2status 00,selection 01,partition=1,skip=0
[18:24:31][D][text_sensor:067]: 'dscalarm line1': Sending state 'System is Ready'
[18:24:31][D][text_sensor:067]: 'dscalarm line2': Sending state 'Ready to Arm <>'
[18:24:31][D][text_sensor:067]: 'dscalarm Partition 1 Msg ': Sending state '01: Ready'
[18:24:31][D][text_sensor:067]: 'dscalarm Partition 1 Status ': Sending state 'disarmed'
[18:24:31][D][binary_sensor:036]: 'dscalarm Partition 1 Ready': Sending state ON
[18:24:33][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:24:33][I][Moduledata::976]: 11: FF 01 3F FC FF FF FF FF FF 03 00 00 00 00 00 00
[18:24:37][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
@olympia Seems like you get everything up and running smoothly. Congratulation.
I believe the ‘unavailable’ status was discussed somewhere, sometime before. As I use the Home Assistant to send status of DSC panel through ‘Signal’ to my phone, I have to filter out the ‘unavailable’ in automation.yaml.
@wkchick yes, thank you again for the PCB design!
Does this mean you also have the ‘unavailable’ messages for zone opening?
On a local forum in my country a user is saying he doesn’t have this and it is also suspicious that I have the below messages in my logs, when actually I wasn’t triggering an arming:
[18:24:25][D][text_sensor:067]: 'dscalarm line1': Sending state 'Secure System'
[18:24:25][D][text_sensor:067]: 'dscalarm line2': Sending state 'Before Arming <>'
…and one more thing worth to mention: I am migrating with the “old” MQTT based keybus interface (the one from taligentx). I am running the two interface is parallel and Partition Status stays disarmed there.
I am really confused now whether if I have an issue either with my keybus interface config of with my alarm config itself or not.
@olympia yes, that is looking normal now. Not sure why you had the weird log before. Esphome caching perhaps?
As to the “unavailable” status, the reason I used that status is because the template alarm panel card (Template Alarm Control Panel - Home Assistant) expects these statuses from the alarm system integration: armed_away
, armed_home
, armed_night
, armed_vacation
, arming
, disarmed
, pending
, triggered
and unavailable
. I can’t use disarmed when zones are open as that status indicates that the system is ready (can be armed) with no zones open. You can change it to “zones open” or “not_ready” instead of “unavailable” if you wish and are not using the template alarm panel in HA. This is done in file dscalarm.h , line 194. You can change all the prompts there:
const char STATUS_PENDING[] PROGMEM = "pending";
const char STATUS_ARM[] PROGMEM = "armed_away";
const char STATUS_STAY[] PROGMEM = "armed_home";
const char STATUS_NIGHT[] PROGMEM = "armed_night";
const char STATUS_OFF[] PROGMEM = "disarmed";
const char STATUS_ONLINE[] PROGMEM = "online";
const char STATUS_OFFLINE[] PROGMEM = "offline";
const char STATUS_TRIGGERED[] PROGMEM = "triggered";
const char STATUS_READY[] PROGMEM = "ready";
const char STATUS_NOT_READY[] PROGMEM = "unavailable"; //ha alarm panel likes to see "unavailable" instead of not_ready when the system can't be armed
@olympia , that message in your logs is what the LCD panel on a North American display shows when zones are open. Please note that the “new” branch was setup to be able to fully emulate that type of LCD. It is completely different to the taligentx version. I rewrote most of the logic to add LCD panel , zone and relay extender emulation capabilities so it will be very different. Unfortunately, I do not have language translations for other countries when it comes to the displayed messages. You can always edit the file dscalarm.h and insert your own messages there instead if you know what they are.
FYI, this is what those line1/line2 messages are for. My custom alarm panel card:
Yes, i also got ‘unavailable’ message from ESPHome when DSC zone opened.
We both went through similar history. I first the MQTT based Keybus interface developed by taligentx on Arduino UNO + Ethernet shield. Then I switched to Dilbert66’s ESPHome implementation as it gives more information and snapier response. First with ESP8266 and then ESP32, both on PCB designed by PipeDeveloper, and is still using in parallel with the Ethernet version. I also have another WT32-ETH01 running taligentx version with Telegram bot. That one doesn’t give ‘unavailable’ status.
@wkchick , are you using the telegram bot version much? I wrote a custom standalone telegram bot managed version for my Vista20 alarm panel library based on taligentx 's web based keypad application. (GitHub - Dilbert66/VirtualKeypad-Vista). I was contemplating also adapting this DSC library to also work with Telegram as a standalone app as well. This would be for those that want to manage their panel without the need to have HA.
@Dilbert66 Not really that much, only give me provision to arm/disarm DSC panel remotely. I don’t use Nuba Casa and have no way to get access to my Home Asssistant server while not at home.
I am not aware of your Vista20 alarm panel library. It would be great if you adapt this DSC library to work with Telegram as a standalone app. Right now my ‘taligentx Telegram + WT32-ETH01’ is run as a standalone app.
Thank you @Dilbert66 for the detailed, full comprehensive explanation and your helpfulness! All clear now. …and thank you very much for the great software!
Thank you for the confirmation and further details for you too @wkchick!
Hi @Dilbert66 , I am new to ESP Home, I am trying to wire ESP8266 with DSC alarm panel.
I already use your upload .yaml files and also add the dsckeybusinterface to the esphome director.
But when i try to run, this is a problem “while parsing a block mapping”, could you help me how to fix this problem.
There is something wrong with your formatting in your yaml. That’s not an issue with my code.
Hello, I have a problem with my Alarm Control Panel in HA. Send this message “Failed to call service alarm_control_panel/alarm_arm_home. Unable to find service esphome.arm_home”
Any have a solution!
Thanks!
I already solved the problem, it was a disconnected cable.
Best!
How its possible to debug “lambda” functions?
ESP_LOGD or stream->prints