davesmeghead / visonic

Visonic Custom Component for integration with Home Assistant
Apache License 2.0
89 stars 20 forks source link

Update to 0.9.6.14 downgrade previous/existing functionalities #131

Closed Joao-Sousa-71 closed 4 weeks ago

Joao-Sousa-71 commented 1 month ago

Dave,

I've been using this incredible integration since early times and this latest version destroy all the customization that I've built is the lastest years that allow me to indentfiy users (who made a certain actions) / devices (if was a fob, or code used) and many other usefull information that was exposed before, and it is not available anymore, with the version 0.8.5.2. This is what my PowerMax Pro was exposing:

code_format: null
changed_by: None
code_arm_required: false
Panel Mode: Powerlink
Protocol Version: 1.0.20.1
Watchdog Timeout (Total): 0
Watchdog Timeout (Past 24 Hours): 0
Download Timeout: 0
Download Retries: 0
Panel Problem Count: 0
Panel Problem Time: ""
Panel Last Event: None
Panel Last Event Data:
  Zone: 0
  Entity: null
  Tamper: false
  Siren: false
  Reset: false
  Time: "2020-01-01T00:00:00.0"
  Count: 0
  Type: []
  Event: []
  Mode: []
  Name: []
Panel Alarm Status: None
Panel Trouble Status: None
Panel Siren Active: false
Panel Status: Disarmed
Panel Status Code: Disarmed
Panel Ready: "Yes"
Panel Alert In Memory: "No"
Panel Trouble: "No"
Panel Bypass: "No"
Panel Status Changed: "No"
Panel Alarm Event: "No"
Panel Armed: "No"
Power Master: "No"
Panel Model: PowerMax Pro Part
Panel Type: 4
Model Type: 87
Panel Name: Unknown
EPROM Change Time I Think: Not Set
Jamming Detection: Disable
Entry Delay 1: 30 Seconds
Entry Delay 2: 15 Seconds
Exit Delay: 30 Seconds
Bell Time: 4 Minutes
Piezo Beeps: Off when Home
Swinger Stop: After 2 Times
Aux Key 1: System Status
Aux Key 2: PGM/X-10
Supevision Interval: 12 Hours
No Activity Time: Disable
Alarm Cancel Time: Inactive
Abort Time: 15 Seconds
Confirm Alarm Timer: 60 Minutes
Screen Saver: Reset By Key
Reset Option: User Reset
Duress: "2580"
AC Failure Report: 5 Minutes
User Permit: Disable
Zone Restore: Report Restore
Tamper Option: "Off"
PGM By Line Fail: "No"
Auto Arm Option: Disable
Send 2wv Code: Send
Memory Prompt: Enable
Time Format: Europe - 24H
Date Format: Europe DD/MM/YYYY
Low Battery Acknowledge: "On"
Not Ready: Normal
X10 Flash On Alarm: No Flash
Disarm Option: Any Time
Siren On Line: Disable on Fail
Upload Option: Any Time
Panic Alarm: Audible Panic
Exit Mode: Normal
Bell Report Option: Others
Internal/Strobe Siren: Internal Siren
Quick Arm: "On"
Back Light Time: Off After 10 Seconds
Two-Way Voice - Private: Disable
Latchkey Arming: "Off"
Bypass: No Bypass
Trouble Beeps: Disable
Cross Zoning: "Off"
Recent Close Report: "Off"
Piezo Siren: "On"
Dialing Method: Tone (DTMF)
Remote Access: "On"
Report Confirmed Alarm: Disable Report
1st Central Tel: f19330498f
1st Account No: "001234"
2nd Account No: "005678"
Ringback Time: 1 Minute
Report to Central Station: Disable
Report To Pager: Disable Report
Reporting To Private Tel: Alarms
Central Station Dialing Attempts: "8"
Report Format: SIA
4/2 Pulse Rate: 20 pps
Two-Way Voice To Central Stations: Ring Back
Autotest Time: "12:00"
Autotest Cycle: Disable
Line Failure Report: Don't Report
System Inactive Report: Disable
Ambient Level: Low Level
PowerLink Failure: Disable Report
GSM Line Purpose: SMS Only
GSM Report to SMS: All but Open/Close
GSM Line Failure: Don't Report
GSM Install: Not Installed
GSM Select Antenna: Internal antenna
X10 Lockout Time (start HH:MM): "07:00"
X10 House Code: B
PGM By Arm Away: Disable
PGM By Arm Home: Disable
PGM By Disarm: Disable
PGM By Delay: Disable
PGM By Memory: Disable
PGM By Keyfob: Disable
PGM Act Zone A: Disable
PGM Act Zone B: Disable
PGM Act Zone C: Disable
PGM Pulse Time: 2 Seconds
X10 Trouble Indication: Disable
X10 3 Phase and frequency: Disable
X10 Report on Fail to Central Station 1: Disable
X10 Report on Fail to Central Station 2: Disable
X10 Report on Fail to Pager: Disable
X10 Report on Fail to Private: Disable
X10 Report on Fail to SMS: Disable
Set Voice Option: Enable Voice
Squawk Option: Medium Level
Auto Arm Time: "12:00"
Panel Eprom: J-701698 C17.115
Panel Software: JS702317 C17.108
Panel Serial: "2417042683."
Door Zones: Z01,Z29
Motion Zones: Z02,Z13,Z14,Z15,Z16,Z17,Z18,Z19,Z20,Z21,Z22,Z23,Z24,Z25,Z26,Z27,Z28
Smoke Zones: Z04,Z05,Z06,Z07
Other Zones: Z03,Z08,Z09,Z10,Z11,Z12
Devices: K100,S00,S01
Client Version: 0.8.5.2
Exception Count: 0
panel: 0
friendly_name: Visonic Alarm
supported_features: 3

After upgrading to 0.9.6.14 I have this:

code_format: nulsl
changed_by: ""
code_arm_required: false
mode: Standard Plus
state: Disarmed
ready: true
tamper: false
memory: false
siren: false
bypass: false
alarm: None
trouble: None
Protocol Version: 1.3.5.3
Panel Model: PowerMax Pro Part
Power Master: "No"
Watchdog Timeout (Total): 0
Watchdog Timeout (Past 24 Hours): 0
Download Timeout: 0
Download Retries: 0
Panel Problem Count: 0
Last Panel Problem Time: ""
Client Version: 0.9.6.14
Exception Count: 0
panel: 0

Despite that powerlink doesn't even work (this need further investigation), attributes like:

changed_by Panel Last Event Panel Last Event Data Panel Status Panel Trouble Status

Where removed and all my template sensors based on attributes of the sensor [alarm_control_panel.visonic_alarm] stopped working! Had to rollback to the version 0.852 that is working flawlessy and the only reason that I have to update to a later version was to fix these warnings:

2024-08-04 23:01:49.585 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'visonic' calls async_forward_entry_setup for integration, visonic with title: Panel 0 and entry_id: eebf6d00bcdacfd7b08993e0d2785c2c, which is deprecated and will stop working in Home Assistant 2025.6, await async_forward_entry_setups instead at custom_components/visonic/client.py, line 542: self.sensor_task = self.hass.async_create_task(self.hass.config_entries.async_forward_entry_setup(self.entry, "binary_sensor")), please create a bug report at https://github.com/davesmeghead/visonic/issues
2024-08-04 23:01:49.592 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'visonic' calls async_forward_entry_setup for integration, visonic with title: Panel 0 and entry_id: eebf6d00bcdacfd7b08993e0d2785c2c, which is deprecated and will stop working in Home Assistant 2025.6, await async_forward_entry_setups instead at custom_components/visonic/client.py, line 546: self.select_task = self.hass.async_create_task(self.hass.config_entries.async_forward_entry_setup(self.entry, "select")), please create a bug report at https://github.com/davesmeghead/visonic/issues
2024-08-04 23:01:49.628 WARNING (MainThread) [homeassistant.helpers.frame] Detected code that calls async_forward_entry_setup for integration visonic with title: Panel 0 (PowerMax Pro Part) and entry_id: eebf6d00bcdacfd7b08993e0d2785c2c, during setup without awaiting async_forward_entry_setup, which can cause the setup lock to be released before the setup is done. This will stop working in Home Assistant 2025.1. Please report this issue.

If you can share the changes to fix these warnings over the 0.8.5.2 version it would be awesome since my panel is quite old and will not have any evolution or change. Thank you, João

haforme commented 1 month ago

Hello, I have the same issues. My sensors and automations were written around the attributes that were available in version 0.8.5.2. Some of the attribute names have changed and I was able to figure out what I needed to do to update my logic. However, a lot of what I used was extracted from the 'Panel Last Event' attribute via "{{ state_attr('alarm_control_panel.visonic_alarm','Panel Last Event') }}". For example, battery problems, AC power failures, etc. I do not see this attribute anymore. Maybe you have another method to solve this. Could you share any sensor logic and automations that expose this? I also reverted back after a lot of effort expended to solve this. Thanks in advance.

davesmeghead commented 1 month ago

Hi, To get many, but not all, of the old panel EPROM attributes, when you create a new panel then tick this image

Note that these do not get updated and that is the problem I have with them, they are extracted from the EPROM download when the Integration starts. If you update these on your panel directly, the change is not reflected in HA until the Integration restarts to download the EPROM again. Thinking about it I should let the user change this rather than only setting it on creation.

For the Panel Last Event attributes of the panel entity, rather than having an array as a state it is now a Home Assistant Event for each event (so we don't need a count). Instead of "Count", a standalone Event is sent on the HA Event Bus for each trigger. In fact you've probably never noticed but the older versions of the integration actually did both, they sent an event and kept it as part of the alarm panel state. The old setup was complicated as it tried to mix panel and zone updates, only if "Zone" was 0 did you know that it was a panel update. So I have separated panel and zone updates with 2 Home Assistant Events.

So let's break it down ....

Panel Last Event Data:
  Zone: 0
  Entity: null
  Tamper: false
  Siren: false
  Reset: false
  Time: "2020-01-01T00:00:00.0"
  Count: 0
  Type: []
  Event: []
  Mode: []
  Name: []

Zone and Entity are part of the new Home Assistant Event visonic_alarm_sensor_state, for more information please look at Note 4 on the wiki here.

Tamper is an attribute of each Sensor and the Panel Entities.

Siren and Panel Siren Active were the same thing. Looking at the new attributes of the Alarm Panel Entity

ready: true
tamper: false
memory: false
siren: false
bypass: false
alarm: None
trouble: None

siren and tamper are there, along with memory.

Panel Alarm Status: None and Panel Trouble Status: None are the same as alarm and trouble.

For states like Panel Armed you need to use the proper entity state.

So now on to

  Type: []
  Event: []
  Mode: []
  Name: []

Get your automation to look for the HA Event as follows:

Event name: visonic_alarm_panel_state Look for the action data being set to panelupdate and then use data name and event

This is all in "Note 3" on the wiki here

So name and event are the same as in the 0.8.5.2. The type and mode were just the raw integer versions so I removed them.

If you're having trouble with the above then I'm sure that you'll let me know here :) Or if there was a specific automation you had but are struggling to replicate then ask here. I think that I covered everything but I might have missed something.

Joao-Sousa-71 commented 1 month ago

Dave,

Thank you form your prompt answer. This is more clear now. From the atributes that I'm currently using I'm still missing the [Panel Last Event]:

Panel Last Event: Disarm / User 08

This attribute tipically combines the 'state / changed by' but also have key values like: Enter Installer / System Exit Installer / System Installer Programming / System General Restore / System

Which are key for my integration. Can you please be so kind and put back in the new version as an attribute? Otherwise will make my life harder since have all the logic and the translations already in place to be used.

About the [Panel Last Event Data], changing the actual template sensors to trigger sensors I believe that will make it. I'll be glad to share the changes since might be usefull to others visonic users. Looking foward to hear from you. Thanks, João

davesmeghead commented 1 month ago

Hi, I've just released 0.9.6.16 to Github and HACS. It adds 2 new Alarm Panel Attributes: lastevent and lasteventtime Although these come through as HA Events, I can see the logic of having the last settings as attributes. I've given the attributes default values as "Startup/Startup" with the startup time. Dave

Joao-Sousa-71 commented 1 month ago

I will make a snapshot of my installation and give it a try with the 0.9.6.16. For information, when I made the upgrade the upgrade to the version 0.9.6.24 using HACS two things happened:

davesmeghead commented 1 month ago

Hi,

You're correct with your first bullet point, other users have had the same problem and I've looked through log files but everything in the log file indicates that it's panel 0 when the entity clearly looks like panel 2. The only thing I suggest is to remove and reinstall the integration and I can't think of anything else to do.

For your second bullet point, can you try release 0.9.6.17 please, it's available through HACS as well as zip file download.

Dave

davesmeghead commented 1 month ago

Can you try release 0.9.6.20 please

davesmeghead commented 4 weeks ago

Closing this issue, if the problem continues then either reopen or create a new issue please

Joao-Sousa-71 commented 4 weeks ago

@davesmeghead Dave,

My appologies for the delay on come back with a valuable feedback but I had some issues with the HA 2024.8.0 ( not related with with your integration and had to rollback versions, until upgrade again and finaly return to a more stable version. Here is the deserved status with the version 0.9.6.21. 1) The upgrade worked well but still has created a second entity "_2" something easy to workraround by deleting the previous one and renaming the new one, so I think this doesn't even deserve any further investigation. 2) The new version (0.9.6.21) was able to connect through Powerlink mode fully unnatended so this seems to be fixed :-) 3) So far it has been stable but have few days of use, and due summer vacations there is always people at home therefore the alarm arm only trigger at night and disarm in the morning. I'm following this closely to see if something unexpected show up. 4) There is only one minor bug with the attribute "changed_by". In the version 0.8.x it had values like: Fob 03, User 05, Pad 01 or Zone etc and with the new version it is always empty as shown here:

code_format: null
changed_by: ""
code_arm_required: false
mode: Powerlink
state: Disarmed
ready: true
tamper: false
memory: false
siren: false
bypass: false
alarm: None
trouble: None
lastevent: User 08/Disarm
lasteventtime: 25/08/2024, 19:05:17
Protocol Version: 1.3.6.6
Panel Model: PowerMax Pro Part
Power Master: "No"
Watchdog Timeout (Total): 0
Watchdog Timeout (Past 24 Hours): 0
Download Timeout: 0
Download Retries: 0
Panel Problem Count: 0
Last Panel Problem Time: ""
Client Version: 0.9.6.21
Exception Count: 0
panel: 0
friendly_name: Visonic Alarm
supported_features: 3

I'm surpised this was not yet reported anyway if you can fix for a future version I'll be thankfull. Keep you posted and thanks again.

Joao

davesmeghead commented 4 weeks ago

Hi, I've just uploaded dev_B0 release 0.9.7.7, can you please give it a try. You can now go in to configure and change the language, try "Panel"

for your specific 4 questions 1) This I think is a HA problem that other users have had with other integrations https://community.home-assistant.io/t/how-to-prevent-same-entity-to-be-created-again-but-with-2-after-name/160683 https://community.home-assistant.io/t/entities-renaming-to-2/640228 https://www.reddit.com/r/homeassistant/comments/1djj8r7/nodered_renaming_all_entities_in_home_assistant/ https://community.home-assistant.io/t/why-do-my-entity-names-end-with-2-3-etc-and-how-do-i-fix-it/668308

2) OK, good 3) Let me know of any problems 4) Fixed in the 0.9.7.7 release

Joao-Sousa-71 commented 3 weeks ago

Dave,

Update to dev_BO 0.9.7.7 (since it is not on HACS I've delete all content from the custom component and copy the dowload from Github). My Panel language it is in Portuguese and I'm not sure if I want to try it ;-) . As soon I've this update working 100% I will do it.

  1. The "changed_by" issue it is fixed. Good Job!

New observations to report. When HA start I have now two entries on the HA log that were not before but the integration works...

2024-08-26 15:06:23.981 WARNING (MainThread) [custom_components.visonic.pyvisonic] Lookup of Visonic Zone Type Reference Invalid, 1 is not in the array
2024-08-26 15:06:23.981 WARNING (MainThread) [custom_components.visonic.pyvisonic] Lookup of Visonic Zone Type Reference Invalid, 0 is not in the array

Not sure if you need a complete debug log but please just let me know.

Also on HA start the alarm sensor gets these attributtes:

friendly_name: Visonic Alarm
supported_features: 3
code_format: null
changed_by: Startup
code_arm_required: false
mode: Powerlink
state: Disarmed
ready: true
tamper: false
memory: false
siren: false
bypass: false
alarm: None
trouble: None
lastevent: Startup/Startup
lasteventname: Startup
lasteventaction: Startup
lasteventtime: 26/08/2024, 15:35:43
Protocol Version: 1.4.1.0
Panel Model: PowerMax Pro Part
Power Master: "No"
Watchdog Timeout (Total): 0
Watchdog Timeout (Past 24 Hours): 0
Download Timeout: 0
Download Message Retries: 0
Panel Problem Count: 0
Last Panel Problem Time: ""
Client Version: 0.9.7.7
Exception Count: 0
panel: 0

And ~30 seconds later change to this:

friendly_name: Visonic Alarm
supported_features: 3
code_format: null
changed_by: System
code_arm_required: false
mode: Powerlink
state: Disarmed
ready: true
tamper: false
memory: false
siren: false
bypass: false
alarm: None
trouble: None
lastevent: System/Installer Programming
lasteventname: System
lasteventaction: Installer Programming
lasteventtime: 26/08/2024, 15:36:20
Protocol Version: 1.4.1.0
Panel Model: PowerMax Pro Part
Power Master: "No"
Watchdog Timeout (Total): 0
Watchdog Timeout (Past 24 Hours): 0
Download Timeout: 0
Download Message Retries: 0
Panel Problem Count: 0
Last Panel Problem Time: ""
Client Version: 0.9.7.7
Exception Count: 0
panel: 0

I trust this is the expected behaviour anyway I sense that you might want it to check by your own eyes.

Finally, I notice that you add on this version the "lasteventname" and "lasteventaction" that I was spliting before on the HA side but it is now much more straight. Please let me know waht I should do next to proceed with the tests of this or next versions.

Thank you, Joao