Sonoff GK-200MP2-B IP Camera

I did, yes. From memory it was something to do with the trailing slash - also it didn’t show up a preview straight away. So leave it a few minutes when you change something to check if it actually works.

Hi Mike,
my I bother you with a quick question?
I followed the setup that you described, using @alexxIT 's awesome integration as seen on github.
When I click on the control buttons in the card, I get Failed to call service sonoff/send_command. Service not found.
I assume I need to define the sonoff/send_command somewhere?
Thoughts ?
thanks,
chrisV

Hi Chris

Are you referring to the WebRTC integration or just using the picture element card?

I no longer use the picture element card and am using @AlexxIT ’s WebRTC HASS integration.

1 Like

Hi @MikeF9
yes, I am using AlexxIT’s WebRTC HASS integration as well.
The reaction of the camera is a lot better.
The Picture Element Card has too long delays on my camera (close to 10 seconds)

So, the video part of the WebRTC HASS integration works, but I can’t get the controls to work (see screenshot below)

Do I need to install a separate service that you know of?
thank you
chrisV

BTW, this is how my scripts.yaml looks like
(and it is “included” in configuration.yaml")

left:
  sequence:
    - service: sonoff.send_command
      data:
        device: 'my 6 digit device id'  # use quotes, this is important
        cmd: left

right:
  sequence:
    - service: sonoff.send_command
      data:
        device: 'my 6 digit device id'  # use quotes, this is important
        cmd: right

up:
  sequence:
    - service: sonoff.send_command
      data:
        device: 'my 6 digit device id'  # use quotes, this is important
        cmd: up

down:
  sequence:
    - service: sonoff.send_command
      data:
        device: 'my 6 digit device id'  # use quotes, this is important
        cmd: down

You have installed the Sonoff LAN integration from @AlexxIT hey?

The sonoff.send_command is a service that’s built into that integration on HACS

1 Like

ah… I need to install that one as well?
No I haven’t… I thought that was for something else
thanks !
I will take a look at it
chrisV

yes, that was it !
It was not clear to me that you need to install 2 HACS repos from AlexxIT’s store. (webRTC Camera and Sonoff Lan)

It all works beautifully now
1AM… time to bed
chrisV

Hi, but the PTZ controls of webrtc lovelace card are for sonorr LAN component, right? how to have controls with the cxamera running sonoff-hack firm? thanks (my only idea is accomodate that calls to the restAPI calls to the webportal of sonoff-hack like http://192.168.1.XX/cgi-bin/ptz.sh?dir=down

Hi - I found 2 different approaches to do pan/tilt with the sonoff camera that work with the sonoff-hack firmware:

Approach 1 - First Install the yi-camera-custom component @ https://github.com/robtesch/home-assistant-yi-camera-custom
Second- Use the yi-camera-custom ptz service call in your love lace card of choice.

service: yi_hack.ptz
service_data:
  entity_id: camera.yi_hack_s_b44dd9_cam #auto generated
  movement: left
  travel_time: 0.3

Approach 2- Enable the ONVIF integration in the sonoff-hack web UI.
Next add the ONVIF integration for your camera in the home assistant integrations UI.
Finally- replace the pan/tilt service call in your love lace card of choice with the ONVIF service call data model for your camera.

Onvif service call:

service: onvif.ptz
service_data:
  pan: LEFT # or tilt: UP
  distance: 0.31
  speed: 1  
  move_mode: RelativeMove
  entity_id: camera.backdoor_profile_0

Bonus: you can set the speed and other variables in both the yi-camera-custom as well as the ONVIF integration that I don’t believe is in the https://github.com/AlexxIT/SonoffLAN integration.

Here is my card for reference:

Here is the lovelace yaml for my card using the yi-camera-custom component and the frigate NVR card.

type: vertical-stack
cards:
  - type: custom:frigate-card
    frigate_camera_name: backdoor
    view_timeout: '30'
    autoplay_clip: true
    controls: {}
    webrtc:
      entity: camera.yi_hack_s_b44dd9_cam # Backdoor camera created by yi-camera-custom
    menu_mode: below
    camera_entity: camera.yi_hack_s_b44dd9_cam
    view_default: live
    live_provider: webrtc
  - type: horizontal-stack
    cards:
      - type: custom:button-card
        color_type: card
        color: rgb(223, 255, 97)
        icon: mdi:arrow-collapse-left
        tap_action:
          action: call-service
          service: yi_hack.ptz
          service_data:
            entity_id: camera.yi_hack_s_b44dd9_cam
            movement: left
            travel_time: 0.3
      - type: custom:button-card
        color_type: card
        color: rgb(223, 255, 97)
        icon: mdi:arrow-collapse-right
        tap_action:
          action: call-service
          service: yi_hack.ptz
          service_data:
            entity_id: camera.yi_hack_s_b44dd9_cam
            movement: right
            travel_time: 0.3
      - type: custom:button-card
        color_type: card
        color: rgb(223, 255, 97)
        icon: mdi:arrow-collapse-up
        tap_action:
          action: call-service
          service: yi_hack.ptz
          service_data:
            entity_id: camera.yi_hack_s_b44dd9_cam
            movement: up
            travel_time: 0.3
      - type: custom:button-card
        color_type: card
        color: rgb(223, 255, 97)
        icon: mdi:arrow-collapse-down
        tap_action:
          action: call-service
          service: yi_hack.ptz
          service_data:
            entity_id: camera.yi_hack_s_b44dd9_cam
            movement: down
            travel_time: 0.3
      - type: custom:button-card
        color_type: blank-card
      - type: custom:button-card
        color_type: blank-card

Please let me know if I can provide any additional detail.

1 Like

thanks @ninjasstudio , i managed to add PTZ Yi Hack service to the card :slight_smile: , thanks for sharing your info.

Here is mine, with the camera running sonoff-hack, and added to HA with yi-hack:

type: custom:webrtc-camera
url: rtsp://USER:[email protected]:554/av_stream/ch0
intersection: 0.75
ui: true
webrtc: true
ptz:
  service: yi_hack.ptz
  data_left:
    entity_id: camera.yi_hack_s_XXXXX_cam
    movement: left
    travel_time: 0.3
  data_right:
    entity_id: camera.yi_hack_s_XXXXX_cam
    movement: right
    travel_time: 0.3
  data_up:
    entity_id: camera.yi_hack_s_XXXXX_cam
    movement: up
    travel_time: 0.3
  data_down:
    entity_id: camera.yi_hack_s_XXXXX_cam
    movement: down
    travel_time: 0.3

Between using Yi Hack or ONVIF… any advantages or disaadvantages? Im using only YiHack and deactivated the ONVIF server on the camera with sonoff-hack (and deactivated cloud also). But im not sure what I’m missing :smiley:

Thanks

Yes I’m just coming to this and seems like the two options are YiHack/SonoffHack or the webRTC/SonoffLAN combo. Would appreciate any pros/cons from those who have tried both?

Hi Guys,
the image refresh is 4-5 seconds at me, how did you fixed this issue? The camera view is live.
Thanks a lot!

I’m using 4 of them with the SonoffHack with Frigate NVR for detection and recording and webRTC for the Lovelace interface. I also have the Frigate NVR debug MJPEG stream in Lovelace. The MJPEG stream has about a 2 second lag but low framerate. The webRTC stream latency is under 1 second for sure.

1 Like

Not really… I did the same. I did findthat the YiHack pan/tilt API responded faster than the ONVIF pan tilt commands and since the ONVIF API is additional load for the SoC in the camera I also disabled ONVIF and Cloud, then used the YiHack addon for the pan/tilt commands. Using Frigate NVR for recording and WebRTC for viewing live in Lovelace.

I have the Sonoff GK-200MP2-B IP Camera in my cottage and the HA server in my house. How can I access the camera stream(add to the HA) from a different LAN?

Hi,

Starting as a noob in home asissistant. I try to get your addon but get an error. I type the following URLK in the ADD repository screen :

What do I do wrong ?

Hey! I am facing some issues (getting a green screen) using the Sonoff cam hack in Frigate.
Would you please share your frigate config - thanks in advance!

I’m also trying out the Yi-hack but I’m not able to get PTZ working. Does the camera need to be connected via lan for that function to work?

I just purchased the Sonoff GK and am just trying to get it to connect to HA. Camera works with app.
I tried the Generic template with the following code:

stream:
camera:
  - platform: generic
    name: "Sonoff_gh_200"
    stream_source: "rtsp://[email protected]:554/av_stream/ch0"

and received the following error for the configuration:

Invalid config for [camera.generic]: required key not provided @ data[‘still_image_url’]. Got None. (See ?, line ?).

Any suggestions would be appreciated.

Bob