miguelangel-nubla / videoP2Proxy

Proxy to enable P2P only cameras to work with standard protocols.
MIT License
163 stars 42 forks source link

Error connecting to camera, make sure ip and token are correct. #15

Open ardeus-ua opened 5 years ago

ardeus-ua commented 5 years ago

Cameras (listed with IPs): 1.45 changmi.camera.ipc009 (Mijia 360 1080P, MJSXJ02CM) 1.46 mijia.camera.v3 (Mijia Camera 1080P, SXJ02ZM)

Tokens extracted with MiHome (tokens for Air Purifier and Philips Moonlight proven extracted properly). Both cameras properly respond on "mirobo discover --handshake 1", but "miiocli device --ip 192.168.1.45 --token HEXADECIMAL_TOKEN info" gives "Error: No response from the device" on both with corresponding tokens most of the time. Occasionaly gives

Model: chuangmi.camera.ipc009
Hardware version: Linux
Firmware version: 3.5.1_0217
Network: {'mask': '255.255.255.0', 'gw': '192.168.1.1', 'localIp': '192.168.1.45'}
AP: {'bssid': 'F0:B4:29:F0:AC:81', 'ssid': 'pshz', 'rssi': '-47', 'freq': 2412}

but on the same request repeated gives no response again, same no response to "miiocli device --ip 192.168.1.45 --token HEXADECIMAL_TOKEN raw_command get_ipcprop "[ 'all' ]""

while trying to run videop2proxy I get the following:

videop2proxy --ip 192.168.1.46 --token HEXADECIMAL_TOKEN --rtsp 8554
Starting proxy...
Starting RTSP server on "rtsp://192.168.1.50:8554/"
(Using port 8000 for optional RTSP-over-HTTP tunneling.)

Got error when receiving: timed out
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 290, in send
    return self.send(command, parameters, retry_count - 1)
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 290, in send
    return self.send(command, parameters, retry_count - 1)
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 290, in send
    return self.send(command, parameters, retry_count - 1)
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 293, in send
    raise DeviceException("No response from the device") from ex
miio.exceptions.DeviceException: No response from the device
Can't read output line 1 from command: python3 -c "import miio;result = miio.device.Device('192.168.1.46', 'HEXADECIMAL_TOKEN').send('get_ipcprop', ['all']);print(result['p2p_id']);print(result['avID']);print(result['avPass']);"
Error connecting to camera, make sure ip and token are correct.
Error, waiting 10 seconds and trying again.
Got error when receiving: timed out
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.5/site-packages/miio/device.py", line 259, in send
    data, addr = s.recvfrom(1024)
socket.timeout: timed out
wikijm commented 4 years ago

Hi,

Same issue here for changmi.camera.ipc009 (Mijia 360 1080P, MJSXJ02CM).

Any news?

gaiar commented 4 years ago

360 cameras are h265 and as I understood, project is aimed for h264 encoding.

lukinalutuna commented 4 years ago

Hi, can someone please provide me the example of hexadecimal_token?

cismarine commented 4 years ago

5439554463523559574b73704c224174

gurkburk76 commented 4 years ago

Does not seem to work on a (mjsxj05cm) Mi Home Security Camera 360°

videop2proxy --ip !redacted! --token !redacted!--rtsp 4888 Starting proxy... Starting RTSP server on "rtsp://!redacted!:4888/" (Using port 80 for optional RTSP-over-HTTP tunneling.)

Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'miio' Can't read output line 1 from command: python3 -c "import miio;result = miio.device.Device('!redacted!', '!redacted!').send('get_ipcprop', ['all']);print(result['p2p_id']);print(result['avID']);print(result['avPass']);" Error connecting to camera, make sure ip and token are correct. Error, waiting 10 seconds and trying again.

It also identifies itself as a "chuangmi_camera_ipc019" in my unify controller, sidenote :)

korro1975 commented 3 years ago

Good afternoon Miguel Angel.

First of all, I wanted to thank you for the work you did in developing these scripts. For those of us who are just starting out in Python and in home automation, all this information and work are of great help. Sorry to write but I am somewhat "desperate" since I am not able to launch the video of my camera Aqara G2 from Xiaomi. It gives me an error when launching the script:

pi @ raspberrypi: ~ / videoP2Proxy $ videop2proxy --ip 192.168.1.141 --token 516b4e7350625365446e51464a4cXXXX --rtsp 8554 Starting proxy ... Starting RTSP server on "rtsp: //192.168.1.254: 8554 /" (Using port 8000 for optional RTSP-over-HTTP tunneling.)

Traceback (most recent call last): File "", line 1, in KeyError: 'p2p_id' Can't read output line 1 from command: python3 -c "import miio; result = miio.device.Device ('192.168.1.141', '516b4e7350625365446e51464a4cXXXX'). Send ('get_ipcprop', ['all']); print (result ['p2p_id']); print (result ['avID']); print (result ['avPass']); " Error connecting to camera, make sure ip and token are correct. Error, waiting 10 seconds and trying again.

Both (IP and Token) are correct because other commands I have seen in this post works:

miiocli device --ip 192.168.1.141 --token 516b4e7350625365446e51464a4cXXXX info Model: lumi.camera.gwagl01 Hardware version: 1.0 Firmware version: 3.5.8_0061 Network: {'localIp': '192.168.1.141', 'mask': '255.255.255.0', 'gw': '192.168.1.1'} AP: {'ssid': 'sanse', 'rssi': '-40', 'bssid': '44:FB:5A:BD:7F:A0'}

, so I do not understand very well why it fails, I understand that it will be because the camera is not compatible with videop2proxy, but since there are a lot of supported cameras, it already seemed bad luck to me.

Anyway, if you can give me some light I would appreciate it. If not, thanks anyway for your work and contribution.

A greeting. Luis C.A.

edugrt commented 3 years ago

Same here. Xiaomi 360 Camera CMSXJ13B

CagoBHuK commented 2 years ago

Network: {'mask': '255.255.255.0', 'gw': '192.168.1.1', 'localIp': '192.168.1.45'} localIp is 192.168.1.45

videop2proxy --ip 192.168.1.46 --token HEXADECIMAL_TOKEN --rtsp 8554 why --ip is 192.168.1.46

192.168.1.45 != 192.168.1.46