Dilbert66 / esphome-dsckeybus

Esphome custom configuration for interfacing to a DSC POWERSERIES alarm system
181 stars 31 forks source link

New Version Testing #26

Open slipx06 opened 3 years ago

slipx06 commented 3 years ago

Hi

Firstly new updates look great. I'm busy testing the "new" dev version and noticed that when my alarm is armed in stay mode the "partition status" shows as unavailable. It correctly shows as pending but as soon as the panel is armed, partition status shows as unavailable. The new alarm card shows the correct status

image

I see that you also removed the partition msg sensor?

Dilbert66 commented 2 years ago

Sorry, your logs don't show anything useful I would need to see the serial output logs as those are the ones that show the boot causes and error

Edit: tested with last commit and no issues here. Can you identify the last commit that works ok ?

w1tw0lf commented 2 years ago

here is logs:

[23:00:57][D][text_sensor:067]: 'alarm zone status ': Sending state 'OK' [23:00:57][D][binary_sensor:036]: 'alarm Battery Status': Sending state ON [23:00:57][D][text_sensor:067]: 'alarm Trouble Msg ': Sending state 'BAT' [23:00:57][D][text_sensor:067]: 'alarm event': Sending state '' INFO 192.168.31.113: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer INFO Disconnected from ESPHome API for 192.168.31.113 WARNING Disconnected from API INFO 192.168.31.113: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer INFO Successfully connected to 192.168.31.113 [23:01:12][D][api:102]: Accepted ::FFFF:C0A8:1F02 [23:01:12][D][api.connection:827]: Home Assistant 2022.5.5 (::FFFF:C0A8:1F02): Connected successfully [23:01:20][D][text_sensor:067]: 'alarm beeps': Sending state '0' [23:01:20][I][Paneldata: :874]: 2D: 2D 00 9A 16 10 C7 00 B4 00 00 00 00 00 00 00 00 [23:01:21][I][Moduledata::874]: 05: FF 01 28 FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 5D: 5D 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: E6: E6 00 18 01 00 00 00 00 00 FF 00 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 0A: 0A 00 80 B8 00 00 00 00 00 42 00 00 00 00 00 00 [23:01:21][I][Moduledata::874]: 0A: FF 01 0A FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 0A: 0A 00 80 A1 01 00 00 00 00 2C 00 00 00 00 00 00 [23:01:21][I][Moduledata::874]: 0A: FF 01 05 FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 5D: 5D 00 10 00 00 00 00 6D 00 00 00 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: E6: E6 00 18 01 10 00 00 00 00 0F 00 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 64: 64 00 04 68 00 00 00 00 00 00 00 00 00 00 00 00 [23:01:21][D][text_sensor:067]: 'alarm beeps': Sending state '2' [23:01:21][D][info:1639]: status 16, last status 16,line2status 00,selection A5,partition=1,skip=0 [23:01:21][D][text_sensor:067]: 'alarm line1': Sending state 'Armed: Away ' [23:01:21][D][text_sensor:067]: 'alarm line2': Sending state 'No entry delay ' [23:01:21][I][Paneldata: :874]: 0A: 0A 00 80 C8 01 00 00 00 00 53 00 00 00 00 00 00 [23:01:21][I][Moduledata::874]: 0A: FF 01 2D FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 0A: 0A 00 80 A1 01 00 00 00 00 2C 00 00 00 00 00 00 [23:01:21][I][Moduledata::874]: 0A: FF 01 1C FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 5D: 5D 00 10 00 00 00 00 6D 00 00 00 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: E6: E6 00 18 01 10 00 00 00 00 0F 00 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 64: 64 00 02 66 00 00 00 00 00 00 00 00 00 00 00 00 [23:01:21][D][text_sensor:067]: 'alarm beeps': Sending state '1' [23:01:21][D][info:1639]: status 16, last status 16,line2status 00,selection A5,partition=1,skip=0 [23:01:21][D][text_sensor:067]: 'alarm line1': Sending state 'Armed: Away ' [23:01:21][D][text_sensor:067]: 'alarm line2': Sending state 'No entry delay ' [23:01:21][D][binary_sensor:036]: 'alarm Battery Status': Sending state ON [23:01:21][D][text_sensor:067]: 'alarm Trouble Msg ': Sending state 'BAT' [23:01:21][I][Moduledata::874]: 0A: FF 01 2D FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 0A: 0A 00 80 BA 00 00 00 00 00 44 00 00 00 00 00 00 [23:01:21][I][Paneldata: :874]: 0A: 0A 00 80 A1 01 00 00 00 00 2C 00 00 00 00 00 00 [23:01:21][I][Moduledata::874]: 0A: FF 01 2D FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:01:22][I][Paneldata: :874]: 5D: 5D 00 10 00 00 00 00 6D 00 00 00 00 00 00 00 00 [23:01:22][I][Paneldata: :874]: E6: E6 00 18 01 10 00 00 00 00 0F 00 00 00 00 00 00 [23:01:22][I][Paneldata: :874]: 5D: 5D 00 02 00 00 00 00 5F 00 00 00 00 00 00 00 00 [23:01:22][I][Paneldata: :874]: E6: E6 00 18 01 02 00 00 00 00 01 00 00 00 00 00 00 [23:01:23][D][text_sensor:067]: 'alarm beeps': Sending state '0' INFO 192.168.31.113: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer INFO Disconnected from ESPHome API for 192.168.31.113 WARNING Disconnected from API INFO 192.168.31.113: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer INFO Successfully connected to 192.168.31.113 [23:01:35][I][Paneldata: :874]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00 [23:01:35][I][Moduledata::874]: 11: FF 01 FF FC FF F3 FF FF FF 03 00 00 00 00 00 00 [23:01:40][D][api:102]: Accepted ::FFFF:C0A8:1F02 [23:01:40][D][api.connection:827]: Home Assistant 2022.5.5 (::FFFF:C0A8:1F02): Connected successfully INFO 192.168.31.113: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer INFO Disconnected from ESPHome API for 192.168.31.113 WARNING Disconnected from API INFO 192.168.31.113: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer INFO Successfully connected to 192.168.31.113 [23:02:05][D][text_sensor:067]: 'alarm beeps': Sending state '0' [23:02:05][I][Paneldata: :874]: 11: 11 00 AA AA AA AA AA AA AA 02 00 00 00 00 00 00 [23:02:05][I][Moduledata::874]: 11: FF 01 FF FC FF F3 FF FF FF 03 00 00 00 00 00 00 [23:02:05][I][Moduledata::874]: 05: FF 01 28 FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:02:05][I][Paneldata: :874]: 5D: 5D 00 00 00 00 00 00 5D 00 00 00 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: E6: E6 00 18 01 00 00 00 00 00 FF 00 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 0A: 0A 00 80 B8 00 00 00 00 00 42 00 00 00 00 00 00 [23:02:06][I][Moduledata::874]: 0A: FF 01 0A FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 0A: 0A 00 80 A1 01 00 00 00 00 2C 00 00 00 00 00 00 [23:02:06][I][Moduledata::874]: 0A: FF 01 05 FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 5D: 5D 00 10 00 00 00 00 6D 00 00 00 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: E6: E6 00 18 01 10 00 00 00 00 0F 00 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 64: 64 00 04 68 00 00 00 00 00 00 00 00 00 00 00 00 [23:02:06][D][text_sensor:067]: 'alarm beeps': Sending state '2' [23:02:06][D][info:1639]: status 16, last status 16,line2status 00,selection A5,partition=1,skip=0 [23:02:06][D][text_sensor:067]: 'alarm line1': Sending state 'Armed: Away ' [23:02:06][D][text_sensor:067]: 'alarm line2': Sending state 'No entry delay ' [23:02:06][I][Paneldata: :874]: 0A: 0A 00 80 C8 01 00 00 00 00 53 00 00 00 00 00 00 [23:02:06][I][Moduledata::874]: 0A: FF 01 2D FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 0A: 0A 00 80 A1 01 00 00 00 00 2C 00 00 00 00 00 00 [23:02:06][I][Moduledata::874]: 0A: FF 01 1C FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 5D: 5D 00 10 00 00 00 00 6D 00 00 00 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: E6: E6 00 18 01 10 00 00 00 00 0F 00 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 64: 64 00 02 66 00 00 00 00 00 00 00 00 00 00 00 00 [23:02:06][D][text_sensor:067]: 'alarm beeps': Sending state '1' [23:02:06][D][info:1639]: status 16, last status 16,line2status 00,selection A5,partition=1,skip=0 [23:02:06][D][text_sensor:067]: 'alarm line1': Sending state 'Armed: Away ' [23:02:06][D][text_sensor:067]: 'alarm line2': Sending state 'No entry delay ' [23:02:06][D][binary_sensor:036]: 'alarm Battery Status': Sending state ON [23:02:06][D][text_sensor:067]: 'alarm Trouble Msg ': Sending state 'BAT' [23:02:06][I][Moduledata::874]: 0A: FF 01 2D FF FF FF FF FF FF FF 01 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 0A: 0A 00 80 BA 00 00 00 00 00 44 00 00 00 00 00 00 [23:02:06][I][Paneldata: :874]: 0A: 0A 00 80 A1 01 00 00 00 00 2C 00 00 00 00 00 00 [23:02:06][I][Moduledata::874]: 0A: FF 01 2D FF FF FF FF FF FF FF 01 00 00 00 00 00

I believe I was on this one, https://github.com/Dilbert66/esphome-dsckeybus/commit/4fd24b599291896b5a9c0c06585fc966e0931c52 before doing a clean install this morning, by only replacing the files in dscKeybusInterface folder

Dilbert66 commented 2 years ago

Can you try the following commit and see if that was the issue? https://github.com/Dilbert66/esphome-dsckeybus/commit/252bc7a027d267228d78f905e7b6eadcc6584285

w1tw0lf commented 2 years ago

Issue still there. Will check in the morning, will report if I find anything.

Dilbert66 commented 2 years ago

Thanks, that helps pinpoint the change that is causing the issue.

Dilbert66 commented 2 years ago

Just to confirm, you have the time section in the yaml ?

w1tw0lf commented 2 years ago

Yup, do have it and it did work correctly. Noticed now that the time/date is incorrect on the keypad.

Edit:

Gone back to the lates commit and now the time is syncing on the keypad, but it is 2 hours out. It is currently 8:46am here and the pad is showing 6:46am.

[08:46:29][C][sntp:050]: SNTP Time: [08:46:29][C][sntp:051]: Server 1: '0.pool.ntp.org' [08:46:29][C][sntp:052]: Server 2: '1.pool.ntp.org' [08:46:29][C][sntp:053]: Server 3: '2.pool.ntp.org'

Edit 2:

Not sure how or what, but the time in the pad is now correct. Also the system hasn't restarted in over and hour. Keeping an eye on it to see if it works correctly now.

Dilbert66 commented 2 years ago

Interesting. Ok, Might be an issue with the esphome time functionality. This is something new Im playing with so there could be hidden gotchas. My code depends on the ESPHOME time functionality and it has to update itself from the time servers so any issue there or delays will show up as incorrect time.

w1tw0lf commented 2 years ago

So far so good, had no issues since this morning.

Just wonder if the battery that is dead, is causing issues. Have ordered a replacement.

Jason-nz commented 2 years ago

Have been using this branch for a few weeks with all the lastest changes and everything is working as expected 👍 Only thing I've noticed (not sure if it was like this previously) but my alarm needs a new battery and HA regularly but only briefly jumps back to "not detected"

Screenshot_20220601-090636_Home Assistant

Regular battery fault updates are probably not important but couldn't work out the correct way to change the update interval for a binary temple sensor in Esphome

Dilbert66 commented 2 years ago

Looks like a bug. It should not be doing that. I'll fix it.

Jason-nz commented 2 years ago

Thanks! Here some logs if they're useful logs_DscAlarm_logs.txt

Dilbert66 commented 2 years ago

Ok, issue fixed. I've pushed a new version to branch new.

Also note that I'm in the process of adding new functionality to the dscalarm.h library. so you will see a lot of new changes in it. I'm working on making it to be more universal as far as it being able to be used outside of HomeAssistant. For this I'm adding the ability to work with MQTT for communications as an alternative to the ESPHOME API . This means that if someone wants to use this library with homebridge or openhab, they can use the MQTT protocol using the same ESPHOME yaml (with minor changes). I'm also adding a version with native Arduino support for those that don't want to use ESPHOME at all. I'll be adding sample yaml/ino configurations in the future.

Jason-nz commented 2 years ago

Good so far, thanks!

Screenshot_20220601-124240_Home Assistant

iggut commented 2 years ago

EDIT: Wires (green and yellow) were mixed up when connecting to panel in the dark. Apologies if I am asking in the wrong place. Please help. I was trying to setup the dsc integration with esphome inside a fresh Home Assistant install (pi4). Nodemcu esp8266 was used and diagram was followed to create a box that was installed in the alarm box. I think I am doing something wrong and hope someone here will be able to help.

What HA sees: dsc DscAlarm.yaml file contents used to flash NodeMCU esp8266: DscAlarm.yaml.docx logs: logs_DscAlarm_upload (1).txt

Dilbert66 commented 2 years ago

iggut, two things. First change the log level to DEBUG instead of VERBOSE. There is way too much uneeded info in the logs. Second thing, I think you either have a problem with your interface or you are connecting to a non supported alarm panel as there is no valid data captured.

iggut commented 2 years ago

iggut, two things. First change the log level to DEBUG instead of VERBOSE. There is way too much uneeded info in the logs. Second thing, I think you either have a problem with your interface or you are connecting to a non supported alarm panel as there is no valid data captured.

You are correct. I was too tired yesterday. My green and yellow wires were swapped!! :D Thank you for the amazing project. Everything is working. Just wondering about the compilation warnings below. Everything seems to work, but my brain can't let it go (ocd) without knowing why.

HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf Dependency Graph |-- 1.0 |-- 1.2 Compiling /data/dscalarm/.pioenvs/dscalarm/src/dscExpander.cpp.o Compiling /data/dscalarm/.pioenvs/dscalarm/src/dscKeybusInterface.cpp.o Compiling /data/dscalarm/.pioenvs/dscalarm/src/dscKeybusPrintData.cpp.o Compiling /data/dscalarm/.pioenvs/dscalarm/src/dscKeybusProcessData.cpp.o src/dscKeybusInterface.cpp: In static member function 'static void dscKeybusInterface::dscClockInterrupt()': src/dscKeybusInterface.cpp:593:69: warning: 'static bool dscKeybusInterface::redundantPanelData(byte, volatile byte, byte)' is deprecated: Use IRAM_ATTR in place of ICACHE_RAM_ATTR to move functions into IRAM [-Wdeprecated-declarations] 593 | if (redundantPanelData(pcmd, isrPanelData, isrPanelByteCount)) { | ^ src/dscKeybusInterface.cpp:502:1: note: declared here 502 | dscKeybusInterface::redundantPanelData(byte previousCmd[] , volatile byte currentCmd[], byte checkedBytes) { | ^~~~~~ src/dscKeybusInterface.cpp: In static member function 'static void dscKeybusInterface::processPendingResponses(byte)': src/dscKeybusInterface.cpp:823:62: warning: 'static void dscKeybusInterface::updateWriteBuffer(byte, int, byte, int, bool, bool)' is deprecated: Use IRAM_ATTR in place of ICACHE_RAM_ATTR to move functions into IRAM [-Wdeprecated-declarations] 823 | updateWriteBuffer((byte ) moduleSlots, 9,1,maxFields11 ); | ^ src/dscKeybusInterface.cpp:792:1: note: declared here 792 | dscKeybusInterface::dscKeybusInterface::updateWriteBuffer(byte src, int bit,byte partition,int len, bool alarm, bool star) { | ^~~~~~ src/dscKeybusInterface.cpp:844:53: warning: 'static void dscKeybusInterface::updateWriteBuffer(byte, int, byte, int, bool, bool)' is deprecated: Use IRAM_ATTR in place of ICACHE_RAM_ATTR to move functions into IRAM [-Wdeprecated-declarations] 844 | updateWriteBuffer((byte ) cmdD0buffer,9,1,6); | ^ src/dscKeybusInterface.cpp:792:1: note: declared here 792 | dscKeybusInterface::dscKeybusInterface::updateWriteBuffer(byte src, int bit,byte partition,int len, bool alarm, bool star) { | ^~~~~~ src/dscKeybusInterface.cpp: In static member function 'static void dscKeybusInterface::processPendingQueue(byte)': src/dscKeybusInterface.cpp:863:189: warning: 'static void dscKeybusInterface::updateWriteBuffer(byte, int, byte, int, bool, bool)' is deprecated: Use IRAM_ATTR in place of ICACHE_RAM_ATTR to move functions into IRAM [-Wdeprecated-declarations] 863 | updateWriteBuffer((byte ) writeQueue[outIdx].data, writeQueue[outIdx].writeBit,writeQueue[outIdx].partition,writeQueue[outIdx].len, writeQueue[outIdx].alarm, writeQueue[outIdx].star); //populate write buffer and set ready to send flag | ^ src/dscKeybusInterface.cpp:792:1: note: declared here 792 | dscKeybusInterface::dscKeybusInterface::updateWriteBuffer(byte * src, int bit,byte partition,int len, bool alarm, bool star) { | ^~~~~~ Compiling /data/dscalarm/.pioenvs/dscalarm/src/esphome/components/api/api_connection.cpp.o

Dilbert66 commented 2 years ago

Those warnings are normal. I have not used the updated IRAM_ATTR attribute because it will not compile in older versions of esphome(platform io compiler) that some people are still using. I will update at some point in the future and advise users to upgrade.

abishur commented 1 year ago

Hi

Firstly new updates look great. I'm busy testing the "new" dev version and noticed that when my alarm is armed in stay mode the "partition status" shows as unavailable. It correctly shows as pending but as soon as the panel is armed, partition status shows as unavailable. The new alarm card shows the correct status

image

I see that you also removed the partition msg sensor?

I hate to ask such a basic question like this, but I'm new to HA and am using the new branch. How did you edit the look of the alarm panel?

slipx06 commented 1 year ago

I'm using the midnight theme https://community.home-assistant.io/t/midnight-theme/28598

slipx06 commented 1 year ago

@Dilbert66 have you removed cmdWaitTime from the latest dev version?

Dilbert66 commented 1 year ago

On by default. No need for the waittime. The code just skips the first packet on transition so that usually eliminates any invalid ones.

elsurfero commented 1 year ago

@Dilbert66 i having problems instaling the new alarm panel. when i try to add the card on dashboard i get this message "You need to define a kpd_line1". Any help? photo_2023-03-08_22-04-55

Dilbert66 commented 1 year ago

The browser is caching the old resource. To force a refresh and load the resource add ?id=1 after the resource url path. (where 1 will increase when you add new versions) eg: /local/alarm-keypad-card.js?id=1

elsurfero commented 1 year ago

Sorry mate, i keep geting same error.

photo_2023-03-09_11-23-14

Dilbert66 commented 1 year ago

You might also need to refresh your ha by doing an F5 on the dashboard page to reload the new javascript code.

JTG7600 commented 1 year ago

Hi there, first off, great work, love what you have done! Unfortunatley, I does not seem to work for me, I am getting the same issue as @elsurfero . Tried a few things already, including refresh (browser cache and adding ?id=1 as suggested above) and keep getting "You need to define a kpd_line1". Any ideas what else I can try? Cheers, and keep up the good work!

Dilbert66 commented 1 year ago

Unfortunately what I suggested should work. It's not an issue with my code but with the HA dashboard not refreshing the javascript code in the browser. You can try giving the file a new name and try that. Make sure you remove the old file.
You can always try clearing your browser cache as well. For more solutions you can try asking on the HA forums about refreshing resources. The error you are getting is from a previous version of the card javascript code which is why I know it's not loading the new version. Edit: I just did a quick test. I changed the code, then in "resources", changed id=1 to id=2 and updated. Then went back to the dashboard and hit f5 to refresh. The new code was loaded. So if that doesnt work, I really do not have any other solutions to offer except that you can ask on the HA forum.

I hope you folks are adding the id=xx in the "resource" section correct? Not in the dashboard config. image image

JTG7600 commented 1 year ago

Hey, appreciate the quick reply! Will give it anther go tomrrow! Thanks again!

elsurfero commented 1 year ago

Sorry mate for the inconvenience, I was using the old version. Everything works fine now, thanks for everything, great job!

PS: hey @JTG7600, you need to change all the files to the new version

photo_2023-03-11_23-47-57