I suppose that something's wrong with pin definitions.
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: "dsc"
you can enter a list of user codes mapped to their names for display in armed/disarmed event messages
userCodes: "1:Master"
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"
expanderAddr1: "1" # 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.
id: dsckeybus
lambda: |-
auto DSCkeybus = new DSCkeybushome($dscClockPin,$dscReadPin,$dscWritePin);
DSCkeybus->accessCode="$accessCode";
DSCkeybus->userCodes="$userCodes";
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;
case 2: id(p2).publish_state(statusCode); break;
}
});
DSCkeybus->onPartitionMsgChange([&](std::string msg,uint8_t partition) {
switch(partition) {
case 1: id(m1).publish_state(msg); break;
case 2: id(m2).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;
case 2: //partition 2 armed/ready
switch(ps) {
case rdyStatus: id(rdy_2).publish_state(open);break;
case armStatus: id(arm_2).publish_state(open);break;
default: break;
};break;
DSCkeybus->onLine1Display([&](std::string msg,int partition) {
switch(partition) {
case 1: id(line1).publish_state(msg);break;
case 2: id(line1_2).publish_state(msg);break;
}
});
DSCkeybus->onLine2Display([&](std::string msg,int partition) {
switch(partition) {
case 1: id(line2).publish_state(msg);break;
case 2: id(line2_2).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;
case 2: id(beeps_2).publish_state(beep);break;
}
});
DSCkeybus->onFireStatusChange([&](bool open,int partition) {
switch (partition) {
case 1: id(f1).publish_state(open); break;
case 2: id(f2).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 7: id(z7).publish_state(open); break;
case 8: id(z8).publish_state(open); break;
case 9: id(z9).publish_state(open); break;
case 10: id(z10).publish_state(open); break;
case 11: id(z11).publish_state(open); break;
case 17: id(z17).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;
case 5: id(r5).publish_state(state); break;
case 6: id(r6).publish_state(state); break;
case 7: id(r7).publish_state(state); break;
case 8: id(r8).publish_state(state); break;
}
});
I suppose that something's wrong with pin definitions.
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: "dsc"
you can enter a list of user codes mapped to their names for display in armed/disarmed event messages
userCodes: "1:Master"
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"
expanderAddr1: "1" # 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.
ESP32 Pins
dscClockPin: "22" dscReadPin: "21" dscWritePin: "18"
ESP8266 Pins
dscClockPin: "5"
dscReadPin: "4"
dscWritePin: "15"
maxZones: "32" # maximum amount of zones your system supports
esphome: name: $systemName platform: ESP32 board: wt32-eth01
platform: ESP8266
board: nodemcuv2
includes:
subdirectory path where custom component .h and .cpp files are located
ESP32 only . Calls a public function within the custom component above. In this case syncs the time
to the panel 30 seconds after startup
on_boot: priority: -100 #everything initialized then:
ESP32 only . Syncs the time with the panel every hour
interval:
logger: baud_rate: 115200 level: DEBUG
API communications - ensure the mqtt: section is commented if using this protocol
api: password: !secret api_password
encryption:
ota: password: !secret ota_password safe_mode: True on_begin: then:
MQTT communications - ensure the api: section is commented if using this protocol
mqtt:
broker: xxx.xxx.xxx.xxx #your mqtt broker address
port: 1883
username: mqttuser #your mqtt user name
password: !secret mqtt_password #your mqtt user pass
ethernet: type: LAN8720 mdc_pin: GPIO23 mdio_pin: GPIO18 clk_mode: GPIO0_IN phy_addr: 1 power_pin: GPIO16
status_led: pin: number: GPIO2 inverted: no
comment if using ESP8266 to conserve memory
time:
custom_component:
id: dsckeybus lambda: |- auto DSCkeybus = new DSCkeybushome($dscClockPin,$dscReadPin,$dscWritePin); DSCkeybus->accessCode="$accessCode"; DSCkeybus->userCodes="$userCodes"; 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; case 2: id(p2).publish_state(statusCode); break; } });
DSCkeybus->onPartitionMsgChange([&](std::string msg,uint8_t partition) { switch(partition) { case 1: id(m1).publish_state(msg); break; case 2: id(m2).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; case 2: //partition 2 armed/ready switch(ps) {
case rdyStatus: id(rdy_2).publish_state(open);break; case armStatus: id(arm_2).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; case 2: id(line1_2).publish_state(msg);break;
} });
DSCkeybus->onLine2Display([&](std::string msg,int partition) { switch(partition) {
case 1: id(line2).publish_state(msg);break; case 2: id(line2_2).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; case 2: id(beeps_2).publish_state(beep);break;
} });
DSCkeybus->onFireStatusChange([&](bool open,int partition) { switch (partition) { case 1: id(f1).publish_state(open); break; case 2: id(f2).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 7: id(z7).publish_state(open); break; case 8: id(z8).publish_state(open); break; case 9: id(z9).publish_state(open); break; case 10: id(z10).publish_state(open); break; case 11: id(z11).publish_state(open); break; case 17: id(z17).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; case 5: id(r5).publish_state(state); break; case 6: id(r6).publish_state(state); break; case 7: id(r7).publish_state(state); break; case 8: id(r8).publish_state(state); break; } });
return {DSCkeybus};
binary_sensor:
zone status open/close for each zone
platform: template id: z1 name: "$systemName Living Room Radar" device_class: motion
platform: template id: z2 name: "$systemName Hallway Radar" device_class: motion
platform: template id: z3 name: "$systemName Living Room Windows" device_class: window
platform: template id: z4 name: "$systemName Kitchen Window" device_class: window
platform: template id: z5 name: "$systemName Office Window" device_class: window
platform: template id: z6 name: "$systemName Kids Room Window" device_class: window
platform: template id: z7 name: "$systemName Main Entrance" device_class: door
platform: template id: z8
name: "$systemName Basement windows(z8)"
device_class: window
platform: template id: z9 name: "$systemName Bathroom Window" device_class: window
platform: template id: z10 name: "$systemName Master Bedroom Window" device_class: window
platform: template id: z11 name: "$systemName Outside Radar" device_class: motion
platform: template id: z12 name: "$systemName Siren Tamper" device_class: safety
platform: template id: z17
name: "$systemName Test sensor(z17)"
device_class: motion
platform: template id: rdy name: "$systemName Partition 1 Ready"
platform: template id: arm name: "$systemName Partition 1 Armed"
platform: template id: rdy_2
name: "$systemName Partition 2 Ready"
platform: template id: arm_2
name: "$systemName Partition 2 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
platform: template id: f2 device_class: safety
name: "$systemName Fire partition 2 Status"
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"
platform: template id: r5
name: "$systemName PGM 5"
platform: template id: r6
name: "$systemName PGM 6"
platform: template id: r7
name: "$systemName PGM 7"
platform: template id: r8
name: "$systemName PGM 8"
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"
platform: template id: p2
name: "$systemName Partition 2 Status " # uncomment to show in home assistant.
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: m2
name: "$systemName Partition 2 Msg " # uncomment to show in home assistant
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: line1_2 name: "$systemName line1 partition 2" icon: "mdi:alert-box"
platform: template id: line2_2 name: "$systemName line2 partition 2" 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: beeps_2 name: "$systemName partition 2 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.