-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[openwebnet] Add a time stamp when an alarm zone event occurs #14743
Conversation
Signed-off-by: Giovanni Fabiani <[email protected]>
This reverts commit 16f9f08. Signed-off-by: Giovanni Fabiani <[email protected]>
Signed-off-by: Giovanni Fabiani <[email protected]>
Signed-off-by: Giovanni Fabiani <[email protected]>
@fabgio I do not see in this PR all the changes requested already in this comment |
@mvalla I did a commit which followed your comment but as you see I reverted it as integrations' tests had regressions. So I am proposing this solution that has been tested successfully on my plant. |
Signed-off-by: Giovanni Fabiani <[email protected]>
Signed-off-by: Giovanni Fabiani <[email protected]>
@mvalla How should I act for the binding to be tested? I pubblished an announcement on market place but I have been told that only one contributor per binding is authorized to pubblish. and to contact you to coordinate us |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabgio see my review.
I think current solution has a wrong design since you are putting together two information in the same channel. This solution also generates an unwanted breaking change because you are re-defining the alarm
channel.
Other comments:
- README.md will need to be updated with the new
timestamp
channel documentation - the new
timestamp
channel should be added to the .xml definitions (channels.xml and BusAlarmZone.xml) - you also have to generate the default English localization, see: https://github.com/openhab/openhab-addons#translations
| `alarm` | `bus_alarm_zone` | String | Current alarm for the zone (`SILENT`, `INTRUSION`, `TAMPERING`, `ANTI_PANIC`) | R | | ||
| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write | | ||
|------------------------------|----------------------------------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------|:-----------:| | ||
| `state` | `bus_alarm_system`, `bus_alarm_zone` | Switch | Alarm system or zone is active (`ON`) or inactive (`OFF`) | R | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not modify other lines if they are not related to the PR
| `network` | `bus_alarm_system` | Switch | Alarm system network state (`ON` = network ok, `OFF` = no network) | R | | ||
| `battery` | `bus_alarm_system` | String | Alarm system battery state (`OK`, `FAULT`, `UNLOADED`) | R | | ||
| `armed` | `bus_alarm_system` | Switch | Alarm system is armed (`ON`) or disarmed (`OFF`) | R | | ||
| `alarm` | `bus_alarm_zone` | String | Current alarm for the zone (`SILENT`, `INTRUSION`, `TAMPERING`, `ANTI_PANIC`) as well as the date and time of the event (YY/MM/DD hh:mm:ss) | R | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this channel should remain as it was before: it's not a good idea to put together two differnet information: the type of alarm that was triggered an its timestamp. This is not a good desing at all, as it makes difficult for example for scripts to detect which type of alarm has been triggered (you would need to parse the string).
As already suggested, have a look to the Verisure Alarm binding, where there is one channel for the alarm type (of type String) and one for the timestamp (of type DateTime)
switch (w) { | ||
case ZONE_ALARM_INTRUSION: | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_INTRUSION)); | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_INTRUSION + " " + now.format(format))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timestamp should not be concatenated to the alarm
channel, but returned in a new timestamp
channel. This is not a good design. See explanation in previous comment
break; | ||
case ZONE_ALARM_TAMPERING: | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_TAMPERING)); | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_TAMPERING + " " + now.format(format))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comment
break; | ||
case ZONE_ALARM_ANTI_PANIC: | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_ANTI_PANIC)); | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_ANTI_PANIC + " " + now.format(format))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comment
break; | ||
case ZONE_ALARM_SILENT: | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_SILENT)); | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_SILENT + " " + now.format(format))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comment
break; | ||
case ZONE_ALARM_TECHNICAL: | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_TECHNICAL)); | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_TECHNICAL + " " + now.format(format))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comment
break; | ||
case ZONE_ALARM_TECHNICAL_RESET: | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_TECHNICAL_RESET)); | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_TECHNICAL_RESET + " " + now.format(format))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comment
break; | ||
default: | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_NONE)); | ||
updateState(CHANNEL_ALARM_ZONE_ALARM, new StringType(ALARM_NONE + " " + now.format(format))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see previous comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, ok I will keep working on the basis of what you suggested. Do not consider this PR!
This PR allows to show a time stamp when an alarm zone event occurs on Bticino/Legrand Alarm systems such as an Intrusion or a Tampering
This PR closes #14535
Description
This PR allows to show a time stamp when an alarm zone event occurs, i.e. MM/DD/YY,HH:MM INTRUSION
Test
Tested on BTicino/Legrand bulgrar-alarm unit 3486