MiguelRipoll23 / homebridge-securitysystem

Homebridge plugin that creates a security system accessory that can be triggered by HomeKit sensors.
https://www.npmjs.com/package/homebridge-securitysystem
MIT License
151 stars 13 forks source link

Simple configiration of parameters in Homesecurity #540

Closed Santai65 closed 3 months ago

Santai65 commented 6 months ago

Plugin version

8.1.1

Plugin configuration

Default down load configuration

Homebridge version

1.7.0

What's your question?

Hi Miguel

I am an absolute novice (who is very eager to learn!) making slow but steady progress with my alarm system using your plug in (Rp4 + Homebridge + Homesecurity) Are you able please to share some sample configs (via the GUI) that will execute on the following automation examples as shown on your GitHub site

Trigger Actions
Motion is Detected Turn on Trip Night
Door is Opened Turn on Trip Away

I have been struggling to understand the basic concepts of Modes, Switches etc in the Home security plug in. I have read through all the documents available. However I am sure that with an example of the configs to execute on each of the above I will be able to improve my understanding of how things work and then do my own automation.

Many thanks for your help and patience

Duncan

MiguelRipoll23 commented 6 months ago

Hey,

No problem, you have to create the automations using the Home app installed by default in iOS.

This is a screen recording where I create an automation that when my motion sensor detects motion, it turns on the "Trip Away" switch.

https://github.com/MiguelRipoll23/homebridge-securitysystem/assets/3296866/d11a0801-c57e-4682-acc1-96b0a40bdc26

If my security system is set to the Away mode, then it will trip the security system and trigger it.

Trip switches are for tripping the security system. Mode switches are for bypassing HomeKit limitations in order to for example set the security system mode to away when leaving.

Feel free to ask more questions

Santai65 commented 6 months ago

Hi Miguel,

Thank you so much for your patience and time. I tried what you suggested on my system and it works !!!. Now that I have this simple "hoe to do" information that you shared with me, I will continue to build my system.

Thanks once again.

I hope that it is ok if I come back to you with any more questions :)

MiguelRipoll23 commented 6 months ago

Totally fine, you can use this issue to keep posting questions I will answer as soon as possible. Thanks!

Santai65 commented 6 months ago

Thank you MiguelSent from my iPhoneOn 23 Mar 2024, at 10:28 pm, Miguel Ripoll @.***> wrote: Totally fine, you can use this issue to keep posting questions I will answer as soon as possible. Thanks!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

Santai65 commented 6 months ago

Hey Miguel,

Sorry to bother you again!

I have configured on/off button to arm my security system now with a delay of 30 seconds - works fine. Instead of getting the standard "arming security system " message. Instead of this message, I would like to add a .wav file of my own that plays via a connected speaker for the 30 seconds' delay. Could you please provide me with some guidance as to how I achieve this?

Many thanks for your patience.

Duncan

MiguelRipoll23 commented 6 months ago

Hey @Santai65,

If you want to use your own sounds, first you gotta convert them to the MP3 format. Unfortunately I implemented the custom audio a long time ago and I hardcoded the audio format.

  1. Create a directory wherever you want: /home/user/my-sounds-directory

  2. Create a directory called en-US inside the directory: /home/user/my-sounds-directory/en-US

  3. Put your sounds in that directory and rename them accordingly (target for aming, current for armed) /home/user/my-sounds-directory/en-US/target-home.mp3 /home/user/my-sounds-directory/en-US/target-away.mp3 /home/user/my-sounds-directory/en-US/target-night.mp3

  4. Configure the plugin Inside the plugin settings expand the audio section. Enable the Play sounds (local-only, ffmpeg required) option Set the Custom Audio Path option to /home/user/my-sounds-directory for example

  5. Restart the plugin to apply the configuration changes

That should do the trick to get the custom audio working.

Santai65 commented 6 months ago

Hey Miguel,

Thanks for your patience… I am nearly there. I have put the AlarmOn sound (AlarmOn.mp3) as shown below

@.***:~/my-sounds-directory/en-US $ ls

AlarmOn.mp3

@.***:~/my-sounds-directory/en-US $

However, when I try to follow your commands

@.***:~ $ sudo apt update

sudo: unable to resolve host Homebridge228: Name or service not known

Hit:1 https://repo.homebridge.io stable InRelease

Hit:2 http://archive.raspberrypi.org/debian bullseye InRelease

Hit:3 http://raspbian.raspberrypi.org/raspbian bullseye InRelease

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

76 packages can be upgraded. Run 'apt list --upgradable' to see them.

@.***:~ $ sudo apt install ffmpeg

sudo: unable to resolve host Homebridge228: Name or service not known

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

ffmpeg is already the newest version (8:4.3.6-0+deb11u1+rpt5).

0 upgraded, 0 newly installed, 0 to remove and 76 not upgraded.

I then tried to update /etc/hosts file as follows, but cannot have access to map 127.0.0.1 to Homebridge 228

I am sorry to keep bothering you, however, I am trying to learn how to use your great pguin

Thanks for your help

Duncan

From: Miguel Ripoll @.> Sent: Saturday, March 30, 2024 1:42 AM To: MiguelRipoll23/homebridge-securitysystem @.> Cc: Santai65 @.>; Mention @.> Subject: Re: [MiguelRipoll23/homebridge-securitysystem] Simple configiration of parameters in Homesecurity (Issue #540)

Hey @Santai65 https://github.com/Santai65 ,

If you want to use your own sounds, first you gotta convert them to the MP3 format. Unfortunately I implemented the custom audio a long time ago and I hardcoded the audio format.

  1. Create a directory wherever you want: /home/user/my-sounds-directory
  2. Create a directory called en-US inside the directory: /home/user/my-sounds-directory/en-US
  3. Put your sounds in that directory and rename them accordingly (target for aming, current for armed) /home/user/my-sounds-directory/en-US/target-home.mp3 /home/user/my-sounds-directory/en-US/target-away.mp3 /home/user/my-sounds-directory/en-US/target-night.mp3
  4. Configure the plugin Inside the plugin settings expand the audio section. Enable the Play sounds (local-only, ffmpeg required option Set the Custom Audio Path option to /home/user/my-sounds-directory for example
  5. Restart the plugin to apply the configuration changes

That should do the trick to get the custom audio working.

— Reply to this email directly, view it on GitHub https://github.com/MiguelRipoll23/homebridge-securitysystem/issues/540#issuecomment-2027334734 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BF3QIC73D6V5EJHFOC6U7NTY2VVQ5AVCNFSM6AAAAABFCWZWYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXGMZTINZTGQ . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BF3QICYR6TPWRYOJDRULKMTY2VVQ5A5CNFSM6AAAAABFCWZWYWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTY22WE4.gif Message ID: @. @.> >

Santai65 commented 6 months ago

Hey Miguel

I have managed to fix the problem and installed ffmpeg below by doing some more research 😊

Here is the result.

@.***:/var/lib/homebridge $ sudo apt install ffmpeg

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

ffmpeg is already the newest version (8:4.3.6-0+deb11u1+rpt5).

0 upgraded, 0 newly installed, 0 to remove and 76 not upgraded.

@.***:/var/lib/homebridge $

This is where the mp3 AlarmOn file is

@.***:/var/lib/homebridge $ cd /home/duncan/my-sounds-directory/en-US

@.***:~/my-sounds-directory/en-US $ ls

AlarmOn.mp3 en-US

This is the config in the plugin:

Unfortunately, the custom sound does not play when I arm the system ☹

Cheers

Duncan

From: Duncan Wallace @.> Sent: Saturday, March 30, 2024 8:49 PM To: 'MiguelRipoll23/homebridge-securitysystem' @.> Subject: RE: [MiguelRipoll23/homebridge-securitysystem] Simple configiration of parameters in Homesecurity (Issue #540)

Hey Miguel,

Thanks for your patience… I am nearly there. I have put the AlarmOn sound (AlarmOn.mp3) as shown below

@.***:~/my-sounds-directory/en-US $ ls

AlarmOn.mp3

@.***:~/my-sounds-directory/en-US $

However, when I try to follow your commands

@.***:~ $ sudo apt update

sudo: unable to resolve host Homebridge228: Name or service not known

Hit:1 https://repo.homebridge.io stable InRelease

Hit:2 http://archive.raspberrypi.org/debian bullseye InRelease

Hit:3 http://raspbian.raspberrypi.org/raspbian bullseye InRelease

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

76 packages can be upgraded. Run 'apt list --upgradable' to see them.

@.***:~ $ sudo apt install ffmpeg

sudo: unable to resolve host Homebridge228: Name or service not known

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

ffmpeg is already the newest version (8:4.3.6-0+deb11u1+rpt5).

0 upgraded, 0 newly installed, 0 to remove and 76 not upgraded.

I then tried to update /etc/hosts file as follows, but cannot have access to map 127.0.0.1 to Homebridge 228

I am sorry to keep bothering you, however, I am trying to learn how to use your great pguin

Thanks for your help

Duncan

From: Miguel Ripoll @. @.> > Sent: Saturday, March 30, 2024 1:42 AM To: MiguelRipoll23/homebridge-securitysystem @. @.> > Cc: Santai65 @. @.> >; Mention @. @.> > Subject: Re: [MiguelRipoll23/homebridge-securitysystem] Simple configiration of parameters in Homesecurity (Issue #540)

Hey @Santai65 https://github.com/Santai65 ,

If you want to use your own sounds, first you gotta convert them to the MP3 format. Unfortunately I implemented the custom audio a long time ago and I hardcoded the audio format.

  1. Create a directory wherever you want: /home/user/my-sounds-directory
  2. Create a directory called en-US inside the directory: /home/user/my-sounds-directory/en-US
  3. Put your sounds in that directory and rename them accordingly (target for aming, current for armed) /home/user/my-sounds-directory/en-US/target-home.mp3 /home/user/my-sounds-directory/en-US/target-away.mp3 /home/user/my-sounds-directory/en-US/target-night.mp3
  4. Configure the plugin Inside the plugin settings expand the audio section. Enable the Play sounds (local-only, ffmpeg required option Set the Custom Audio Path option to /home/user/my-sounds-directory for example
  5. Restart the plugin to apply the configuration changes

That should do the trick to get the custom audio working.

— Reply to this email directly, view it on GitHub https://github.com/MiguelRipoll23/homebridge-securitysystem/issues/540#issuecomment-2027334734 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BF3QIC73D6V5EJHFOC6U7NTY2VVQ5AVCNFSM6AAAAABFCWZWYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXGMZTINZTGQ . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BF3QICYR6TPWRYOJDRULKMTY2VVQ5A5CNFSM6AAAAABFCWZWYWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTY22WE4.gif Message ID: @. @.> >

MiguelRipoll23 commented 6 months ago

You're almost there, no worries.

You must rename the AlarmOn.mp3 file to target-home.mp3, the moment you do this without any additional actions you should listen to the sound when arming the Home mode. If you want the sound to play when the Home mode is already armed you should name your file current-home.mp3.

Now let's say you want to play the sound when arming the Home, Away and Night modes, you should then duplicate your sound file 3 times and name them like this: target-home.mp3, target-away.mp3 and target-night.mp3.

That will do it 💯

Santai65 commented 6 months ago

YES !!! it worked you are a star developer and mentor , Miguel. Thank you.

I can now progress to the next stage of building my HomeBridge-security system . If you don’t mind, I may ask a few more questions as I progress.

Many thanks

Duncan

From: Miguel Ripoll @.> Sent: Saturday, March 30, 2024 10:26 PM To: MiguelRipoll23/homebridge-securitysystem @.> Cc: Santai65 @.>; Mention @.> Subject: Re: [MiguelRipoll23/homebridge-securitysystem] Simple configiration of parameters in Homesecurity (Issue #540)

You're almost there, no worries.

You must rename the AlarmOn.mp3 file to target-home.mp3, the moment you do this without any additional actions you should listen to the sound when arming the Home mode. If you want the sound to play when the Home mode is already armed you should name your file current-home.mp3.

Now let's say you want to play the sound when arming the Home, Away and Night modes, you should then duplicate your sound file 3 times and name them like this: target-home.mp3, target-away.mp3 and target-night.mp3.

That will do it 💯

— Reply to this email directly, view it on GitHub https://github.com/MiguelRipoll23/homebridge-securitysystem/issues/540#issuecomment-2028019194 , or unsubscribe https://github.com/notifications/unsubscribe-auth/BF3QIC2J3SWQZJWBVNNHAVTY22HKVAVCNFSM6AAAAABFCWZWYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGAYTSMJZGQ . You are receiving this because you were mentioned. https://github.com/notifications/beacon/BF3QIC7U7LX3US2USBEKLQDY22HKVA5CNFSM6AAAAABFCWZWYWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTY4EO7U.gif Message ID: @. @.> >

MiguelRipoll23 commented 6 months ago

That's great to hear, glad to help.

BTW, are you from Australia by any chance?

Santai65 commented 6 months ago

Yes I am Miguel, have you been here!Sent from my iPhoneOn 31 Mar 2024, at 7:17 pm, Miguel Ripoll @.***> wrote: That's great to hear, glad to help. BTW, are you from Australia by any chance?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

MiguelRipoll23 commented 6 months ago

I just wanted con confirm it was actually you 🙂

Thanks for supporting. Will issue a refund for the second donation as I am glad to help and don't mind helping at all. If life gets busier I probably would be able to answer in a few days top.

Feel free to ask all the questions you want in here, for real. This was my hobby project and I'm happy that it's useful for others.

Thanks again!

Santai65 commented 6 months ago

Please don’t as I wanted to sponsor you in return for the good work you doSent from my iPhoneOn 31 Mar 2024, at 7:39 pm, Miguel Ripoll @.***> wrote: I just wanted con confirm it was actually you 🙂 Thanks for supporting. Will issue a refund for the second donation as I am glad to help and don't mind helping at all. If life gets busier I probably would be able to answer in a few days top. Feel free to ask all the questions you want in here, for real. This was my hobby project and I'm happy that it's useful for others. Thanks again!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Santai65 commented 5 months ago

Hey Miguel,

How are you?.

I am making good progress with my HomeBridge alarm - thanks to your help 🙂.

I have mapped out what I want to achieve ( see attached)

So, my Alarm system will consist of:

HomeBridge as the platform 3 x Eva door sensors (Homekit enabled) 1 x Strobe light (controlled via HomeKit enabled smart plug) 1 x Siren (controlled via HomeKit enabled smart plug) On / Off switch Philips Hue (HomeKit enabled) to turn the alarm On and Off Powered speaker connected to rp4 (running Homebridge) to play various alarm audio eg Alarm On , Alarm off

In the flow diagram attached, I have achieved the areas shaded in blue. Could you please provide me with some guidance as to how I can configure the various HomeBridge parameters to achieve the other areas in the flow diagram?

If you have any questions, please feel free to ask me.

Many thanks

Duncan


From: Duncan Wallace @.> Sent: Sunday, 31 March 2024 8:07 PM To: MiguelRipoll23/homebridge-securitysystem @.> Subject: Re: [MiguelRipoll23/homebridge-securitysystem] Simple configiration of parameters in Homesecurity (Issue #540)

Please don’t as I wanted to sponsor you in return for the good work you do

Sent from my iPhone

On 31 Mar 2024, at 7:39 pm, Miguel Ripoll @.***> wrote:



I just wanted con confirm it was actually you 🙂

Thanks for supporting. Will issue a refund for the second donation as I am glad to help and don't mind helping at all. If life gets busier I probably would be able to answer in a few days top.

Feel free to ask all the questions you want in here, for real. This was my hobby project and I'm happy that it's useful for others.

Thanks again!

— Reply to this email directly, view it on GitHubhttps://github.com/MiguelRipoll23/homebridge-securitysystem/issues/540#issuecomment-2028602809, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BF3QIC65FBZD2SWM5EPYV3DY27DUJAVCNFSM6AAAAABFCWZWYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRYGYYDEOBQHE. You are receiving this because you were mentioned.Message ID: @.***>

MiguelRipoll23 commented 5 months ago

Hey @Santai65,

Sure, could you attach the image again in a new comment? Looks like GitHub failed to upload it in your previous comment.

Santai65 commented 5 months ago

Hey Miguel,

Thanks for getting back to me. Have attached the image Viper228

Cheers

Duncan

MiguelRipoll23 commented 5 months ago

I've been studying your diagram, nice work by the way.

Here's some instructions based on what I've interpreted from your attached image.

Main Door Open

Create an automation in the Home app using the event "when a sensor detects something", choose your contact sensor for the main door and the action would be to turn on the trip switch (either the global one called "Trip" or one containing a mode). This automation will play the alarm triggered when opening the door after the delay if not disarmed.

Back Door Open / Family Door Open

You want to trigger the security system immediately with no delay, right? I've thought some long ago to add a "panic switch" that does this, however the idea was discarded to avoid turning it on accidentally either using the UI or Siri. My recommendation would be to keep the delay even for sensitive zones for avoiding false alarms triggered physically or virtually but a new optional switch that implements the idea could be added if you really need it.

To sound the siren and flash some lights connected to a smart plug when the security system has been triggered, you would have to create an automation inside the Home app using the event "when an accessory is controlled", choose the security system, pick "when the security system is triggered" and finally turn on the smart plug as your action.

Note: I see that you want to flash the lights and make the siren sound only if the security system has been triggered by opening any door except the main one however this kind of condition is quite a complex one. Converting the automation to a shortcut to check if the main door is closed to turn on the smart plug could maybe work this out.

Alarm switch off

Create an automation using the event "when an sensor detects something", pick the triggered reset sensor and turn off the smart plug as an action (note: enable the triggered reset sensor in the plugin settings)

Turn off siren only

You want to stop the siren if the security system has been triggered for more than 10 minutes and switch to armed state, keeping the flashing lights on.

The way I'd do this to keep it simple would be to create an automation using the event "when an accessory is controlled", choose the security system, pick when is armed and turn off the siren smart plug as an action. This would always try to turn off the siren switch when is armed but there's no impact however. You may need to enable the advanced option "reset using off mode" if the automation is not working correctly while being in triggered state. Oh, reverting to the armed mode happens automatically if you set the "reset delay minutes" to 10.

Just to confirm, the flashing lights and siren are two different smart plugs?

Santai65 commented 5 months ago

Thank you Miguel for the instructions, much appreciated.  Yes, I have a separate smart plug for the siren and strobe light.I will try the logic below and let you know the outcome.CheersDuncanSent from my iPhoneOn 13 Apr 2024, at 6:14 am, Miguel Ripoll @.***> wrote: I've been studying your diagram, nice work by the way. Here's some instructions based on what I've interpreted from your attached image. Main Door Open Create an automation in the Home app using the event "when a sensor detects something", choose your contact sensor for the main door and the action would be to turn on the trip switch (either the global one called "Trip" or one containing a mode). This automation will play the alarm triggered when opening the door after the delay if not disarmed. Back Door Open / Family Door Open You want to trigger the security system immediately with no delay, right? I've thought some long ago to add a "panic switch" that does this, however the idea was discarded to avoid turning it on accidentally either using the UI or Siri. My recommendation would be to keep the delay even for sensitive zones for avoiding false alarms triggered physically or virtually but a new optional switch that implements the idea could be added if you really need it. To sound the siren and flash some lights connected to a smart plug when the security system has been triggered, you would have to create an automation inside the Home app using the event "when an accessory is controlled", choose the security system, pick "when the security system is triggered" and finally turn on the smart plug as your action. Note: I see that you want to flash the lights and make the siren sound only if the security system has been triggered by opening any door except the main one however this kind of condition is quite a complex one. Converting the automation to a shortcut to check if the main door is closed to turn on the smart plug could maybe work this out. Alarm switch off Create an automation using the event "when an sensor detects something", pick the triggered reset sensor and turn off the smart plug as an option (note: enable the triggered reset sensor in the plugin settings) Turn off siren only You want to stop the siren if the security system has been triggered for more than 10 minutes and switch to armed state, keeping the flashing lights on. The way I'd do this to keep it simple would be to create an automation using the event "when an accessory is controlled", choose the security system, pick when is armed and turn off the siren switch as an action. This would always try to turn off the siren switch when is armed but there's no impact however. You may need to enable the advanced option "reset using off mode" if the automation is not working correctly while being in triggered state. Oh, reverting to the armed mode happens automatically if you set the "reset delay minutes" to 10. Just to confirm, the flashing lights and siren are two different smart plugs?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a few days if no further activity occurs. Thank you for your contributions.