matijse / eufy-ha-mqtt-bridge

Receive Eufy alerts and thumbnails in Home Assistant via MQTT
124 stars 25 forks source link

MQTT Integrations seem correctly Configure but no response from devices #67

Closed juhenriquez closed 3 years ago

juhenriquez commented 3 years ago

So basically I'm try to use Eufy doorbell to trigger my wemo light switches through MQTT integrations. Im using the following addon eufy-ha-mqtt-bridge while using the Official Home Assistant Add-on: Mosquitto broker This is the configuration for my Mosquito Broker.

logins: []
anonymous: true
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

and this is the configuration for my EUFY addon

eufy:
  username: my@myemail.com
  password: mypass
mqtt:
  url: 'mqtt://192.168.68.28:1883'
  username: homeassistant
  password: homeassistant
  keepalive: 60
home_assistant:
  off_delay: 5
log_level: debug
eval: '' 

I've also added the sensors into my config file as follows.

binary_sensor:
  - platform: dlink_hnap
    name: Guest Bathroom Motion Sensor
    host: 192.168.86.43
    type: motion
    username: Admin
    password: 566898
    timeout: 35
  - platform: mqtt
    name: Doorbell button pressed
    device_class: motion
    state_topic: homeassistant/binary_sensor/eufy/T8222P0020370408_doorbell/state
    json_attributes_topic: homeassistant/binary_sensor/eufy/T8222P0020370408_doorbell/attributes
    payload_on: motion
    payload_off: clear
    off_delay: 5
camera:
  - platform: mqtt
    name: Camera - Last event
    topic: homeassistant/camera/eufy/T8222P0020370408_thumbnail 

Don't mind the dlink_hnap which is working correctly.

This is the log for the Eufy Plugin

Eufy Home Assistant MQTT Bridge
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Eufy Home Assistant MQTT Bridge
 Publish events as MQTT messages
-----------------------------------------------------------
 Add-on version: 1.18.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.13  (aarch64 / raspberrypi3-64)
 Home Assistant Core: 2021.5.1
 Home Assistant Supervisor: 2021.04.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to DEBUG
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[11:04:42] INFO: Exporting log level for nodejs: debug
[11:04:43] INFO: Symlinking data dir
[11:04:43] INFO: Running 'eval' commands
[11:04:43] INFO: Generating config.yml from options.json
[11:04:44] INFO: Image build with version 0.2.18
[11:04:44] INFO: starting original stuff...
> eufy-ha-mqtt-bridge@1.0.0 start /app
> NODE_ENV=production node --unhandled-rejections=strict index.js
info: Migrating the database... {"timestamp":"2021-05-08T15:04:52.609Z"}
debug: ---- EUFY INITIALIZE START ---- {"timestamp":"2021-05-08T15:04:52.682Z"}
debug: ----  Created classes... {"timestamp":"2021-05-08T15:04:52.687Z"}
debug: Refreshing devices... {"timestamp":"2021-05-08T15:04:52.691Z"}
info: Stored device: Doorbell (T8222P0020370408 - type: T8222) {"timestamp":"2021-05-08T15:04:56.154Z"}
debug: ----  Refreshed devices {"timestamp":"2021-05-08T15:04:56.159Z"}
debug: ----  Set up MQTT handler {"timestamp":"2021-05-08T15:04:56.162Z"}

And this is the log for the mosquito broker:

Mosquitto broker
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[09:43:04] INFO: Setup mosquitto configuration
[09:43:04] WARNING: SSL not enabled - No valid certs found!
[09:43:04] INFO: No local user available
[09:43:07] INFO: Initialize Home Assistant Add-on services
[09:43:07] ERROR: Can't setup Home Assistant service mqtt
[09:43:07] INFO: Initialize Home Assistant discovery
[09:43:07] INFO: Start Mosquitto daemon
1620481387: mosquitto version 1.6.3 starting
1620481387: Config loaded from /etc/mosquitto.conf.
1620481387: Loading plugin: /usr/share/mosquitto/auth-plug.so
1620481387: |-- *** auth-plug: startup
1620481387:  ├── Username/password checking enabled.
1620481387:  ├── TLS-PSK checking enabled.
1620481387:  └── Extended authentication not enabled.
1620481387: Opening ipv4 listen socket on port 1883.
1620481387: Opening ipv6 listen socket on port 1883.
1620481387: Opening websockets listen socket on port 1884.
1620481387: Warning: Mosquitto should not be run as root/administrator.
1620481457: New connection from 172.30.32.1 on port 1883.
[09:44:19] INFO: [INFO] found homeassistant on local database
1620481459: New client connected from 172.30.32.1 as auto-64D4DACE-D3BC-6D5F-5217-250B0E7AE3DA (p2, c1, k60, u'homeassistant').
1620481459: Client auto-64D4DACE-D3BC-6D5F-5217-250B0E7AE3DA disconnected.
1620481459: New connection from 172.30.32.1 on port 1883.
1620481459: New client connected from 172.30.32.1 as 3WaKtKgvKaWHKEmfPPpYeG (p2, c1, k60, u'homeassistant').
1620481979: Socket error on client 3WaKtKgvKaWHKEmfPPpYeG, disconnecting.
1620482015: New connection from 172.30.32.1 on port 1883.
[09:53:37] INFO: [INFO] found homeassistant on local database
1620482017: New client connected from 172.30.32.1 as 0Jgk06mioTyD4sRRGA2WWS (p2, c1, k60, u'homeassistant').
1620482612: Socket error on client 0Jgk06mioTyD4sRRGA2WWS, disconnecting.
1620482644: New connection from 172.30.32.1 on port 1883.
[10:04:06] INFO: [INFO] found homeassistant on local database
1620482646: New client connected from 172.30.32.1 as 0rBcjgDTZP9ZEVnt7Euk3Y (p2, c1, k60, u'homeassistant').
1620483188: Saving in-memory database to /data/mosquitto.db.
1620484989: Saving in-memory database to /data/mosquitto.db.
1620486558: Socket error on client 0rBcjgDTZP9ZEVnt7Euk3Y, disconnecting.
1620486592: New connection from 172.30.32.1 on port 1883.
[11:09:54] INFO: [INFO] found homeassistant on local database
1620486594: New client connected from 172.30.32.1 as 66EIuKzFmKJ3sTTs5bCM2B (p2, c1, k60, u'homeassistant').
1620486790: Saving in-memory database to /data/mosquitto.db.
1620486934: Socket error on client 66EIuKzFmKJ3sTTs5bCM2B, disconnecting.
1620486965: New connection from 172.30.32.1 on port 1883.
[11:16:07] INFO: [INFO] found homeassistant on local database
1620486967: New client connected from 172.30.32.1 as 71cO7XfW1sohmj7KzjyT44 (p2, c1, k60, u'homeassistant').
1620487846: Socket error on client 71cO7XfW1sohmj7KzjyT44, disconnecting.
1620487878: New connection from 172.30.32.1 on port 1883.
[11:31:20] INFO: [INFO] found homeassistant on local database
1620487880: New client connected from 172.30.32.1 as 2sNIVUFcS0dQUgsztkYiep (p2, c1, k60, u'homeassistant').
1620488004: Socket error on client 2sNIVUFcS0dQUgsztkYiep, disconnecting.
1620488033: New connection from 172.30.32.1 on port 1883.
1620488033: New client connected from 172.30.32.1 as 1jNNt2c3moEeGmIedS2JWV (p2, c1, k60, u'homeassistant').
1620488169: Socket error on client 1jNNt2c3moEeGmIedS2JWV, disconnecting.
1620488200: New connection from 172.30.32.1 on port 1883.
[11:36:42] INFO: [INFO] found homeassistant on local database
1620488202: New client connected from 172.30.32.1 as 27KcSYvHZxoHICkZyVyVkI (p2, c1, k60, u'homeassistant').
1620488591: Saving in-memory database to /data/mosquitto.db.

From what I can see the plugin is connecting correctly to the Eufy account and is being able to communicate with the MQTT Broker, basically the issue boiling down to no communication by the device to HASS. As in the following image.

34855c7c9a9dc7e1cc894419e4ab102411569594_2_1380x776

supajason commented 3 years ago

I'm having the same issue.

1621452054: Saving in-memory database to /data/mosquitto.db.
1621453634: New connection from 172.30.32.1 on port 1883.
401: Unauthorized1621453635: Socket error on client <unknown>, disconnecting.
1621453667: New connection from 172.30.32.1 on port 1883.
1621453667: Socket error on client <unknown>, disconnecting.
1621453855: Saving in-memory database to /data/mosquitto.db.

One thing I noticed is your Mosquito config doesn't have the logins

logins:
  - username: homeassistant
    password: homeassistant
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
supajason commented 3 years ago

After lots of messing around I finally ready the documentation for the MQTT broker (Mosquitto broker) and found that the username can't be "homeassistant"...

So I created a new home assistant user called test then updated the configs for the broker and eufy with new user, restarted and it's working :-)

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Eufy Home Assistant MQTT Bridge
 Publish events as MQTT messages
-----------------------------------------------------------
 Add-on version: 1.18.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.13  (amd64 / qemux86-64)
 Home Assistant Core: 2021.5.5
 Home Assistant Supervisor: 2021.04.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to DEBUG
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[18:51:21] INFO: Exporting log level for nodejs: debug
[18:51:21] INFO: Symlinking data dir
[18:51:21] INFO: Running 'eval' commands
[18:51:22] INFO: Generating config.yml from options.json
[18:51:22] INFO: Image build with version 0.2.18
[18:51:22] INFO: starting original stuff...
> eufy-ha-mqtt-bridge@1.0.0 start /app
> NODE_ENV=production node --unhandled-rejections=strict index.js
info: Migrating the database... {"timestamp":"2021-05-24T17:51:25.162Z"}
debug: ---- EUFY INITIALIZE START ---- {"timestamp":"2021-05-24T17:51:25.194Z"}
debug: ----  Created classes... {"timestamp":"2021-05-24T17:51:25.196Z"}
debug: Refreshing devices... {"timestamp":"2021-05-24T17:51:25.198Z"}
info: Stored device: Doorbell (T8200N0020081AA3 - type: T8200) {"timestamp":"2021-05-24T17:51:27.179Z"}
debug: ----  Refreshed devices {"timestamp":"2021-05-24T17:51:27.181Z"}
debug: ----  Set up MQTT handler {"timestamp":"2021-05-24T17:51:27.182Z"}
debug: Subscribed to homeassistant/status {"timestamp":"2021-05-24T17:51:27.328Z"}
debug: ----  Connected to MQTT {"timestamp":"2021-05-24T17:51:27.329Z"}
debug: ----  Set up auto discovery {"timestamp":"2021-05-24T17:51:32.346Z"}
info: No credentials found -> register new... {"timestamp":"2021-05-24T17:51:32.348Z"}
debug: ----  Retrieved push credentials {"timestamp":"2021-05-24T17:51:38.458Z"}
debug: ----  Started push client {"timestamp":"2021-05-24T17:51:38.538Z"}
info: Registered Push Token {"response":{"code":0,"msg":"Succeed."},"timestamp":"2021-05-24T17:51:38.763Z"}
debug: ----  Registered push token {"timestamp":"2021-05-24T17:51:38.765Z"}
debug: Uploading new thumbnail for T8200N0020081AA3 from https://zhixin-security-eu.s3.eu-central-1.amazonaws.com/thumb/REMOVED {"timestamp":"2021-05-24T17:51:38.768Z"}
debug: Image validation isValid: true {"timestamp":"2021-05-24T17:51:39.145Z"}
debug: ----  Retrieved device thumbnails {"timestamp":"2021-05-24T17:51:39.149Z"}
debug: ---- EUFY INITIALIZE DONE! ---- {"timestamp":"2021-05-24T17:51:39.152Z"}
juhenriquez commented 3 years ago

@supajason worked great thank a alot.