Sonoff GK-200MP2-B IP Camera

I think it’s part of the serial code on the bottom of the camera

Thanks @Eeeeeediot - am i going nuts??? image

Heres the relevant part from the docs:

Maybe not then, I can’t remember been a long time. Check the ID that it shows in your address table on your router. Failing that does the setup WiFi have an ID?

Sorry ignore me! It was behind the camera part, not underneath!! Silly me…

thanks for helping!

Hi All,

I looking for a solution to watch back videos from the camera’s TF card.
Can you help me out?

An other, in Ewelink I am able to rotate the camera right, left, up and down.
Any idea about it?

Thanks a lot!

I have another project - hassio addon:

It can show stream from this camera in real realtime. Without any delay of picture.
Support sound.
It also can work with other cameras, but not with all of them.
For now it don’t have lovelace card.
It support only realtime stream from camera, no other functions.

3 Likes

Good job!
I look forward to further developments

maybe you can start your own thread? seems usefull for

gonna try to attach foscam cameras later, exposed to rtsp from synology

Ok, a created new thread

1 Like

Hey Guys I am trying to setup the cam in my Home assistant, But i am not getting anything.
image

Any Advice? Please and Thank you.

If using rtsp, use this:

1 Like

Do we know if it’s possible to confgure this ip camera without the application?
Thanks

Hi all. I had my Sonoff GK-200MP2-B IP Camera working perfectly, with PTZ scripts set up in the same way as @Eeeeeediot displayed on 20 Jun and card layout Oct 20. Around 2 months ago, the PTZ’s stopped working. :frowning: not sure if it was a card layout change or something.
The camera still displays on the card as usual (be it with a 7 second delay) but as soon as I select any of the PTZ buttons (Left,Right,Up,Down) nothing happens.

I’ve run the scripts directly from the configuration scripts area and still, nothing happens. But something is happening…

The logbook says in this sequence:
CameraPTZ Left started by Mike
then…
CameraPTZ Left turned on by Mike
then around 15 seconds later…
CameraPTZ Left turned off by Mike

Nothing happens.

I’ve looked at my scripts in the UI and my device id is not in quotes… ‘123456’
It just shows
image

No matter if I enter quotes and save the script,
image

when I go back in to view the script, the device id is no longer in quotes and blue… its orange again.

So I went into my scripts.yaml and put the quotes in… ‘123456’
Saved it. Reloaded scripts and even restarted home assistant.
image

The script.yaml shows ‘123456’ still (in green). Great. But… The UI where it would show the service being called is now blank. WTH?

After hours of troubleshooting… I notice that if id do set my device id to ‘123456’ it keeps the quotes. However my device id begins with a Zero (0) and I’m inclined to think that, that has something to do with it. As soon as I enter my device id which is 0***** in quotes, it makes the quotes disappear. if I use any other number not beginning with a Zero, it keeps the quotes.

This is so frustrating/confusing. Any wiz that can help me understand what is going on, would be greatly appreciated.

Hi all. With very little sleep I return to let you know that I think I corrected the issue.
Had nothing to do with the leading Zero in my device id.

The horizontal stack of buttons, each called on an entity, for example: Left button Entity was script.cameraptz_left. Lower down, the tap action was set to call service, script.cameraptz_left as well.

I removed the entity as this is optional, from all the buttons and left the tap action to call the service. The buttons on the card appear to be working well again.
Not sure what caused this but glad it’s sorted.

What would be great now though, is if someone knew of a way to reduce the delay in the card.
I can confirm that as soon as I tap the button, and looking at the camera through eWeLink, the camera moves immediately after moving it. The card in HA though takes around 7 seconds to show the movement.

Anyways, hope my post helps anyone that encounters a similar issue to me.

Cheers

@MikeF9 I have ran into the exact same issue. PTZ buttons arent working :frowning: Feel like I’ve tried everything at this point. Created services through the UI, config.yaml and scripts.yaml. Nothing I do appears to work. I have also noticed my device id dropping to 123456 from ‘123456’.

Are you able to share you scripts & button code with me so I can give it a try?

Hi @apomper

So I’ve got my cameras finally working. They don’t always respond every time I try move them but a reboot of the camera seems to work.

Firstly, I’m using a Picture Elements Card Configuration which I had to setup with the code editor as the visual editor won’t allow it. The coding, for the one camera, is as follows:

type: picture-elements
camera_view: live
camera_image: camera.sonoff_main_camera
elements:
  - type: icon
    icon: 'mdi:arrow-left-drop-circle'
    tap_action:
      action: call-service
      service: script.main_camera_left
    style:
      bottom: 45%
      left: 5%
      color: white
      opacity: 0.5
      transform: 'scale(1.5, 1.5)'
  - type: icon
    icon: 'mdi:arrow-right-drop-circle'
    tap_action:
      action: call-service
      service: script.main_camera_right
    style:
      bottom: 45%
      right: 5%
      color: white
      opacity: 0.5
      transform: 'scale(1.5, 1.5)'
  - type: icon
    icon: 'mdi:arrow-up-drop-circle'
    tap_action:
      action: call-service
      service: script.main_camera_up
    style:
      top: 10%
      left: 46%
      color: white
      opacity: 0.5
      transform: 'scale(1.5, 1.5)'
  - type: icon
    icon: 'mdi:arrow-down-drop-circle'
    tap_action:
      action: call-service
      service: script.main_camera_down
    style:
      bottom: 10%
      left: 46%
      color: white
      opacity: 0.5
      transform: 'scale(1.5, 1.5)'
  - type: icon
    icon: 'mdi:arrow-expand-all'
    tap_action:
      action: more-info
    entity: camera.sonoff_main_camera
    style:
      top: 5%
      right: 5%
      color: white
      opacity: 0.5
      transform: 'scale(1.5, 1.5)'

My configuration.yaml file has the following:

camera:
  - platform: ffmpeg
    name: Sonoff Main Camera
    input: -rtsp_transport tcp -i rtsp://rtsp:[email protected]:554/av_stream/ch0

The scripts I have for the PTZ buttons are up, down, left and right. Example below…

main_camera_up:
  alias: Main Camera Up
  sequence:
  - service: sonoff.send_command
    data:
      device: *input your 6 digit camera number here including the ZERO if it's starts with a ZERO*
      cmd: up
  mode: single

To answer the issue with the dropping from ‘123456’ to 123456, I configured it in my scripts.yaml with the ’ and ’ and it also dropped it again, after saving the file and restarting HA, but itworks. In my visual editor of my script it looks like this.

image

The device number shows in a pinky red colour.

Let me know if you don’t come right.

And if anyone knows how to get rid of the, roughly, 7 second delay between pressing the up, down, left or right arrows, before you see the picture actually move, please share.

So the final product looks like this…

image

1 Like

Thank you for the very detailed guide @MikeF9. I will give it a try shortly.
You can get rid of the delay by running WebRTC (also from AlexxIT). Link here

Edit.
I have used your exact script & button code and still nothing appears to work :frowning: Even with debug logging enabled for Sonoff & HA, no errors appear anywhere. Tried running the scripts directly from the scripts page also with no success.

My scripts.yaml has kept the ‘’ through restarts. The GUI version of the scripts has dropped the ‘’ but device ID is red just like yours.

service

I’m about to give up lol

Edit2:
Fire up my test VM and set everything up the same there. And, IT WORKED!. So it looks like I have something causing issues on my main HA server :frowning: At least I know where to troubleshoot now.
Thank you very much for your help.

Great to hear, and not so great that you can’t get it to work on your production server.

Hope you figure it out.

Question, are you using the picture elements card now? Are you not using the WebRTC card with PTZ?
I’m playing around with it and it’s working, just would prefer the PTZ buttons on the WebRTC card to display the same way as they do on the Picture Elements Card

Hi @MikeF9. Your setup made me interested in this camera. Also saw your comment on the WebRTC thread. A few questions before I order this:

  1. Were you able to expose the motion detection binary sensor entity of the camera to HA?
  2. Have you tried adding the camera to HA using the ONVIF integration? (I have another camera and the motion detection binary sensor was automatically exposed to HA using the ONVIF integration; PT (not Z) controls are also managed using the integration.
  3. Using the WebRTC custom card, do you get audio as well from the camera on HA?
  4. Can you please share your WebRTC custom card config with the PTZ controls?

Hi there

As of yet I haven’t been able to expose the motion sensor to HA. It would be great it we could because then I’ d setup a script to record and forward myself the video via my Telegram Bot.

I haven’t used the ONVIF Integration. Please let me know if you’ve tried and if it worked.

The WebRTC card allows one way audio for now, I did mention it on @AlexxIT WebRTC forum. Realtime camera streaming without any delay - WebRTC, that it would be great to have two way audio.

If you go to the link above, @AlexxIT has all the details you need to set the card up.

My card looks as follows:

type: 'custom:webrtc-camera'
url: 'rtsp://rtsp:[email protected]:554/av_stream/ch0'
intersection: 0.75
ui: true
webrtc: true
ptz:
  opacity: 0.8
  service: sonoff.send_command
  data_left:
    device: "Your cameras 6 digit Unique Number"
    cmd: left
  data_right:
    device: "Your cameras 6 digit Unique Number"
    cmd: right
  data_up:
    device: "Your cameras 6 digit Unique Number"
    cmd: up
  data_down:
    device: "Your cameras 6 digit Unique Number"
    cmd: down

Hope this helps

1 Like