hassio-addons icon indicating copy to clipboard operation
hassio-addons copied to clipboard

Documentation not clear (for newbs)

Open DAE51D opened this issue 2 years ago • 10 comments

I'm new-ish to Home Assistant. Every device I have so far has been auto-discovered and setup.

I got this plugin installed via HACS and set the user/pass and camera array. Nothing is "auto-discovered" (expected it seems)

So then where does this go? https://github.com/joshgetter/hassio-addons/blob/master/kasa-camera/README.md#adding-camera-to-home-assistant

What file? I haven't needed to edit a .yaml file for a device and i don't see any obvious ones except maybe configuration.yaml where I put that block (adjusting of course) but don't see any kasa_ entities (as I named them in the plugin page)

image

image

Please update the README.md file to be more explicit and spell out exactly what to do for those just starting out.

DAE51D avatar Mar 08 '24 06:03 DAE51D

I added this line to configuration.yaml

camera: !include cameras.yaml

then created cameras.yaml

- platform: generic
  name: "Kasa Mounted"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_mounted.jpg"
  stream_source: "rtmp://homeassistant.local:43331/live/kasa_mounted"
  verify_ssl: false
- platform: generic
  name: "Kasa Spot"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_spot.jpg"
  stream_source: "rtmp://homeassistant.local:43331/live/kasa_spot"
  verify_ssl: false
- platform: generic
  name: "Kasa Pan Tilt"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_pantilt.jpg"
  stream_source: "rtmp://homeassistant.local:43331/live/kasa_pantilt"
  verify_ssl: false
- platform: generic
  name: "Kasa Spot 2K"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_spot2k.jpg"
  stream_source: "rtmp://homeassistant.local:43331/live/kasa_spot2k"
  verify_ssl: false

Now I get this error when HA starts up... image But if i remove that line (moving name up of course) I get other errors That is exactly what your documentation says to do?!

I see this in the log too...

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Starting Nginx
Nginx Started
Starting controller
Starting KasaStreamer
info: KasaStreamer.HAListener[0]
      Initial toggle state: Enabled
info: KasaStreamer.Camera[0]
      [kasa_pantilt] Starting camera
info: System.Net.Http.HttpClient.KasaHttpClient.LogicalHandler[100]
      Start processing HTTP request GET https://192.168.1.76:19443/https/stream/mixed?video=h264&audio=g711&resolution=hd
info: System.Net.Http.HttpClient.KasaHttpClient.ClientHandler[100]
      Sending HTTP request GET https://192.168.1.76:19443/https/stream/mixed?video=h264&audio=g711&resolution=hd
info: KasaStreamer.Camera[0]
      [kasa_mounted] Starting camera
info: System.Net.Http.HttpClient.KasaHttpClient.LogicalHandler[100]
      Start processing HTTP request GET https://192.168.1.149:19443/https/stream/mixed?video=h264&audio=g711&resolution=hd
info: System.Net.Http.HttpClient.KasaHttpClient.ClientHandler[100]
      Sending HTTP request GET https://192.168.1.149:19443/https/stream/mixed?video=h264&audio=g711&resolution=hd
info: KasaStreamer.Camera[0]
      [kasa_spot] Starting camera
info: System.Net.Http.HttpClient.KasaHttpClient.LogicalHandler[100]
      Start processing HTTP request GET https://192.168.1.142:19443/https/stream/mixed?video=h264&audio=g711&resolution=hd
info: System.Net.Http.HttpClient.KasaHttpClient.ClientHandler[100]
      Sending HTTP request GET https://192.168.1.142:19443/https/stream/mixed?video=h264&audio=g711&resolution=hd
info: KasaStreamer.Camera[0]
      [kasa_spot2k] Starting camera
info: System.Net.Http.HttpClient.KasaHttpClient.LogicalHandler[100]
      Start processing HTTP request GET https://192.168.1.245:19443/https/stream/mixed?video=h264&audio=g711&resolution=hd
info: System.Net.Http.HttpClient.KasaHttpClient.ClientHandler[100]
      Sending HTTP request GET https://192.168.1.245:19443/https/stream/mixed?video=h264&audio=g711&resolution=hd
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /app
info: KasaStreamer.Ffmpeg[0]
      [kasa_pantilt] Ffmpeg started
info: KasaStreamer.Ffmpeg[0]
      [kasa_spot2k] Ffmpeg started
info: KasaStreamer.Ffmpeg[0]
      [kasa_mounted] Ffmpeg started
info: KasaStreamer.Ffmpeg[0]
      [kasa_spot] Ffmpeg started

If I try to go to an endpoint like http://homeassistant.local:43330/thumbnails/kasa_spot.jpg I get a 404 not found error (for all 4 cameras which I can see working in the TPLink android app)

Then log pukes this stack trace...

         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
         at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|283_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken)
         at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
         --- End of inner exception stack trace ---
         at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
         at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
         at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
         at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
         at System.Net.Http.HttpClient.GetStreamAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
         at KasaStreamer.KasaStreamReader.StartSplittingStream(CancellationToken cancellationToken) in /KasaStreamer/KasaStreamer/KasaStreamReader.cs:line 117
fail: KasaStreamer.KasaStreamReader[0]
      [kasa_spot2k] An error occurred while reading camera stream.
      System.IO.IOException: Unable to write data to the transport connection: Broken pipe.
       ---> System.Net.Sockets.SocketException (32): Broken pipe
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError error, Boolean forAsyncThrow)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.SendAsyncForNetworkStream(Socket socket, CancellationToken cancellationToken)
         at System.Net.Sockets.Socket.SendAsyncForNetworkStream(ReadOnlyMemory`1 buffer, SocketFlags socketFlags, CancellationToken cancellationToken)
         at System.Net.Sockets.NetworkStream.WriteAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
         at System.IO.Stream.CopyToAsyncInternal(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
         at System.IO.Stream.CopyToAsyncInternal(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at System.IO.Stream.CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at KasaStreamer.KasaStreamReader.StartSplittingStream(CancellationToken cancellationToken) in /KasaStreamer/KasaStreamer/KasaStreamReader.cs:line 136
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
         at Microsoft.AspNetCore.WebUtilities.MultipartReader.ReadNextSectionAsync(CancellationToken cancellationToken)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
         at Microsoft.AspNetCore.WebUtilities.StreamHelperExtensions.DrainAsync(Stream stream, ArrayPool`1 bytePool, Nullable`1 limit, CancellationToken cancellationToken)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
         at Microsoft.AspNetCore.WebUtilities.MultipartReaderStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
         at Microsoft.AspNetCore.WebUtilities.BufferedReadStream.EnsureBufferedAsync(Int32 minCount, CancellationToken cancellationToken)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
         at System.Net.Http.HttpConnection.ChunkedEncodingReadStream.ReadAsyncCore(Memory`1 buffer, CancellationToken cancellationToken)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
         at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder.SetResult()
         at System.Net.Http.HttpConnection.FillAsync(Boolean async)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
         at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory`1 buffer)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
         at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder.SetResult()
         at System.Net.Security.SslStream.FillBufferAsync[TIOAdapter](TIOAdapter adapter, Int32 numBytesRequired)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.InvokeContinuation(Action`1 continuation, Object state, Boolean forceAsync, Boolean requiresExecutionContextFlow)
         at System.Net.Sockets.SocketAsyncContext.OperationQueue`1.ProcessSyncEventOrGetAsyncEvent(SocketAsyncContext context, Boolean skipAsyncEvents, Boolean processAsyncEvents)
         at System.Net.Sockets.SocketAsyncContext.HandleEvents(SocketEvents events)
         at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute()
         at System.Threading.ThreadPoolWorkQueue.Dispatch()
      --- End of stack trace from previous location ---
      
         --- End of inner exception stack trace ---
         at System.IO.Stream.CopyToAsyncInternal(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at KasaStreamer.KasaStreamReader.StartSplittingStream(CancellationToken cancellationToken) in /KasaStreamer/KasaStreamer/KasaStreamReader.cs:line 138

DAE51D avatar Mar 11 '24 05:03 DAE51D

I would make sure you have the tp-link integration added, as well as the Kasa Camera addon added via the add on store you can find it by adding this repo's url to the Add Ons Store -> Settings (three dots in right top corner) -> Repositories and copy paste the url. Refresh browser home assistant site, then hopefully this should get your cameras recognized source: https://www.youtube.com/watch?v=Qi76-rQIw_A

averageprogrammer avatar Mar 19 '24 00:03 averageprogrammer

Thanks for replying, however I do have the Kasa Add on (also my config for it is shown above). I have the cameras set to static IP on my router (also shown above). I have the TP-Link added as I have several of the wall switches already. AND I'm using the camera illustrated in the video. image

For starters then, am I adding the cameras to the proper place as per my post above? Or is there somewhere else I'm supposed to do that?

DAE51D avatar Mar 19 '24 23:03 DAE51D

Thanks for replying, however I do have the Kasa Add on (also my config for it is shown above). I have the cameras set to static IP on my router (also shown above). I have the TP-Link added as I have several of the wall switches already. AND I'm using the camera illustrated in the video. image

For starters then, am I adding the cameras to the proper place as per my post above? Or is there somewhere else I'm supposed to do that?

Did you get this figured out? I am having the same "Unused YAML configuration for the generic integration" error you previously posted.

richpanda1214 avatar Jul 17 '24 17:07 richpanda1214

Unfortunately I never did @richpanda1214 . I have tried many many times various ideas (even as recently as yesterday TBH)... It is frustrating that there isn't a simple step-by-step on how to do this and what all is required (static IPs, what ports need to be open, LAN vs WAN access, what pages in HA to go to directly/explicitly). This integration feels "dead" and abandoned (by the author). 😞

DAE51D avatar Jul 17 '24 19:07 DAE51D

Hey I actually just got it to work...

So the trick is to use the integration Generic Camera. Add it as a device in your devices page on HA. Also, make sure in your config.yaml, that you use the hls stream, not the other one. This is how it looks in my config.yaml (change the IP for your HA server IP, also change camera name so its the same as the addon config):

camera:

  • platform: generic name: "bedroom" still_image_url: http://192.168.1.145:43330/thumbnails/bedroom.jpg stream_source: http://192.168.1.145:43330/hls/bedroom.m3u8

When you add the camera in the generic camera integration, set it up like this: image

richpanda1214 avatar Jul 18 '24 01:07 richpanda1214

Unfortunately I never did @richpanda1214 . I have tried many many times various ideas (even as recently as yesterday TBH)... It is frustrating that there isn't a simple step-by-step on how to do this and what all is required (static IPs, what ports need to be open, LAN vs WAN access, what pages in HA to go to directly/explicitly). This integration feels "dead" and abandoned (by the author). 😞

Check my solution above

richpanda1214 avatar Jul 18 '24 01:07 richpanda1214

@richpanda1214 I must be doing something wrong (obvi) ... I get a timeout when I try to add the cameras...

My HA is on 192.168.1.121 (but also FYI, homeassistant.local is built in to HAOS and should resolve properly, mine does). I've tried below with both just in case and same non-results...

Manually adding to the yaml file...

- platform: generic
  name: "Kasa Mounted"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_mounted.jpg"
  stream_source: "http://homeassistant.local:43330/hls/kasa_mounted.m3u8"
  verify_ssl: false
- platform: generic
  name: "Kasa Spot"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_spot.jpg"
  stream_source: "http://homeassistant.local:43330/hls/kasa_spot.m3u8"
  verify_ssl: false
- platform: generic
  name: "Kasa Pan Tilt"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_pantilt.jpg"
  stream_source: "http://homeassistant.local:43330/hls/kasa_pantilt.m3u8"
  verify_ssl: false
- platform: generic
  name: "Kasa Spot 2K"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_spot2k.jpg"
  stream_source: "http://homeassistant.local:43330/hls/kasa_spot2k.m3u8"
  verify_ssl: false

or via the GUI "addon" image

Oh wait... the IPs changed, so I updated this here http://homeassistant.local:8123/hassio/addon/a0268524_kasa_cam/config

- cameraname: kasa_pantilt
  cameraip: 192.168.1.78
  videofilter: transform=clock
  enableAudio: false
- cameraname: kasa_mounted
  cameraip: 192.168.1.149
  videofilter: transform=clock
  enableAudio: false
- cameraname: kasa_spot
  cameraip: 192.168.1.142
  videofilter: transform=clock
  enableAudio: false
- cameraname: kasa_spot2k
  cameraip: 192.168.1.239
  videofilter: transform=clock
  enableAudio: false

Darnit! nope. still not working...

I see this in the logs? image

2024-07-18 11:37:17.958 ERROR (MainThread) [homeassistant.components.generic.config_flow] Error getting camera image from http://homeassistant.local:43330/thumbnails/kasa_spot2k.jpg: ConnectError
2024-07-18 11:37:17.966 ERROR (stream_worker) [homeassistant.components.stream.stream.test_stream] Error from stream worker: Error opening stream (ERRORTYPE_22, Invalid argument, http://homeassistant.local:43330/hls/kasa_spot2k.m3u8)
2024-07-18 11:37:27.970 ERROR (stream_worker) [homeassistant.components.stream.stream.test_stream] Error from stream worker: Error opening stream (ERRORTYPE_22, Invalid argument, http://homeassistant.local:43330/hls/kasa_spot2k.m3u8)
2024-07-18 11:38:10.968 ERROR (MainThread) [homeassistant.components.generic.config_flow] Error getting camera image from http://homeassistant.local:43330/thumbnails/kasa_spot2k.jpg: ConnectError
2024-07-18 11:38:10.979 ERROR (stream_worker) [homeassistant.components.stream.stream.test_stream] Error from stream worker: Error opening stream (ERRORTYPE_22, Invalid argument, http://****:****@homeassistant.local:43330/hls/kasa_spot2k.m3u8)
2024-07-18 11:38:20.989 ERROR (stream_worker) [homeassistant.components.stream.stream.test_stream] Error from stream worker: Error opening stream (ERRORTYPE_22, Invalid argument, http://****:****@homeassistant.local:43330/hls/kasa_spot2k.m3u8)

Verified the add-on is running... (but I think it's crashing and starting over and over from the logs maybe?) image

And in there's a lot of logs http://homeassistant.local:8123/hassio/addon/a0268524_kasa_cam/logs (I don't see a way to get them ALL, it seems to only show some at a time)

kasa_spot2k] An error occurred while reading camera stream.
      System.IO.IOException: Unable to write data to the transport connection: Broken pipe.
       ---> System.Net.Sockets.SocketException (32): Broken pipe
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError error, Boolean forAsyncThrow)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.SendAsyncForNetworkStream(Socket socket, CancellationToken cancellationToken)
         at System.Net.Sockets.Socket.SendAsyncForNetworkStream(ReadOnlyMemory`1 buffer, SocketFlags socketFlags, CancellationToken cancellationToken)
         at System.Net.Sockets.NetworkStream.WriteAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
         at System.IO.Stream.CopyToAsyncInternal(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
         at System.IO.Stream.CopyToAsyncInternal(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at System.IO.Stream.CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at KasaStreamer.KasaStreamReader.StartSplittingStream(CancellationToken cancellationToken) in /KasaStreamer/KasaStreamer/KasaStreamReader.cs:line 136
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)

DAE51D avatar Jul 18 '24 18:07 DAE51D

@richpanda1214 I must be doing something wrong (obvi) ... I get a timeout when I try to add the cameras...

My HA is on 192.168.1.121 (but also FYI, homeassistant.local is built in to HAOS and should resolve properly, mine does). I've tried below with both just in case and same non-results...

Manually adding to the yaml file...

- platform: generic
  name: "Kasa Mounted"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_mounted.jpg"
  stream_source: "http://homeassistant.local:43330/hls/kasa_mounted.m3u8"
  verify_ssl: false
- platform: generic
  name: "Kasa Spot"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_spot.jpg"
  stream_source: "http://homeassistant.local:43330/hls/kasa_spot.m3u8"
  verify_ssl: false
- platform: generic
  name: "Kasa Pan Tilt"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_pantilt.jpg"
  stream_source: "http://homeassistant.local:43330/hls/kasa_pantilt.m3u8"
  verify_ssl: false
- platform: generic
  name: "Kasa Spot 2K"
  still_image_url: "http://homeassistant.local:43330/thumbnails/kasa_spot2k.jpg"
  stream_source: "http://homeassistant.local:43330/hls/kasa_spot2k.m3u8"
  verify_ssl: false

or via the GUI "addon" image

Oh wait... the IPs changed, so I updated this here http://homeassistant.local:8123/hassio/addon/a0268524_kasa_cam/config

- cameraname: kasa_pantilt
  cameraip: 192.168.1.78
  videofilter: transform=clock
  enableAudio: false
- cameraname: kasa_mounted
  cameraip: 192.168.1.149
  videofilter: transform=clock
  enableAudio: false
- cameraname: kasa_spot
  cameraip: 192.168.1.142
  videofilter: transform=clock
  enableAudio: false
- cameraname: kasa_spot2k
  cameraip: 192.168.1.239
  videofilter: transform=clock
  enableAudio: false

Darnit! nope. still not working...

I see this in the logs? image

2024-07-18 11:37:17.958 ERROR (MainThread) [homeassistant.components.generic.config_flow] Error getting camera image from http://homeassistant.local:43330/thumbnails/kasa_spot2k.jpg: ConnectError
2024-07-18 11:37:17.966 ERROR (stream_worker) [homeassistant.components.stream.stream.test_stream] Error from stream worker: Error opening stream (ERRORTYPE_22, Invalid argument, http://homeassistant.local:43330/hls/kasa_spot2k.m3u8)
2024-07-18 11:37:27.970 ERROR (stream_worker) [homeassistant.components.stream.stream.test_stream] Error from stream worker: Error opening stream (ERRORTYPE_22, Invalid argument, http://homeassistant.local:43330/hls/kasa_spot2k.m3u8)
2024-07-18 11:38:10.968 ERROR (MainThread) [homeassistant.components.generic.config_flow] Error getting camera image from http://homeassistant.local:43330/thumbnails/kasa_spot2k.jpg: ConnectError
2024-07-18 11:38:10.979 ERROR (stream_worker) [homeassistant.components.stream.stream.test_stream] Error from stream worker: Error opening stream (ERRORTYPE_22, Invalid argument, http://****:****@homeassistant.local:43330/hls/kasa_spot2k.m3u8)
2024-07-18 11:38:20.989 ERROR (stream_worker) [homeassistant.components.stream.stream.test_stream] Error from stream worker: Error opening stream (ERRORTYPE_22, Invalid argument, http://****:****@homeassistant.local:43330/hls/kasa_spot2k.m3u8)

Verified the add-on is running... (but I think it's crashing and starting over and over from the logs maybe?) image

And in there's a lot of logs http://homeassistant.local:8123/hassio/addon/a0268524_kasa_cam/logs (I don't see a way to get them ALL, it seems to only show some at a time)

kasa_spot2k] An error occurred while reading camera stream.
      System.IO.IOException: Unable to write data to the transport connection: Broken pipe.
       ---> System.Net.Sockets.SocketException (32): Broken pipe
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError error, Boolean forAsyncThrow)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.SendAsyncForNetworkStream(Socket socket, CancellationToken cancellationToken)
         at System.Net.Sockets.Socket.SendAsyncForNetworkStream(ReadOnlyMemory`1 buffer, SocketFlags socketFlags, CancellationToken cancellationToken)
         at System.Net.Sockets.NetworkStream.WriteAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
         at System.IO.Stream.CopyToAsyncInternal(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
         at System.IO.Stream.CopyToAsyncInternal(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at System.IO.Stream.CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
         at KasaStreamer.KasaStreamReader.StartSplittingStream(CancellationToken cancellationToken) in /KasaStreamer/KasaStreamer/KasaStreamReader.cs:line 136
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
         at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
         at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
         at System.Threading.Tasks.Task`1.TrySetResult(TResult result)

First thing I would make sure is you set static IPs for your home assistant, and cameras on your router. Just in case something weird happens in the future.

The first thing I would try to troubleshoot is your addon. Then make sure you have set up the cameras in the addon exactly as formatted below. I'm not sure if you need audio or not (it was pretty taxing on my system so I turned it off). I also renamed the cameras in the kasa app exactly as I named them in HA. For example "bedroom" in kasa is "bedroom" on HA. Just in case there are some weird conflicts. Try to remove spaces also. image

If the addon does not work, nothing else will. It should state that the camera is healthy. In my case, I only set up 1 camera so it shows this in the logs: image

After it says the camera(s) are healthy, then you can move to your configuration.yaml file. You do not need to make a new cameras file or anything, add this directly to your configuration.yaml file. I'm not sure the order matters but I put it near the top: image

Then, reboot your HA instance, and try adding the generic camera following what I did previously.

richpanda1214 avatar Jul 18 '24 20:07 richpanda1214