Odianosen25 / Monitor-App

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

No sensors are created and status always away #72

Closed Diddlik closed 3 years ago

Diddlik commented 3 years ago

I currently have a RP ZeroW with monitor script. In monitor everything is displayed correctly, the devices are also recognized. In Monitor app nothing happens. I have the following configuration in Monitor:


MQTT:
# MQTT PUBLISH TOPIC ROOT
mqtt_topicpath='monitor'

# PUBLISHER IDENTITY
mqtt_publisher_identity='garage'

known_static_addresses:
48:04:CD:00:11:22 Alen
64:DD:CC:FF:EE:AA Amanda

Monitor App Config:
home_presence_app:
  module: home_presence_app
  class: HomePresenceApp
  plugin: 
    - HASS
    - MQTT
  monitor_topic: monitor
  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: 50
  not_home_timeout: 15
  system_check: 30
  system_timeout: 60
  home_gateway_sensors:
     - binary_sensor.motion_frontdoor
     - cover.garage_modtm
     - binary_sensor.netatmo_motion_human

  location:
    - dach
    - garage

  home_motion_sensors:
    - binary_sensor.0x0aaaaaa_occupancy
    - binary_sensor.0x00bbbbb_occupancy
    - binary_sensor.0x001ccc6_occupancy
    - binary_sensor.0x00158bc_occupancy

  log_level: DEBUG
  known_devices:
    - 48:04:CD:00:11:22 Alen
    - 64:DD:CC:FF:EE:AA Amanda

  known_beacons:
    - D9:3C:BB:EF:FF:FF MiBand

Everyone Home and Everyone not Home and Somebody is Home are always "Away"

Limych commented 3 years ago

The same situation... :(

Run on AppDaemon 4 Addon v0.5.1 (AppDaemon v4.0.7) Version of Monitor-App is latest: 60e5a4b

Monitor-App config:

home_presence_app:
  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

  # reboot the all nodes at 12 midnight on Mondays and Thursdays
  scheduled_restart:
    time: 00:00:01
    days:
      - mon
      - thu
    location: all

  home_motion_sensors:
    - binary_sensor.hallway_motion
    - binary_sensor.kitchen_motion
    - binary_sensor.bedroom_motion
    - binary_sensor.living_room_motion

  log_level: DEBUG
  known_devices:
    - "XX:XX:XX:XX:XX:XX Limych Phone B"
    - "XX:XX:XX:XX:XX:XX Limych Tablet L"

  known_beacons:
    - "XX:XX:XX:XX:XX:XX Limych Watch"

Logs:

2021-03-31 20:45:11.170331 DEBUG home_presence_app: Registering run_every starting 2021-04-01 00:00:01+03:00 in 86400s intervals for home_presence_app
2021-03-31 20:45:11.178053 DEBUG home_presence_app: Registering run_every starting 2021-03-31 20:45:12.174774+03:00 in 30s intervals for home_presence_app
2021-03-31 20:45:11.198676 DEBUG home_presence_app: call_service: mqtt/subscribe, {'topic': 'presence/#'}
2021-03-31 20:45:11.200219 INFO MQTT: Topic presence/# already subscribed to
2021-03-31 20:45:11.206249 DEBUG home_presence_app: Calling listen_event for home_presence_app
2021-03-31 20:45:11.213023 DEBUG home_presence_app: Listening on MQTT Topic presence
2021-03-31 20:45:11.215454 DEBUG home_presence_app: Calling listen_event for home_presence_app
2021-03-31 20:45:11.221773 DEBUG home_presence_app: Registering run_in in 0 seconds for home_presence_app
2021-03-31 20:45:11.232424 DEBUG home_presence_app: register_service: presence/remove_known_device, {}
2021-03-31 20:45:11.233857 DEBUG home_presence_app: register_service: presence/run_arrive_scan, {}
2021-03-31 20:45:11.235388 DEBUG home_presence_app: register_service: presence/run_depart_scan, {}
2021-03-31 20:45:11.236867 DEBUG home_presence_app: register_service: presence/run_rssi_scan, {}
2021-03-31 20:45:11.238355 DEBUG home_presence_app: register_service: presence/run_node_command, {}
2021-03-31 20:45:11.239847 DEBUG home_presence_app: register_service: presence/restart_device, {}
2021-03-31 20:45:11.241384 DEBUG home_presence_app: register_service: presence/reload_device_state, {}
2021-03-31 20:45:11.242822 DEBUG home_presence_app: register_service: presence/load_known_devices, {}
2021-03-31 20:45:11.244182 DEBUG home_presence_app: register_service: presence/clear_location_entities, {}
2021-03-31 20:45:11.245591 DEBUG home_presence_app: register_service: presence/clean_devices, {}
2021-03-31 20:45:11.269590 DEBUG home_presence_app: Registering run_in in 45 seconds for home_presence_app
2021-03-31 20:45:11.275942 DEBUG home_presence_app: Registering run_in in 105 seconds for home_presence_app
2021-03-31 20:45:12.035923 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/echo', 'payload': ''}
2021-03-31 20:45:42.069341 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/echo', 'payload': ''}
2021-03-31 20:45:56.049831 DEBUG home_presence_app: Registering run_in in 0 seconds for home_presence_app
2021-03-31 20:45:56.066282 DEBUG home_presence_app: Registering run_in in 3 seconds for home_presence_app
2021-03-31 20:45:56.136554 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/setup/ADD STATIC DEVICE', 'payload': 'XX:XX:XX:XX:XX:XX Limych Phone B'}
2021-03-31 20:45:59.034637 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/setup/ADD STATIC DEVICE', 'payload': 'XX:XX:XX:XX:XX:XX Limych Tablet L'}
2021-03-31 20:46:12.047937 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/echo', 'payload': ''}
2021-03-31 20:46:42.037588 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/echo', 'payload': ''}
2021-03-31 20:46:56.069891 DEBUG home_presence_app: Registering run_in in 0 seconds for home_presence_app
2021-03-31 20:46:56.157204 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/KNOWN DEVICE STATES', 'payload': ''}
2021-03-31 20:47:12.054785 DEBUG home_presence_60e5a4b
app: call_service: mqtt/publish, {'topic': 'presence/echo', 'payload': ''}
2021-03-31 20:47:42.057117 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/echo', 'payload': ''}
2021-03-31 20:48:12.051642 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/echo', 'payload': ''}
2021-03-31 20:48:42.068298 DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'presence/echo', 'payload': ''}

In the external MQTT-client, I can see that the Monitor sees the sent commands and responds to them. But Monitor-App does not see these responses.

akarnani commented 3 years ago

I think I've found the cause of this issue. However, I'm not sure if it is new behavior or not. If not, I'm not sure why its broken now.

According to https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html#configuration-of-the-mqtt-plugin the plugin by default subscribes to # as such all MQTT_MESSAGE events come through with wildcard="#" which meant this callback never fired to update the entities state.

I solved the issue by adding this to my appdaemon.yaml configuration file for the MQTT plugin

client_topics:
  - NONE

Now messages come through with the correct wildcard and everything seems to be processing again.

For reference here's the full plugin section from my config:

plugins:
    HASS:
      type: hass
    MQTT:
      type: mqtt
      namespace: mqtt
      client_host: <redacted>
      client_user: <redacted>
      client_password: <redacted>
      client_topics:
        - NONE