Page 3 of 3

Re: EufyCam E : set security mode fom domoticz

Posted: Tuesday 29 August 2023 21:35
by manjh
Kyrille wrote: Sunday 27 August 2023 23:20 Yes, everybody is enjoying Eufy devices with Jeedom or HomeAssistant thanks to a good integration of bropat client & websocket packages, but nothing for Domoticz. :-(
Will try to investigate...
It would almost make sense to install HomeAssistant for units like Eufy, and keep Domoticz for the rest. Wonder if HA and Domoticz could communicate via MQTT...
Before anyone suggests a full migration: I have too much (time and effort) invested in Domoticz. Migration would be a major deal.

Re: EufyCam E : set security mode fom domoticz

Posted: Tuesday 29 August 2023 23:08
by Kyrille
I am using a Raspberry and followed the docker container approach (https://bropat.github.io/eufy-security-ws/#/docker), updating the variables with the correct values for me (I am in France, with Homebases v2 & v3, using a mobile phone called Pixel 6a for my Eufy app on a daily basis):

Code: Select all

docker run --network host -it \
    -e USERNAME=your-secondary-account\
    -e PASSWORD="corresponding-password"\
    -e PORT=3000\
    -e COUNTRY=FR\
    -e LANGUAGE=fr\
    -e TRUSTED_DEVICE_NAME="Pixel 6a"\
    -e STATION_IP_ADDRESSES="T8010P232010034A:192.168.10.60;T8030P2323101277:192.168.10.34"\
    -v /home/pi/docker/eufy-security-ws/data:/data \
    bropat/eufy-security-ws:latest
Corresponding result in the shell:

Code: Select all

2023-08-29 20:09:12.014  INFO  Eufy Security server listening on host 0.0.0.0, port 3000 
2023-08-29 20:09:17.343  INFO  Connected to station T8010P232010034A on host 192.168.10.60 and port 27393 
2023-08-29 20:09:17.422  INFO  Connected to station T8030P2323101277 on host 192.168.10.34 and port 29815 
2023-08-29 20:09:20.546  INFO  Push notification connection successfully established 
2023-08-29 20:09:25.902  INFO  Push notification connection successfully established 
Then, with the following python script, I was able to disarm my Homebase3 (replace your-docker-ip string with the IP of the machine running your docker, same for the serial number of your homebase):

Code: Select all

import json
from websocket import create_connection
ws = create_connection("ws://your-docker-ip:3000")
print(ws.recv())
ws.send(json.dumps({"command": "station.set_property", "serialNumber": "T8030P2323101277", "name": "guardMode", "value": "63"}))
print(ws.recv())
ws.close()
The corresponding log:

Code: Select all

2023-08-29 20:40:45.620  INFO  Alarm mode for station T8030P2323101277 changed to: DISARMED 
2023-08-29 20:40:45.863  INFO  Received push notification for changing guard mode 
{
  guard_mode: 63,
  current_mode: 63,
  stationSN: 'T8030P2323101277'
}
You just need to create several Python scripts, one for each of the scenario you want to achieve, and to execute them in Domoticz (by filling the "Action on" or "Action off" fields of your scenarios with these scripts).

I used the following thread to understand what to do (in french, sorry) : https://community.jeedom.com/t/integrat ... eufy/76603

For remind, the guardmode values:

Code: Select all

Away = 0
Home = 1
Disarmed = 63
Planned = 2
Geofencing = 47
CUSTOM1 = 3
CUSTOM2 = 4
CUSTOM3 = 5
Hope it helps.

Re: EufyCam E : set security mode fom domoticz

Posted: Wednesday 30 August 2023 1:05
by Kyrille
And if you want to use a docker compose approach for any reason, you can use the following docker-compose.yml template (don't forget to adapt the FR/fr with US/en for instance):

Code: Select all

version: '2.1'
services:
  eufy:
    image: bropat/eufy-security-ws:latest
    container_name: eufy
    network_mode: host
    restart: unless-stopped
    environment:
      - USERNAME=your-secondary-account
      - PASSWORD=corresponding-password
      - PORT=3000
      - COUNTRY=FR
      - LANGUAGE=fr
      - TRUSTED_DEVICE_NAME="Pixel 6a"
      - STATION_IP_ADDRESSES=T8010P232010034A:192.168.10.60;T8030P2323101277:192.168.10.34
    volumes:
      - /home/pi/docker/eufy-security-ws/data:/data
and the command to launch it:

Code: Select all

docker-compose -f docker-compose.yml up -d
Fo sure, you will have to install docker and docker-compose packages with some commands like:

Code: Select all

sudo pip3 install docker-compose
I rebooted my Pi and everything restarted with no issue.

So, my Eufy cams are back in business in a Domoticz context ! :-) Enjoy.

Re: EufyCam E : set security mode fom domoticz

Posted: Wednesday 30 August 2023 12:44
by manjh
Thank you for these detailed description.
One more question: is it possible at all to do this without the use of docker or docker-compose?

Re: EufyCam E : set security mode fom domoticz

Posted: Wednesday 30 August 2023 12:54
by Kyrille
I think it can be done without docker or docker-compose. When having a command like:

Code: Select all

docker exec -it my-container-id
I was able to see a run.sh script with some primary commands, close to the ones listed in the Tryout section.

But I would say docker can be a good (and light) approach to learn. It will be the only possible way to use eufy-security add-on in HomeAssistant on a Raspberry for instance (except if you install a full Debian 12 or HA OS instead of the usual Raspberry OS).

Re: EufyCam E : set security mode fom domoticz

Posted: Wednesday 30 August 2023 13:12
by waltervl
manjh wrote: Wednesday 30 August 2023 12:44 Thank you for these detailed description.
One more question: is it possible at all to do this without the use of docker or docker-compose?
See the documentation of the library https://bropat.github.io/eufy-security-ws/#/tryitout

Code: Select all

npm i eufy-security-ws
But then you have to invest in knowledge to use npm

Re: EufyCam E : set security mode fom domoticz

Posted: Thursday 31 August 2023 13:33
by manjh
I tried installing it using npm, but get this warnings:

Code: Select all

sudo npm i eufy-security-ws
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=16' },
npm WARN EBADENGINE   current: { node: 'v12.22.12', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=16.9.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.12', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=16.9.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.12', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=14.14' },
npm WARN EBADENGINE   current: { node: 'v12.22.12', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=16.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.12', npm: '7.5.2' }
npm WARN EBADENGINE }

Looks like serious warnings...

Re: EufyCam E : set security mode fom domoticz

Posted: Thursday 31 August 2023 16:04
by waltervl
Seems you need to update npm and nodejs. That is why it is sometimes easier to use docker....

Re: EufyCam E : set security mode fom domoticz

Posted: Thursday 31 August 2023 22:02
by manjh
waltervl wrote: Thursday 31 August 2023 16:04 Seems you need to update npm and nodejs. That is why it is sometimes easier to use docker....
I did, and now the install runs without errors or warnings.
But I am still unsure about how to proceed from there.
The Try-it-out page does not give me clues, when I try

Code: Select all

ts-node src/bin/server.ts 
it complains about "command not found".
Hints, anyone?

Re: EufyCam E : set security mode fom domoticz

Posted: Thursday 31 August 2023 22:16
by waltervl

Re: EufyCam E : set security mode fom domoticz

Posted: Thursday 31 August 2023 22:46
by manjh
waltervl wrote: Thursday 31 August 2023 22:16 oplossing ts-node command not found
Ah. :mrgreen:

Getting there, step by step.
Now I get this:

Code: Select all

ts-node src/bin/server.ts
node:internal/modules/cjs/loader:1051
  throw err;
  ^

Error: Cannot find module './server.ts'
Require stack:
- /home/pi/src/bin/imaginaryUncacheableRequireResolveScript
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Function.resolve (node:internal/modules/helpers:136:19)
    at requireResolveNonCached (/usr/lib/node_modules/ts-node/dist/bin.js:549:16)
    at getProjectSearchDir (/usr/lib/node_modules/ts-node/dist/bin.js:519:40)
    at phase3 (/usr/lib/node_modules/ts-node/dist/bin.js:267:27)
    at bootstrap (/usr/lib/node_modules/ts-node/dist/bin.js:47:30)
    at main (/usr/lib/node_modules/ts-node/dist/bin.js:33:12)
    at Object.<anonymous> (/usr/lib/node_modules/ts-node/dist/bin.js:579:5)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/pi/src/bin/imaginaryUncacheableRequireResolveScript' ]
}

Node.js v20.5.1
when I look, there is no directory /home/pi/src.

Re: EufyCam E : set security mode fom domoticz

Posted: Thursday 31 August 2023 22:59
by manjh
OK, looked a bit deeper and found some stuff:

Code: Select all

/usr/lib/node_modules/ts-node
But the ts-node module is not there...

Re: EufyCam E : set security mode fom domoticz

Posted: Saturday 16 December 2023 18:49
by EdwinK
manjh wrote: Tuesday 29 August 2023 21:35
Kyrille wrote: Sunday 27 August 2023 23:20 Yes, everybody is enjoying Eufy devices with Jeedom or HomeAssistant thanks to a good integration of bropat client & websocket packages, but nothing for Domoticz. :-(
Will try to investigate...
I tried the HA way, and while it indeed finds the Eufy homebase, when I tried to activate it, it wouldn't let me, so.. that is not a real option. i hope someone, someday will make a working plugin for both the doorbell as the cams and security system.