davesmeghead / visonic

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

How does the motion detectors actually works? #42

Closed zyberzero closed 3 years ago

zyberzero commented 3 years ago

Hi! Thanks for this integration. So far it has worked pretty well for me.

However, I do have a question regarding how the motion detectors work.

It seems to me that when it triggers the first time, it sets the binary_sensor as detected for the amount of time set in the integration, no matter the time some one actually disturbed a zone (example: I have one detector in my home office. but it only detects me for the defined time even though I'm in the office for much longer time than that.

I've enabled all debug logging but I can't see any event from when the detector is in clear state. Doesn't Visonic do that? Does it only sends the first time it trips and nothing else until it is triggered again after being idle for two minutes?

I'm using a Powermax Complete v1 with Next T MCW, and integrating using a Wemos-clone connected to the panel.

Thanks again!

davesmeghead commented 3 years ago

Hi, I think that the best thing I can do to help is start with what the panel tells me:

The panel also tells me about tamper and battery state etc but they aren't relevant here.

For every Non-PIR sensor:

Notes:

For every PIR sensor:

Notes:

Visonic Operation Each PIR sensor has a timeout period. The PIR sensor will detect motion and then not report motion detections for a period of time. This time is a setting inside the sensor itself and some PIRs allow you to select this by changing a pin position on the little PCB for the sensor itself.

Home Assistant Operation PIRs will be triggered on the lowest time period, either the PIR setting itself or the "Motion Off Delay Time". I set "Motion Off Delay Time" to 120 seconds as I do not want repeat PIR triggers within that time.

Hope this helps

codechippy commented 3 years ago

Hi Dave have just got this going on my Home Assistant instance and it works like a charm, many thanks for this integration. I noticed in your comment above that you get the battery status for sensors, but ignore, any chance we can get this inside Home Assistant. I recently had an issue while I was away from home when a sensor failed due to low battery and was setting off false alarms so would be good to know when I need to change battery ahead of time.

Many thanks CodeChippy

anthonywalker75 commented 3 years ago

I use a flow in NodeRed to check the battery states every day and if 1 or more is low it sends a notification, it also sets an input flag true which causes an entities panel to display which shows all the sensor battery states.

Happy to share code if requested.

Anthony

codechippy commented 3 years ago

Hi Anthony that would be great

CodeChippy

davesmeghead commented 3 years ago

You can also use an Automation within Home Assistant. Creating an Automation using multiple triggers, 1 for each sensor, use the Battery Level Attribute of each Sensor Entity. Don't fill in the "From" field, just use the "To" field and set to 0.

You can also create sensors from the attributes of other sensors. Put this in your configuration.yaml file

template:
  - sensor:
      - name: Panel Status
        state: >
            {{ state_attr('alarm_control_panel.visonic_alarm', 'Panel Status') | title  }}
      - name: Panel Mode
        state: >
            {{ state_attr('alarm_control_panel.visonic_alarm', 'Panel Mode') | replace("_", " ") | title  }}
      - name: Panel Battery Z01
        state: >
            {{ state_attr('binary_sensor.visonic_z01', 'battery_level') | int }}

See the template description on the Home Assistant website. This creates 3 sensors called: sensor.panel_mode, sensor.panel_status and sensor.panel_battery_z01

EDIT: I have added the last entry that provides a sensor entity called sensor.panel_battery_z01. It uses the attribute battery_level from the sensor binary_sensor.visonic_z01 i.e. The Zone 1 sensor. Remember that the battery level is either 0 or 100. The panel only sends me a single binary bit that tells me the battery is "good" or "not good" so I interpret those as 100% and 0% respectivelly.

anthonywalker75 commented 3 years ago

Visonic Battery Status - NodeRed.txt

Node red flow to monitor battery levels. Checks every morning at 1am. if any sensor doesn't have 100 as value sets mqtt flag to true and email's & notifies my mobile.

The mqtt flag is then used to display an entities panel in lovelace showing the battery values.

This could be done using a HA automation but i find things make more sense using node red.

Anthony