Issue with WritePin Isolated Version
PipeDeveloper opened this issue · 42 comments
Hello @Dilbert66
Im having some issues with the new branch using ESP32 and isolated version.
The interaction works like a charm, however using the template card for basic service like a button to arm/disarm they are not working.
I have copied the template directly on my Home Assistant config.yaml but after reboot i have noted that those entities doesnt appears on the list. I have manually set the entities and buttons seems not working (also there is no log messages on the ESPhome console after pressing the button, Arm and Dissarm). I leave you some screenshots
Before the update, those buttons works perfectly, also when you press the button disarm, the keypad beeps, but now nothing happens.
Since the "new" version adds partition support you now need to add "partition" as an additional parameter so the system will know what partition to disarm. Same thing for the "arm" services.
Edit: Now, if you had more than one partition, you can have multiple cards. One for each partition.
These are the registered services and parameters:
Edited:
register_service( & DSCkeybushome::set_panel_time, "set_panel_time", {});
register_service( & DSCkeybushome::alarm_arm_home, "alarm_arm_home");
register_service( & DSCkeybushome::alarm_arm_night, "alarm_arm_night", {
"code"
});
register_service( & DSCkeybushome::alarm_arm_away, "alarm_arm_away");
register_service( & DSCkeybushome::alarm_trigger_panic, "alarm_trigger_panic");
register_service( & DSCkeybushome::alarm_trigger_fire, "alarm_trigger_fire");
register_service( & DSCkeybushome::alarm_keypress, "alarm_keypress", {
"keys"
});
register_service( & DSCkeybushome::set_alarm_state, "set_alarm_state", {
"state",
"code",
"partition"
});
register_service( & DSCkeybushome::alarm_disarm, "alarm_disarm", {
"code"
});
register_service( & DSCkeybushome::alarm_keypress_partition, "alarm_keypress_partition", {
"keys",
"partition"
});
register_service( & DSCkeybushome::set_zone_fault, "set_zone_fault", {
"zone",
"fault"
});
register_service( & DSCkeybushome::set_default_partition, "set_default_partition", {
"partition"
});
Since the "new" version adds partition support you now need to add "partition" as an additional parameter so the system will know what partition to disarm. Same thing for the "arm" services.
I use patition 1 as default (only one partition), however the template to call the register service doesnt appears as an valid entity. Maybe a HA update?
Or maybe some steps to follow for some people without experience using ESPhome.
Nothing Happen. All the same. I have deleted the integration, same as you 56 entities, 1 device.
The entitie "disarm" if i search on all entities on my browser doesnt appear but it is added on the HA config.yaml
Well, I'm not sure what to say. I just deleted and re-added my test system and all works fine. I assume you are using the "dev" branch correct?
No, im using the "new" branch
Whups I was confusing it with the vistaecp project. let me test. I deleted my previous message as it showed the vista ecp panel instead of the DSC alarm panel. Arm_home, arm_away, don't need a partition as those are defaulting to partition 1 so your config is correct. To arm a different partition, you would use the alarm_keypress_partition command.
Can you leave an example of it? i really apreciate. Also update de readme.md if correspond
Well, I pushed a later version. Not much has changed except that I'm adding the option to allow using the esphome mqtt api for those that want to use it. Otherwise it should be the same. Anyhow, give the last "new" branch a try. Otherwise , i'm not sure what the issue you are having is. Your config looks fine as is. You don't need to add the partition parameter as I indicated was for another system.
As to using the alarm_keypress command. The readme already has an example. Here's an excerpt:
"alarm_keypress", Parameter: "keys" where keys can be any sequence of cmds from the list below. For example to arm partition 2 in night mode you set keys to be "/2Nxxxx" where xxxx is your access code. Alternatively you can use the * code for the same function and send /2*9xxxx.
The alternative new way is to use the alarm_keypress_partition which has the extra parameter of partition so you don't need to send the /<p> to set the partition in the keys. For example "keys" would be" Nxxxx" and "partition" would be "2" if you wanted to set Night mode to partition 2.
Are you sure you have the correct write pin set in the configuration of the yaml?
Your circuit board looks great! Interesting issue. I really don't see what else it could be though since the service is recognized by Homeassistant. Is the "defaultPartition" set to 1 also in your yaml?
I'll keep looking but I just can't duplicate the issue you are having.
This is my full yaml
#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: "alarma"
#Only comes into effect if a password prompt occurs when arming eg. night mode
accessCode: "My code" #Edited
#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.
#ESP32 Pins
dscClockPin: "22"
dscReadPin: "21"
dscWritePin: "18"
maxZones: "32" # maximum amount of zones your system supports
esphome:
name: $systemName
platform: ESP32
board: nodemcu-32s
includes:
# subdirectory path where custom component *.h and *.cpp files are located
- dscKeybusInterface/
wifi:
ssid: "" #Edited
password: "" #Edited
ap:
ssid: "$systemName"
password: "bmWBpRMsKr5g"
logger:
baud_rate: 115200
level: DEBUG
##API communications - ensure the mqtt: section is commented if using this protocol
api:
password: My Code #Edited
#encryption:
#key: !secret encryption_key
##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
ota:
password: My Code #Edited
safe_mode: True
on_begin:
then:
- switch.turn_off: connection_status_switch
status_led:
pin:
number: GPIO2
inverted: no
#comment if using ESP8266 to conserve memory
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;
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 12: id(z12).publish_state(open); break;
case 13: id(z13).publish_state(open); break;
case 14: id(z14).publish_state(open); break;
case 15: id(z15).publish_state(open); break;
case 16: id(z16).publish_state(open); break;
case 17: id(z17).publish_state(open); break;
case 18: id(z18).publish_state(open); break;
case 19: id(z19).publish_state(open); break;
case 20: id(z20).publish_state(open); break;
case 21: id(z21).publish_state(open); break;
case 22: id(z22).publish_state(open); break;
case 23: id(z23).publish_state(open); break;
case 24: id(z24).publish_state(open); break;
case 25: id(z25).publish_state(open); break;
case 26: id(z26).publish_state(open); break;
case 27: id(z27).publish_state(open); break;
case 28: id(z28).publish_state(open); break;
case 29: id(z29).publish_state(open); break;
case 30: id(z30).publish_state(open); break;
case 31: id(z31).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};
#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: "z1 Puerta Principal"
device_class: door
- platform: template
id: z2
name: "z2 Puerta Cocina"
device_class: door
- platform: template
id: z3
name: "z3 Cocina 1"
device_class: window
- platform: template
id: z4
name: "z4 Cocina 2"
device_class: window
- platform: template
id: z5
name: "z5 Comedor 1"
device_class: window
- platform: template
id: z6
name: "z6 Comedor 2"
device_class: window
- platform: template
id: z7
name: "z7 Living 1"
device_class: window
- platform: template
id: z8
name: "z8 Caja Sirena"
device_class: lock
- platform: template
id: z9
name: "z9 Living 2"
device_class: window
- platform: template
id: z10
name: "z10 Living 3"
device_class: window
- platform: template
id: z11
name: "z11 Living 4"
device_class: window
- platform: template
id: z12
name: "z12 Sala Star 1"
device_class: window
- platform: template
id: z13
name: "z13 Sala Star 2"
device_class: window
- platform: template
id: z14
name: "z14 Dormitorio Final 1"
device_class: window
- platform: template
id: z15
name: "z15 Dormitorio Final 2"
device_class: window
- platform: template
id: z16
name: "z16 Dormitorio Final 3"
device_class: window
- platform: template
id: z17
name: "z17 Dormitorio Felipe"
device_class: window
- platform: template
id: z18
name: "z18 Dormitorio Andres"
device_class: window
- platform: template
id: z19
name: "z19 Baño Felipe"
device_class: window
- platform: template
id: z20
name: "z20 Baño Pieza Fondo"
device_class: window
- platform: template
id: z21
name: "z21 Pieza Cocina"
device_class: window
- platform: template
id: z22
name: "z22 Baño Cocina"
device_class: window
- platform: template
id: z23
name: "z23 Rayo 1 Living"
device_class: motion
- platform: template
id: z24
name: "z24 Rayo 2 Cocina"
device_class: motion
- platform: template
id: z25
name: "z25 Rayo 3 Sala Star"
device_class: motion
- platform: template
id: z26
name: "z26 Dorm Matrimonial 1"
device_class: window
- platform: template
id: z27
name: "z27 Dorm Matrimonial 2"
device_class: window
- platform: template
id: z28
name: "z28 Dorm Matrimonial 3"
device_class: window
- platform: template
id: z29
name: "z29 Dorm Matrimonial 4"
device_class: window
- platform: template
id: z30
name: "z30 Closet Matrimonial"
device_class: window
- platform: template
id: z31
name: "z31 Baño Matrimonial"
device_class: window
- 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"
#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"
- 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"
# 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"
- 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.
- 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
The only thing that would affect your writes is the dscwritepin and the defaultpartion really. Otherwise, I would have said hardware but in this case, I'm at a loss to the actual reason. I'm using an esp32 for my main dev platform and it's fine here.
I could use the dev branch in stead, but i have read the yaml and there is no line to define write pin.
Im also using ESP32
The dev is older. On that one the config is done in dscalarm.h with defines.
I've added some debug messages to the "new" branch for the write commands to see if they are indeed being processed by the esp. It should help pinpoint the issue.
Well the console doesn't lie
Something related with the circuit diagram then (?).
I detect is some diferences in the resistor values on the new branch (1K and 220ohm) and the main branch (4.7k and 180ohm)
Im using 4.7k on the read pins and 180ohm on the write pin. I dont know if that can affect. But actually read pins works perfect
I used smaller resisters to allow for larger current to drive the leds in order to have a better ouptput pulse. If 4.7k works with your panel for the read lines then stick with that. I went with a smaller resistor since I was not getting a consistent read at all times due to the output pulse being too small in amplitude. Same goes with the write pin. I went smaller to allow a better output. It all depends on the optocoupler chips you are using. Seme have better gain then others so won't require as large a resistor.
Edit: I did use 4.7k for the read lines as 1k was causing excessive loading on the panel bus.
On that im using 4N35 (SMD version) Datasheet
I also leave the schematics if you can detect something weird.
Your schematic looks fine to me. Can you try using the alarm_keypress service and try to arm that way as well. I want to see what the logs say for that one.
I see in the log above that your panel had an open zone so of course it won't arm. Can you bypass the zone and so your panel goes ready and try arming again?
It definitively looks like the command is not being sent to the panel at all since I don't see any responses from the panel or following 05 moduledata command. I've made a small update on the code to test something in the "new" branch. Try it and see what it does
I did some test. The service emulates the remote controller, i compared some log messages from the pannel when i press the controller vs when i press the buttons via HA
[18:15:32][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:15:32][I][Moduledata::976]: 11: FF 01 3F FF FF F3 FF FF FF 03 00 00 00 00 00 00
[18:15:43][D][debug:913]: Setting Alarm state: A to partition 1
[18:15:43][D][debug:929]: Arming away
*Here i press the button on HA, nothing happens*
[18:15:47][I][Paneldata: :976]: E6: E6 00 2C 08 00 00 00 00 1A 00 00 00 00 00 00 00
[18:15:56][D][text_sensor:067]: 'alarma event': Sending state ''
[18:15:57][D][text_sensor:067]: 'alarma Partition 1 Msg ': Sending state '01: Ready'
[18:15:59][D][text_sensor:067]: 'alarma Trouble Msg ': Sending state ''
[18:16:01][D][text_sensor:067]: 'alarma beeps': Sending state '0'
[18:16:02][D][text_sensor:067]: 'alarma zone status ': Sending state 'OK'
[18:16:02][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:16:02][I][Moduledata::976]: 11: FF 01 3F FF FF F3 FF FF FF 03 00 00 00 00 00 00
[18:16:07][D][text_sensor:067]: 'alarma line1': Sending state 'System is Ready'
[18:16:07][I][Moduledata::976]: 05: FF 01 B1 FF FF FF FF FF FF FF 01 00 00 00 00 00
[18:16:07][I][Paneldata: :976]: 64: 64 00 06 6A 00 00 00 00 00 00 00 00 00 00 00 00
*Here i press the remote controller, It started to beep the keypad*
[18:16:07][D][text_sensor:067]: 'alarma beeps': Sending state '3'
[18:16:07][D][info:1778]: status 01, last status 01,line2status 70,selection 01,partition=1,skip=0
[18:16:07][D][text_sensor:067]: 'alarma line1': Sending state 'System is Ready'
[18:16:07][D][text_sensor:067]: 'alarma line2': Sending state 'Ready to Arm <>'
[18:16:07][I][Paneldata: :976]: 5D: 5D 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00
[18:16:07][I][Paneldata: :976]: E6: E6 00 18 01 00 00 00 00 00 FF 00 00 00 00 00 00
[18:16:07][I][Paneldata: :976]: BB: BB 00 00 00 BB 00 00 00 00 00 00 00 00 00 00 00
[18:16:07][I][Paneldata: :976]: E6: E6 00 1A 40 00 00 01 00 00 00 41 00 00 00 00 00
[18:16:07][I][Paneldata: :976]: 75: 75 00 11 86 00 00 00 00 00 00 00 00 00 00 00 00
[18:16:07][I][Paneldata: :976]: CE: CE 00 01 80 00 00 00 4F 00 00 00 00 00 00 00 00
[18:16:07][I][Paneldata: :976]: CE: CE 00 40 FF FF FF FF 0A 00 00 00 00 00 00 00 00
[18:16:08][I][Paneldata: :976]: 05: 05 00 83 08 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:16:08][D][info:1778]: status 08, last status 01,line2status 70,selection 01,partition=1,skip=0
[18:16:08][D][text_sensor:067]: 'alarma line1': Sending state 'Exit delay '
[18:16:08][D][text_sensor:067]: 'alarma line2': Sending state 'in progress '
[18:16:08][D][text_sensor:067]: 'alarma Partition 1 Msg ': Sending state '08: Exit delay'
[18:16:08][D][text_sensor:067]: 'alarma Partition 1 Status ': Sending state 'pending'
[18:16:09][D][text_sensor:067]: 'alarma beeps': Sending state '0'
[18:16:12][D][text_sensor:067]: 'alarma event': Sending state ''
[18:16:13][D][text_sensor:067]: 'alarma Partition 1 Status ': Sending state 'pending'
[18:16:14][D][text_sensor:067]: 'alarma partition 2 beeps': Sending state '0'
[18:16:17][I][Paneldata: :976]: 3E: 3E 00 83 08 00 C7 00 90 00 00 00 00 00 00 00 00
[18:16:18][D][text_sensor:067]: 'alarma line2': Sending state 'in progress '
[18:16:21][I][Paneldata: :976]: 75: 75 00 31 A6 00 00 00 00 00 00 00 00 00 00 00 00
[18:16:24][D][text_sensor:067]: 'alarma System Status': Sending state 'online'
[18:16:25][I][Paneldata: :976]: 75: 75 00 31 A6 00 00 00 00 00 00 00 00 00 00 00 00
[18:16:25][D][info:1778]: status 08, last status 08,line2status 70,selection 01,partition=1,skip=0
[18:16:25][D][text_sensor:067]: 'alarma line1': Sending state 'Exit delay '
[18:16:25][D][text_sensor:067]: 'alarma line2': Sending state 'in progress '
[18:16:25][D][text_sensor:067]: 'alarma Partition 1 Status ': Sending state 'pending'
[18:16:25][D][text_sensor:067]: 'alarma zone status ': Sending state 'OK'
[18:16:26][D][text_sensor:067]: 'alarma event': Sending state ''
[18:16:32][I][Paneldata: :976]: 27: 27 00 82 05 00 C7 00 75 00 00 00 00 00 00 00 00
[18:16:32][D][info:1778]: status 08, last status 08,line2status 70,selection 01,partition=1,skip=0
[18:16:32][D][text_sensor:067]: 'alarma line1': Sending state 'Exit delay '
[18:16:32][D][text_sensor:067]: 'alarma line2': Sending state 'in progress '
[18:16:32][D][binary_sensor:036]: 'alarma Partition 1 Ready': Sending state OFF
[18:16:32][I][Paneldata: :976]: 16: 16 00 0E 42 F2 58 00 00 00 00 00 00 00 00 00 00
[18:16:32][I][Paneldata: :976]: A5: A5 00 22 49 F1 4C BF 00 0C 00 00 00 00 00 00 00
[18:16:32][D][text_sensor:067]: 'alarma event': Sending state '2022.02.15 17:19 P:1 Armed: Special'
[18:16:32][I][Paneldata: :976]: 75: 75 00 00 75 00 00 00 00 00 00 00 00 00 00 00 00
[18:16:32][I][Paneldata: :976]: CE: CE 00 01 FF FF FF 7F 4B 00 00 00 00 00 00 00 00
[18:16:32][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:16:32][I][Moduledata::976]: 11: FF 01 3F FF FF F3 FF FF FF 03 00 00 00 00 00 00
[18:16:33][I][Paneldata: :976]: CE: CE 00 40 FF FF FF FF 0A 00 00 00 00 00 00 00 00
[18:16:33][I][Moduledata::976]: 05: FF 01 FF FF FF FB FF F7 FF FF 01 00 00 00 00 00
[18:16:33][I][Paneldata: :976]: D5: D5 00 AA AA AA AA AA AA AA AA 00 00 00 00 00 00
[18:16:33][I][Moduledata::976]: D5: FF 01 0F FF FF FF FF FF FF FF 00 00 00 00 00 00
[18:16:33][I][Paneldata: :976]: EB: EB 00 01 22 09 F1 4C 00 BF 00 13 00 00 00 00 00
[18:16:33][D][text_sensor:067]: 'alarma event': Sending state '2022.02.15 17:19 P:1 Armed: Special'
[18:16:33][I][Paneldata: :976]: 05: 05 00 82 05 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:16:33][D][info:1778]: status 05, last status 08,line2status 70,selection 01,partition=1,skip=0
[18:16:33][D][text_sensor:067]: 'alarma line1': Sending state 'Armed: '
[18:16:33][D][text_sensor:067]: 'alarma line2': Sending state 'Away '
[18:16:33][D][text_sensor:067]: 'alarma Partition 1 Msg ': Sending state '05: Armed away'
[18:16:33][D][binary_sensor:036]: 'alarma Partition 1 Armed': Sending state ON
[18:16:33][D][text_sensor:067]: 'alarma Partition 1 Status ': Sending state 'armed_away'
[18:16:33][I][Moduledata::976]: 1B: FF 01 FF FF FF FD FF FF FF FF 01 00 00 00 00 00
[18:16:33][I][Paneldata: :976]: E6: E6 00 25 FF FF FF FF FF 00 00 00 00 00 00 00 00
[18:16:33][I][Moduledata::976]: E6: FF 01 FF FF FF FF FF FC 00 00 00 00 00 00 00 00
[18:16:33][I][Paneldata: :976]: A5: A5 00 22 49 F1 4E 9B 00 EA 00 00 00 00 00 00 00
[18:16:33][I][Paneldata: :976]: 05: 05 00 82 05 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:16:33][I][Paneldata: :976]: EB: EB 00 01 22 09 F1 4C 02 9B 00 F1 00 00 00 00 00
[18:16:33][D][text_sensor:067]: 'alarma event': Sending state '2022.02.15 17:19 P:1 Armed: Away'
[18:16:37][D][sntp:075]: Synchronized time: 2022-09-28 17:16:36
[18:16:37][I][Paneldata: :976]: C3: C3 00 08 FF CA 00 00 00 00 00 00 00 00 00 00 00
*All ready, Alarm is armed*
[18:16:39][D][debug:913]: Setting Alarm state: D to partition 1
[18:16:39][D][debug:957]: Disarming ...
*Here i press the Disarm button on HA, nothing happens*
[18:16:47][I][Paneldata: :976]: E6: E6 00 0B 00 F1 00 00 00 00 00 00 00 00 00 00 00
[18:16:51][I][Paneldata: :976]: E6: E6 00 1B 00 00 01 00 00 00 00 00 00 00 00 00 00
[18:16:56][I][Paneldata: :976]: C3: C3 00 00 FF C2 00 00 00 00 00 00 00 00 00 00 00
[18:16:57][D][text_sensor:067]: 'alarma Partition 1 Msg ': Sending state '05: Armed away'
[18:16:59][D][text_sensor:067]: 'alarma Trouble Msg ': Sending state ''
[18:17:01][D][text_sensor:067]: 'alarma beeps': Sending state '0'
[18:17:02][D][text_sensor:067]: 'alarma zone status ': Sending state 'OK'
[18:17:02][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:17:02][I][Moduledata::976]: 11: FF 01 3F FF FF F3 FF FF FF 03 00 00 00 00 00 00
[18:17:03][D][text_sensor:067]: 'alarma event': Sending state ''
[18:17:07][D][text_sensor:067]: 'alarma line1': Sending state 'Armed: '
[18:17:12][D][text_sensor:067]: 'alarma event': Sending state ''
[18:17:13][D][text_sensor:067]: 'alarma Partition 1 Status ': Sending state 'armed_away'
[18:17:14][D][text_sensor:067]: 'alarma partition 2 beeps': Sending state '0'
[18:17:17][I][Paneldata: :976]: A5: A5 00 22 09 F1 50 00 00 11 00 00 00 00 00 00 00
[18:17:17][D][info:1778]: status 05, last status 05,line2status 70,selection 01,partition=1,skip=0
[18:17:17][D][text_sensor:067]: 'alarma line1': Sending state 'Armed: '
[18:17:17][D][text_sensor:067]: 'alarma line2': Sending state 'Away '
[18:17:18][D][text_sensor:067]: 'alarma line2': Sending state 'Away '
[18:17:19][I][Moduledata::976]: 05: FF 01 46 FF FF FF FF FF FF FF 01 00 00 00 00 00
[18:17:20][I][Paneldata: :976]: 64: 64 00 06 6A 00 00 00 00 00 00 00 00 00 00 00 00
[18:17:20][D][text_sensor:067]: 'alarma beeps': Sending state '3'
[18:17:20][D][info:1778]: status 05, last status 05,line2status 70,selection 01,partition=1,skip=0
[18:17:20][D][text_sensor:067]: 'alarma line1': Sending state 'Armed: '
[18:17:20][D][text_sensor:067]: 'alarma line2': Sending state 'Away '
*Here i press remote controller to disarm, it makes sounds the siren once and the keypad twice disarming the alarm*
[18:17:20][I][Paneldata: :976]: 5D: 5D 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00
[18:17:21][I][Paneldata: :976]: E6: E6 00 18 01 00 00 00 00 00 FF 00 00 00 00 00 00
[18:17:21][I][Paneldata: :976]: BB: BB 00 00 00 BB 00 00 00 00 00 00 00 00 00 00 00
[18:17:21][I][Paneldata: :976]: A5: A5 00 22 49 F1 52 93 00 E6 00 00 00 00 00 00 00
[18:17:21][I][Paneldata: :976]: E6: E6 00 1A 40 00 00 01 00 00 00 41 00 00 00 00 00
[18:17:21][I][Paneldata: :976]: 75: 75 00 00 75 00 00 00 00 00 00 00 00 00 00 00 00
[18:17:21][I][Paneldata: :976]: CE: CE 00 01 80 00 00 00 4F 00 00 00 00 00 00 00 00
[18:17:21][I][Paneldata: :976]: CE: CE 00 40 FF FF FF FF 0A 00 00 00 00 00 00 00 00
[18:17:21][I][Paneldata: :976]: EB: EB 00 01 22 09 F1 50 02 93 00 ED 00 00 00 00 00
[18:17:21][D][text_sensor:067]: 'alarma event': Sending state '2022.02.15 17:20 P:1 Disarmed: Keyswitch'
[18:17:21][I][Paneldata: :976]: 05: 05 00 81 3E 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:17:21][D][info:1778]: status 3E, last status 05,line2status 70,selection 01,partition=1,skip=0
[18:17:21][D][text_sensor:067]: 'alarma line1': Sending state 'Disarmed '
[18:17:21][D][text_sensor:067]: 'alarma line2': Sending state ' '
[18:17:21][D][text_sensor:067]: 'alarma Partition 1 Msg ': Sending state '3E: Disarmed'
[18:17:21][D][text_sensor:067]: 'alarma Partition 1 Status ': Sending state 'disarmed'
[18:17:21][D][binary_sensor:036]: 'alarma Partition 1 Armed': Sending state OFF
[18:17:21][D][text_sensor:067]: 'alarma Partition 1 Status ': Sending state 'disarmed'
[18:17:21][D][binary_sensor:036]: 'alarma Partition 1 Ready': Sending state ON
[18:17:21][I][Paneldata: :976]: A5: A5 00 22 49 F1 50 E6 00 37 00 00 00 00 00 00 00
[18:17:22][I][Paneldata: :976]: EB: EB 00 01 22 09 F1 50 00 E6 00 3E 00 00 00 00 00
[18:17:22][D][text_sensor:067]: 'alarma event': Sending state '2022.02.15 17:20 P:1 Disarmed: Special'
[18:17:22][D][text_sensor:067]: 'alarma beeps': Sending state '0'
[18:17:24][D][text_sensor:067]: 'alarma System Status': Sending state 'online'
[18:17:24][I][Paneldata: :976]: 05: 05 00 81 01 00 C7 00 C7 00 C7 01 00 00 00 00 00
[18:17:24][D][info:1778]: status 01, last status 3E,line2status 70,selection 01,partition=1,skip=0
[18:17:24][D][text_sensor:067]: 'alarma line1': Sending state 'System is Ready'
[18:17:24][D][text_sensor:067]: 'alarma line2': Sending state 'Ready to Arm <>'
[18:17:24][D][text_sensor:067]: 'alarma Partition 1 Msg ': Sending state '01: Ready'
[18:17:25][I][Paneldata: :976]: C3: C3 00 08 FF CA 00 00 00 00 00 00 00 00 00 00 00
[18:17:25][I][Paneldata: :976]: C3: C3 00 08 FF CA 00 00 00 00 00 00 00 00 00 00 00
[18:17:25][D][info:1778]: status 01, last status 01,line2status 70,selection 01,partition=1,skip=0
[18:17:25][D][text_sensor:067]: 'alarma line1': Sending state 'System is Ready'
[18:17:25][D][text_sensor:067]: 'alarma line2': Sending state 'Ready to Arm <>'
[18:17:25][D][text_sensor:067]: 'alarma Partition 1 Status ': Sending state 'disarmed'
[18:17:25][D][text_sensor:067]: 'alarma zone status ': Sending state 'OK'
[18:17:32][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:17:32][I][Moduledata::976]: 11: FF 01 3F FF FF F3 FF FF FF 03 00 00 00 00 00 00
[18:17:39][I][Paneldata: :976]: E6: E6 00 1B 00 00 01 00 00 00 00 00 00 00 00 00 00
[18:17:44][I][Paneldata: :976]: C3: C3 00 00 FF C2 00 00 00 00 00 00 00 00 00 00 00
[18:17:47][I][Paneldata: :976]: E6: E6 00 2C 10 00 00 00 00 22 00 00 00 00 00 00 00
[18:17:52][D][text_sensor:067]: 'alarma event': Sending state ''
[18:17:57][D][text_sensor:067]: 'alarma Partition 1 Msg ': Sending state '01: Ready'
[18:17:59][D][text_sensor:067]: 'alarma Trouble Msg ': Sending state ''
[18:18:01][D][text_sensor:067]: 'alarma beeps': Sending state '0'
[18:18:02][D][text_sensor:067]: 'alarma zone status ': Sending state 'OK'
[18:18:02][I][Paneldata: :976]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00
[18:18:02][I][Moduledata::976]: 11: FF 01 3F FF FF F3 FF FF FF 03 00 00 00 00 00 00
Does your board work with the older code from the "master" branch? Everything points to a hardware issue with the writeline.
My last board works "fine" with the ESP8266, there was too much data on the bus that it cannot handle for 31 zones and thats why i move with the ESP32. That issue was solved but the it cames this.
Something that i noted is that the ESP32 module, on pin 18 it doesnt send any signal.
I measured with a multimeter pin18 and GND, doing 0v all time. I sent some commands if i can see some voltage value (meaning data) but 0v on the screen all time.
Edit: Also tried with a Led (external) no data on D18.
I tried with the same led on D21 and D22 And it blinks fine (meaning data trafic)
The fact that d18 is not showing activity would be related to a coding issue or a bad pin. I can't see it being the code since I use the same module you have for testing and it works fine. I did have a module that had a bad pin before, so used a different write pin.
To eliminate a code issue, try an old version , or the master branch. For hardware try a different pin for the dscwrite. Since your board is hardwired, you will need to use a jumper though to do that.
Done, D18 working, it sends data as expected.
Actually with the alarm_keypress service i see data trafic on D18. But still with the issue, pannel not responding...
Edit: i never tried master branch with ESP32
The config for ESPhome doesnt define write pin for ESP32
Edit. Logic is correct
The logic is correct. It needs to be driven low to send a pulse. Try using a 180ohm resistor instead of 220. It's possible the line is not being driven low enough.
Ok, fortunally i have that value, tried with 1K and 220ohm.
Last i can do is to use a jumper (0ohm) but i dont know if i could burn the octocoupler if i attach it directly to the pin.
Use a another 220 in parallel to the existing 220. It will give you an equivalent resistance of 110 ohm. Smaller value, means large pulse. You don't want to use too small a value as you will draw too much current from the ESP pin. That's the real concern. I chose 180 as it's as close as I could get to maximum output with some leeway from the ESP.
If you want to see what the data looks like on a logic analyzer see this post. D0 is the clock (yellow) and D1 is the data line (green):
#39
I found the optocoupler circuit version more problematic than the simple design due to the fact that to get max output gain from the optocoupler you need a high gain optocoupler because we are limited by the currrent drive limits of the esp. I could have made it better by putting another transistor stage in front of the optocouple r to boost the current but that complicates the circuit.
Also on the panel side, you have to use a high resistance to drive the led due to the fact that using too low a value, loads the data lines and impacts communications. I settled on 1kohm, so that it would not load up too much but still drive the led enough to give a good pulse on the receiver side. It's a compromise and 1kohm still loads the lines a bit.
Believe it or not, the simple circuit with passive high value resistors and a transistor has the least impact on the data lines but it provides no protection to the esp or panel in case of any voltage spikes so it's all a compromise.
Totally agree, by the way to protect the ESP actually we should include a transistor between data (base), and maybe 5v (collector) directly from the external power supply.
Maybe for this kind of profesional boards we could develop something that we can warranty the security and the circuit protection. But for most of people the simplified version also works fine, the "complicated" version lets leave it just for enthusiast.
Again, thank you very much and glad to keep contributing to this project.
I went back and looked at the esp32 specs again for max current and the esp32 pins can handle 40ma instead of the approx 12ma for the esp8266. When I designed that circuit I was using the esp8266 limits. When using an esp32 you can safely use a 100ohm resistor instead of the 180 for better signal output and still be well within the esp32 max current capability.
Thats a very important point and good to know.
Maybe for some people could be a little confusing wich resistor should use depending on wich ESP they choose to build it. Obviusly ESP32 is highly recomended. But in summary... on the WritePin
for ESP32 use 100ohm
for ESP8266 use 180ohm
For isolated version, On the case of ESP side, pull up resistor could be any value between 1k and 10k, it doesnt matter at all but just in case (experience with arduino). On the DSC green and yellow i dont know if that applies at all, at least 4,7k works fine.
I will update the schematic soon to reflect the resistor choices depending on the platform. Actually for the esp32, you could even go down as low as 80ohm for the write led side. I used 4.7k just to be consistent for the pullups.. You are correct, it can be any value from 1 to 10k. On the panel side though, the value was important as far as the led drive, I found 4.7k was the max I could go to have good output pulse but keep bus loading to minimal.