Odianosen25 / Monitor-App

Appdaemon App for Andrew's Monitor Presence Detection System
74 stars 9 forks source link

Known static addresses disappear #63

Open djtommye opened 3 years ago

djtommye commented 3 years ago

This has happened to me at least twice now...

I currently have four PiZero devices running monitor on them. I had originally configured them with the known_static_addresses file listing each family member's iPhone BT MAC address. When I set up Monitor, I kept those files but also included that information in the home_presence_app.yaml file.

HassOS 4.13 Supervisor v 245 AppDaemon 4.05 v 0.3.0

What happens is that everything seems to run smoothly for a while. I get my binary presence sensor for each person and each monitor device (e.g. sensor.monitor_cindy_iphonebt_garage_conf) . Then, for no apparent reason, the known_static_addresses information disappears from each device, and the binary sensors go away as well. On 8/29, the home_presence_app.yaml file totally disappeared, and I had to recreate it.

home_presence_app.zip

image

image

Odianosen25 commented 3 years ago

Hello @djtommye,

On 8/29, the home_presence_app.yaml file totally disappeared, and I had to recreate it.

You mean you lost the entire file? Is this app the only app you run using AD?

It is fine to leave the settings in the nodes, but as long as its the exact same way its written in the nodes, if not you get into trouble having multiple entities per device per node (trust me not pretty at all)

Regards

djtommye commented 3 years ago

Yes - completely gone. I have Samba on my monitor devices, and backups of the known_static_addresses file. So, when this happens, I just copy the same file back to each device. I just did that, and everything is back to "normal".

I do have "ench" running in AD as well to monitor device battery levels. However, I haven't gotten it quite dialed in yet, so I'll just remove that app for now and see if that changes anything.

Odianosen25 commented 3 years ago

Ok please remove the other apps, and see what happens

Its a strange behaviour, as in no where do I clean files.

Regards

djtommye commented 3 years ago

It happened again two days ago. I thought it might have something to do with a reboot on the piZero devices, but they all just showed a 16 day uptime. I did notice that the known_static_address files were under group and ownership of the 'pi' user, so I changed that to 'root'. We'll see if that helps with anything. I'm not real sure how that factors in.

djtommye commented 3 years ago

I'm still having issues with this. My known_static_addresses files (on all pizero devices) end up empty, with just the header information. Any idea why this would happen? It's like the appdaemon process is removing entries.

korniza commented 3 years ago

same here. End devices (2x raspberry pi 3) do not have any mac in known_static_address but still working as they get it from yaml file of application

djtommye commented 3 years ago

Here's what I've done (hopefully, it will provide a workaround until this has been discovered and fixed). I created a known_static_addresses.backup file, with all the info I need I then created a "fixit.sh" script, as follows:

sudo rm known_static_addresses sudo cp known_static_addresses.backup known_static_addresses sudo reboot -n

I then edited crontab as follows:

0 4 * /home/pi/monitor/fixit.sh

My hope is that the script will run every morning and replace the file with the backup, and then restart the Pi.

djtommye commented 3 years ago

I need a bit of clarification here... it's my understanding that the end devices (four rPi Zero's, in my case), will keep an updated known_static_addresses file, from the data pushed from the AppDaemon. However, my system keeps getting into a state where the front end shows "Entity not available", and the nodes have an empty file. I have all the addresses listed in the home_presence_app.yaml file. I'd really like to get this working. Yesterday, while I was at work, HA kept arming the alarm system while my family was home - thinking no one was here. I'm hoping @Odianosen25 can shed some light on this? If I can provide more info, please let me know!

#
# Last edit 2020/08/29 TRE file had disappeared
# From https://github.com/Odianosen25/Monitor-App
#
home_presence_app:
#  log_level: DEBUG
  module: home_presence_app
  class: HomePresenceApp
  plugin: 
    - HASS
    - MQTT
  #monitor_topic: presence
  #mqtt_event: MQTT
  user_device_domain: device_tracker
  everyone_not_home: everyone_not_home
  everyone_home: everyone_home
  somebody_is_home: somebody_is_home
  depart_check_time: 30
  depart_scans: 3
  minimum_confidence: 60
  not_home_timeout: 15
  system_check: 30
  system_timeout: 60
  home_gateway_sensors:
    - binary_sensor.front_door
    - binary_sensor.garage_door
    - binary_sensor.garage_cover
    - binary_sensor.front_door_motion

  # reboot the all nodes at 4am on M W F
  #scheduled_restart:
  #  time: 04:00:01
  #  days:
  #    - mon
  #    - wed
  #    - fri
  #  location: all

  # other location configuration options
    #location: living_room, kitchen

    #location:
    # - living_room
    # - kitchen

  home_motion_sensors:
    - binary_sensor.livingrm_motion

  #log_level: DEBUG
  known_devices:
    - E0:2B:96:DC:2F:7D Sarina_iPhoneBT
    - BC:A5:A9:94:32:9B Tyler_iPhoneBT
    - B8:7B:C5:1D:CE:05 Cindy_iPhoneBT
    - BC:A5:A9:97:51:D9 Tommy_iPhoneBT

#  known_beacons:
#    - xx:xx:xx:xx:xx:xx Odianosen's Car Keys

  remote_monitors:
    disable: False
    office:
#      auto_reboot_when_offline: True
      host: !secret presence_monitor_office
      username: !secret presence_node_username
      password: !secret presence_node_password
      reboot_command: sudo /sbin/reboot now

    living_room:
#      auto_reboot_when_offline: True
      host: !secret presence_monitor_livingrm
      username: !secret presence_node_username
      password: !secret presence_node_password
      reboot_command: sudo /sbin/reboot now

    garage:
#      auto_reboot_when_offline: True
      host: !secret presence_monitor_garage
      username: !secret presence_node_username
      password: !secret presence_node_password
      reboot_command: sudo /sbin/reboot now

    mbr:
#      auto_reboot_when_offline: True
      host: !secret presence_monitor_mbr
      username: !secret presence_node_username
      password: !secret presence_node_password
      reboot_command: sudo /sbin/reboot now

HA2_Capture HACapture