Frustrated by Foscam FI8918W

I’ve browsed these helpful forums and found much useful advice. I went to the iSpy site and found relevant CGI URLs appropriate for my Foscam FI8918W camera.
I can configure it as a generic camera device and get successful snapshots once every 10 seconds or so, so HA and the camera play nice and my network is not at fault.
But try as I might I can’t get MJPEG streaming to work at any resolution.
From the hassio SSH add-on, I can use curl to stream the video just fine, with:

curl --anyauth --user [USERID]:[PASSWORD] http://[IPADDRESS]/videostream.cgi

So I know that the HA box can definitely pull down the video.
My configuration.yaml includes:

# Enable FOSCAM camera
camera:
#  - platform: generic
#    name: 'GarageCam'
#    still_image_url: 'http://[IPADDRESS]/snapshot.cgi'
#    framerate: 1
#    username: '[USERID]'
#    password: '[PASSWORD]'
#    authentication: digest 
  - platform: mjpeg
    mjpeg_url: 'http://[IPADDRESS]/videostream.cgi?resolution=32&rate=0'
    still_image_url: 'http://[IPADDRESS]/snapshot.cgi'
    name: 'G-Cam mjpeg'
    username: '[USERID]'
    password: '[PASSWORD]'

But in the Overview, I see only a grey card with the right title containing a broken image icon (blue question mark) and in the /config/home-assistant.log I get unending repeats of:

2018-10-28 21:16:00 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1921564752] Sending {'id': 30, 'type': 'result', 'success': True, 'result': {'content_type': 'image/jpeg', 'content': 'PEhUTUw+PEhFQUQ+PFRJVExFPjQwMSBVbmF1dGhvcml6ZWQ8L1RJVExFPjwvSEVBRD4KPEJPRFkgQkdDT0xPUj0iI2NjOTk5OSI+PEg0PjQwMSBVbmF1dGhvcml6ZWQ8L0g0PgpBdXRob3JpemF0aW9uIHJlcXVpcmVkLgo8L0JPRFk+PC9IVE1MPgo='}}

2018-10-28 21:16:10 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1921564752] Received {'type': 'camera_thumbnail', 'entity_id': 'camera.gcam_mjpeg', 'id': 31}

2018-10-28 21:16:10 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1921564752] Sending {'id': 31, 'type': 'result', 'success': True, 'result': {'content_type': 'image/jpeg', 'content': 'PEhUTUw+PEhFQUQ+PFRJVExFPjQwMSBVbmF1dGhvcml6ZWQ8L1RJVExFPjwvSEVBRD4KPEJPRFkgQkdDT0xPUj0iI2NjOTk5OSI+PEg0PjQwMSBVbmF1dGhvcml6ZWQ8L0g0PgpBdXRob3JpemF0aW9uIHJlcXVpcmVkLgo8L0JPRFk+PC9IVE1MPgo='}}

2018-10-28 21:16:20 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1921564752] Received {'type': 'camera_thumbnail', 'entity_id': 'camera.gcam_mjpeg', 'id': 32}

Any advice or pointers to my buffoonery will be appreciated!
Mike

I think adding name: never worked for me (no image), but I no longer have that model to test. What did work was this:

mpeg_url: http://<ip address>/videostream.cgi?user=<username>&pwd=<password>

Thanks @froz, for the simple and effective advice! Progress at last.
The name: does seem to work, and your simpler URL is generating a snapshot every 10s or so.
But when I click on the card (note this does the same for the generic camera, so this may not be MJPEG dependent) I get a missing image and an odd message in the HA log:

2018-10-29 08:22:28 INFO (MainThread) [homeassistant.components.http.view] Serving /api/camera_proxy_stream/camera.garagecam to [IP address of LAN ROUTER] (auth: False)

2018-10-29 08:22:28 INFO (MainThread) [homeassistant.components.http.view] Serving /api/camera_proxy_stream/camera.gcammpeg to [IP address of LAN ROUTER] (auth: False)

I’d expected the stream to be sent to the IP of the device that clicked on the card… I’ll investigate more but at least I know it’s now sort of working.

For reference my configuration.yaml now states:

# Enable FOSCAM camera            
camera:                           
  - platform: generic             
    name: 'GarageCam'             
    still_image_url: 'http://[CAMERA IP]/snapshot.cgi'
    username: '[USERID]'                                    
    password: '[PASSWORD]'                             
    authentication: digest                               
  - platform: mjpeg                                      
    name: 'Gcam-mpeg'                                    
    mjpeg_url: 'http://[CAMERA IP]/videostream.cgi?user=[USERID]&pwd=[PASSWORD]'

Ignore me. It works perfectly on my iPhone on Wifi or 4G, and when I use Firefox on a LAN-based device. Only Safari messes it up, so this is not an HA issue.

Thanks again @froz, I’m happy it’s working now!