Code Monkey home page Code Monkey logo

ha-shinobi's People

Contributors

carsonf avatar chemelli74 avatar elad-bar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ha-shinobi's Issues

Motion detection not working when using Tensorflow and event filter

Hi,

I'm a big fan of your HA Shinobi integration :)
I recently modified my Shinobi setup to use Tensorflow (as detection engine) and added a filter, so it only will trigger if a 'Person' is identified. The integration with HA is still working except that when a motion detection is triggered in Shinobi it is not triggered in HA.
I do see the following in HA (when motion detection is triggered in Shinobi and debug log is on in HA):
2023-01-07 13:07:30.993 DEBUG (MainThread) [custom_components.shinobi.component.api.websocket] Payload received, Data: {'f': 'detector_trigger', 'id': 'terrasse', 'ke': 'sC0jRzUi9E', 'details': {'plug': 'Tensorflow', 'name': 'Tensorflow', 'reason': 'object', 'matrices': [{'x': 489.9746322631836, 'y': 41.84635877609253, 'width': 126.097412109375, 'height': 218.58217477798462, 'tag': 'person', 'confidence': 0.8130321502685547}], 'imgHeight': 480, 'imgWidth': 640, 'time': 203}, 'doObjectDetection': False}

2023-01-07 13:07:30.993 DEBUG (MainThread) [custom_components.shinobi.component.api.websocket] Firing event shinobi/object, Payload: {'f': 'detector_trigger', 'id': 'terrasse', 'ke': 'sC0jRzUi9E', 'details': {'plug': 'Tensorflow', 'name': 'Tensorflow', 'reason': 'object', 'matrices': [{'x': 489.9746322631836, 'y': 41.84635877609253, 'width': 126.097412109375, 'height': 218.58217477798462, 'tag': 'person', 'confidence': 0.8130321502685547}], 'imgHeight': 480, 'imgWidth': 640, 'time': 203}, 'doObjectDetection': False}

2023-01-07 13:08:00.888 DEBUG (MainThread) [custom_components.shinobi.component.api.websocket] No message handler available, Message: 456-["f",{"f":"video_build_success","hrefNoAuth":"/videos/sC0jRzUi9E/terrasse/2023-01-07T13-07-24.mp4","filename":"2023-01-07T13-07-24.mp4","mid":"terrasse","ke":"sC0jRzUi9E","ext":"mp4","time":"2023-01-07T12:07:24.000Z","size":3941256,"end":"2023-01-07T12:07:54.879Z","objects":"person","events":[{"f":"trigger","id":"terrasse","ke":"sC0jRzUi9E","details":{"plug":"Tensorflow","name":"Tensorflow","reason":"object","matrices":[{"x":489.9746322631836,"y":41.84635877609253,"width":126.097412109375,"height":218.58217477798462,"tag":"person","confidence":0.8130321502685547}],"imgHeight":480,"imgWidth":640,"time":203},"frame":{"_placeholder":true,"num":0},"pluginKey":"491df0a3c4518eab92e78bf69ee90d89c4bc8c23ca62c250c6814cd5ecb5","plug":"Tensorflow","doObjectDetection":false,"mid":"terrasse","currentTime":"2023-01-07T12:07:30.862Z","currentTimestamp":"2023-01-07T13:07:30+01:00","screenshotName":"object_Terrasse_terrasse_sC0jRzUi9E_2023-01-07T13-07-30","screenshotBuffer":null},{"f":"trigger","id":"terrasse","ke":"sC0jRzUi9E","details":{"plug":"Tensorflow","name":"Tensorflow","reason":"object","matrices":[{"x":425.4217529296875,"y":49.87807273864746,"width":162.87757873535156,"height":330.8500099182129,"tag":"person","confidence":0.5065410733222961}],"imgHeight":480,"imgWidth":640,"time":226},"frame":{"_placeholder":true,"num":1},"pluginKey":"491df0a3c4518eab92e78bf69ee90d89c4bc8c23ca62c250c6814cd5ecb5","plug":"Tensorflow"},{"f":"trigger","id":"terrasse","ke":"sC0jRzUi9E","details":{"plug":"Tensorflow","name":"Tensorflow","reason":"object","matrices":[{"x":407.5551986694336,"y":33.83763313293457,"width":165.68626403808594,"height":335.7494831085205,"tag":"person","confidence":0.973068118095398}],"imgHeight":480,"imgWidth":640,"time":229},"frame":{"_placeholder":true,"num":2},"pluginKey":"491df0a3c4518eab92e78bf69ee90d89c4bc8c23ca62c250c6814cd5ecb5","plug":"Tensorflow"},{"f":"trigger","id":"terrasse","ke":"sC0jRzUi9E","details":{"plug":"Tensorflow","name":"Tensorflow","reason":"object","matrices":[{"x":389.66522216796875,"y":21.461176872253418,"width":194.9323272705078,"height":358.30957889556885,"tag":"person","confidence":0.9273003339767456}],"imgHeight":480,"imgWidth":640,"time":220},"frame":{"_placeholder":true,"num":3},"pluginKey":"491df0a3c4518eab92e78bf69ee90d89c4bc8c23ca62c250c6814cd5ecb5","plug":"Tensorflow"},{"f":"trigger","id":"terrasse","ke":"sC0jRzUi9E","details":{"plug":"Tensorflow","name":"Tensorflow","reason":"object","matrices":[{"x":390.4310607910156,"y":20.805974006652832,"width":125.38726806640625,"height":364.33011531829834,"tag":"person","confidence":0.9167547821998596}],"imgHeight":480,"imgWidth":640,"time":226},"frame":{"_placeholder":true,"num":4},"pluginKey":"491df0a3c4518eab92e78bf69ee90d89c4bc8c23ca62c250c6814cd5ecb5","plug":"Tensorflow"},{"f":"trigger","id":"terrasse","ke":"sC0jRzUi9E","details":{"plug":"Tensorflow","name":"Tensorflow","reason":"object","matrices":[{"x":406.4086151123047,"y":52.66399383544922,"width":160.6890869140625,"height":312.3201370239258,"tag":"person","confidence":0.9617406725883484}],"imgHeight":480,"imgWidth":640,"time":228},"frame":{"_placeholder":true,"num":5},"pluginKey":"491df0a3c4518eab92e78bf69ee90d89c4bc8c23ca62c250c6814cd5ecb5","plug":"Tensorflow"}]}]
Would it be possible to trigger a motion detection event in HA based on above input?
Thanks in advance

Component initializing but no devices are added

The integration appears to be initializing but I never have any devices show up. I'm also getting one of the errors like SnakeZZZ was getting.
HA: core-2021.9.5
Log:
2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi] Starting async_setup_entry of shinobi 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.managers.configuration_manager] get_basic_data, data: {'host': '192.168.1.210', 'port': '8080', 'ssl': False, 'username': <removed>, 'password': '<also removed>', 'path': '/'} 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.models.base_entity] Starting async_setup_entry binary_sensor 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.models.base_entity] Starting async_setup_entry camera 2021-09-12 22:09:58 INFO (MainThread) [custom_components.shinobi.managers.home_assistant] Handling ConfigEntry change: {'entry_id': '39c67d9d8b4c6e43728f2136c9a1a4e0', 'version': 1, 'domain': 'shinobi', 'title': 'Shinobi Video', 'data': {'host': '192.168.1.210', 'port': '8080', 'ssl': False, 'username': '<removed>', 'password': '<removed>', 'path': '/'}, 'options': {}, 'pref_disable_new_entities': False, 'pref_disable_polling': False, 'source': 'user', 'unique_id': None, 'disabled_by': None} 2021-09-12 22:09:58 INFO (MainThread) [custom_components.shinobi.api.shinobi_api] Initializing Shinobi Video 2021-09-12 22:09:58 INFO (MainThread) [custom_components.shinobi.api.shinobi_api] Performing login 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] POST http://192.168.1.210:8080/?json=true 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Status of http://192.168.1.210:8080/?json=true: 200 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Temporary auth token: 90187c1bee884df83c1628cecb95de89 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] GET http://192.168.1.210:8080/90187c1bee884df83c1628cecb95de89/api/7LBLsFrGWs/list 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Status of http://192.168.1.210:8080/90187c1bee884df83c1628cecb95de89/api/7LBLsFrGWs/list: 200 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Permanent access token: d0rBxaU7JM2fcyGiRQfPT3pI9j9xBX 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.managers.home_assistant] Updating @2021-09-12 22:09:58.920775 2021-09-12 22:09:58 INFO (MainThread) [custom_components.shinobi.api.shinobi_api] Updating data from Shinobi Video Server (Shinobi Video) 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Retrieving camera list 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] GET http://192.168.1.210:8080/d0rBxaU7JM2fcyGiRQfPT3pI9j9xBX/monitor/7LBLsFrGWs 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Status of http://192.168.1.210:8080/d0rBxaU7JM2fcyGiRQfPT3pI9j9xBX/monitor/7LBLsFrGWs: 200
2021-09-12 22:09:58 ERROR (MainThread) [custom_components.shinobi.managers.home_assistant] Failed to async_update, Error: 'str' object has no attribute 'get', Line: 247
2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Initializing WS connection 2021-09-12 22:09:58 INFO (MainThread) [custom_components.shinobi.api.shinobi_websocket] Starting to listen connected 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Connected, Message: {"sid":"i-ImWgOjhBgyR4NhAAEy","upgrades":[],"pingInterval":25000,"pingTimeout":5000} 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Back channel connected 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Sending message, Data: 42["f", {"auth": "d0rBxaU7JM2fcyGiRQfPT3pI9j9xBX", "f": "init", "ke": "7LBLsFrGWs", "uid": "EnVInSV6Ev"}], Connected: True 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] WebSocket Connected 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: users_online 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: user_status_change 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: diskUsed 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: init_success 2021-09-12 22:09:58 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: monitor_snapshot 2021-09-12 22:10:03 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: os 2021-09-12 22:10:06 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] No payload handler available, Payload: ['ping', {'beat': 1}]

Blueiris or shinobi ?

In the readme I see Blueiris mentioned a lot which is very confusing ..

Does this component make use of the blue iris integration ? or am I missing something ?

Only motion sensor entities

Hello, thank you for your integration but I have problem.
I've standalone Shinobi with 3 cameras and after I've installed your Shinobi Video NVR and I have only 3 motion sensors, no video stream, no lovelace card.
Why is that? Is it problem with my installation or I should change something in my Shinobi server? I have newest HA and newest Shinobi integration.
Thank you

Integrations should cancel non-critical tasks when receiving the stop event

Hi,

I often get the following warning during shutdown (v3.0.1/v3.0.2 of the integration, HA 2023.7.3) :

2023-08-04 12:18:14.396 WARNING (MainThread) [homeassistant.core] Task <Task pending name='dispatcher shinobi_API_STATUS_SIGNAL' coro=<Coordinator._on_api_status_changed() running at /usr/src/homeassistant/homeassistant/util/logging.py:154> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]> was still running after stage 2 shutdown; Integrations should cancel non-critical tasks when receiving the stop event to prevent delaying shutdown

Thx for investigating,

Simone

Unable to play live stream

Wondering if it's just me going crazy or this never worked. I was under the impression that live stream was possible within Home assistant. Currently when a camera is being access through home assistant the overlay come up but it's is not the regular live stream is shown when accessing an rtso stream. instead the overlay pops with a refresh rate of 1 image per second... Not sure if during a home assistant upgrade the live stream broke (as I believe it was working with the live stream before) or maybe something change in the latest shinobi upgrade?

any ideas?

Seeing major performance issue with Hassio 2022.10.x

Latest Shinobi integration.
With integration enabled, load on HA goes 1.5+. When off back to <.01.

Integration is working though...

See these log entries...will keep digging:
2022-10-07 17:31:17.723 WARNING (MainThread) [custom_components.shinobi.component.api.websocket] Failed to connect Shinobi Video WS, Error: maximum recursion depth exceeded while getting the str of an object
2022-10-07 17:31:17.727 ERROR (MainThread) [custom_components.shinobi.component.api.api] Failed to access API, Error: maximum recursion depth exceeded while calling a Python object, Line: 319

Sample code for home assistant automations?

I have no idea how to use the select entity in home assistant automations. Some samples in the readme / documentation would be great.

Select
Allow to control the monitor mode:
    stop (Disabled)
    start (Watch-Only)
    record (Record)

PS Shinobi is amazing. I'm recording 1080P streams on the smallest NUC (Celeron, 4Gb) without any problems!

Cannot Connect to Shinobi - Missing Permanent API Key

I am having an issue connecting Home Assistant to Shinobi since my update to the shinobi component to 2.0.26. After the update my cameras no longer connected so I removed the component, intending to reconfigure. Whenever I do the initial integration configuration I get a timeout error with 'Missing Permanent API Key'.

With debug enabled I get the following in the logs:

2022-11-27 18:28:36.488 DEBUG (MainThread) [custom_components.shinobi.config_flow] Starting async_step_user of Shinobi Video
2022-11-27 18:28:36.490 DEBUG (MainThread) [custom_components.shinobi.configuration.managers.configuration_manager] Validate login
2022-11-27 18:28:36.490 INFO (MainThread) [custom_components.shinobi.component.api.api] Initializing Shinobi Video
2022-11-27 18:28:36.490 INFO (MainThread) [custom_components.shinobi.core.api.base_api] Performing login
2022-11-27 18:28:36.490 DEBUG (MainThread) [custom_components.shinobi.component.api.api] POST http://10.23.10.10:8070/?json=true, Url Encoded: False
2022-11-27 18:28:36.506 DEBUG (MainThread) [custom_components.shinobi.component.api.api] Status of http://10.23.10.10:8070/?json=true: 200
2022-11-27 18:28:36.510 DEBUG (MainThread) [custom_components.shinobi.component.api.api] GET http://10.23.10.10:8070/8891a4201adca80274853405a5f07190/api/uhUYXqkkPT/list
2022-11-27 18:30:36.514 ERROR (MainThread) [custom_components.shinobi.component.api.api] Failed to get data from {base_url}{api_key}/api/{group_id}/list, Error: Server disconnected, Line: 203
2022-11-27 18:30:36.515 WARNING (MainThread) [custom_components.shinobi.component.api.api] Invalid response while trying to get API keys, Payload is empty
2022-11-27 18:30:36.517 WARNING (MainThread) [custom_components.shinobi.config_flow] Failed to create integration, Error: missing_permanent_api_key

I have an API key setup om Shinobi following the recommended configuration and I have had the component working for a long time. My Shinobi instance and my HomeAssistant instance are both running in dockers on an Unraid server so I do not expect there are any network issues.

The strange thing is that I can open the URL referenced (http://10.23.10.10:8070/8891a4201adca80274853405a5f07190/api/uhUYXqkkPT/list) in my browser as well as using the Home-Assistant docker WebUI in Unraid. In both cases I get an immediate result - pasted below. It shows an API key but I removed it since I don't think we want to share those broadly.

{
   "ok": true,
   "uid": "zBG9AHrmij",
   "ke": "uhUYXqkkPT",
   "keys": [
      {
         "ke": "uhUYXqkkPT",
         "uid": "zBG9AHrmij",
         "ip": "0.0.0.0",
         "code": "####",
         "details": {
            "auth_socket": "1",
            "get_monitors": "1",
            "control_monitors": "1",
            "get_logs": "1",
            "watch_stream": "1",
            "watch_snapshot": "1",
            "watch_videos": "1",
            "delete_videos": "1"
         },
         "time": "2022-11-26T00:03:41.000Z"
      }
   ]
}

TypeError: startswith first arg must be bytes or a tuple of bytes, not str

Hi,

I have installed the shinobi integration and everything is working normally. I can see all preview images and watch all live feeds from HA.

There's one error though thats being logged every minute I think:

2021-09-27 16:05:20 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/shinobi/api/shinobi_websocket.py", line 163, in parse_message
    if message.startswith(SHINOBI_WS_CONNECTION_ESTABLISHED_MESSAGE):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

I have then disabled the call to parse_message() in shinobi_websocket.py / handle_next_message() and the error stopped. I do not see any negative result as all cameras are working normally:

if msg.data == "close":
    result = False
else:
    """self.hass.async_create_task(self.parse_message(msg.data))"""      <--- DISABLED
    result = True

Invalid Server Details (debug enabled)

2022-12-28 18:41:24.199 DEBUG (MainThread) [custom_components.shinobi.config_flow] Starting async_step_user of Shinobi Video
2022-12-28 18:41:24.204 DEBUG (MainThread) [custom_components.shinobi.configuration.managers.configuration_manager] Validate login
2022-12-28 18:41:24.204 INFO (MainThread) [custom_components.shinobi.component.api.api] Initializing Shinobi Video
2022-12-28 18:41:24.205 INFO (MainThread) [custom_components.shinobi.core.api.base_api] Performing login
2022-12-28 18:41:24.205 DEBUG (MainThread) [custom_components.shinobi.component.api.api] POST http://192.168.2.242:8383/?json=true, Url Encoded: False
2022-12-28 18:41:24.227 DEBUG (MainThread) [custom_components.shinobi.component.api.api] Status of http://192.168.2.242:8383/?json=true: 200
2022-12-28 18:41:24.235 DEBUG (MainThread) [custom_components.shinobi.component.api.api] GET http://192.168.2.242:8383/6b7e8c15b2f81bea496505cffc11bdb3/api/ucH7i6yZnt/list
2022-12-28 18:41:24.244 DEBUG (MainThread) [custom_components.shinobi.component.api.api] Status of http://192.168.2.242:8383/6b7e8c15b2f81bea496505cffc11bdb3/api/ucH7i6yZnt/list: 200
2022-12-28 18:41:24.245 ERROR (MainThread) [custom_components.shinobi.component.api.api] Login attempt failed, Error: 'str' object has no attribute 'get', Line: 293
2022-12-28 18:41:24.253 WARNING (MainThread) [custom_components.shinobi.config_flow] Failed to create integration, Error: invalid_server_details
2022-12-28 18:41:25.510 DEBUG (MainThread) [custom_components.shinobi.config_flow] Starting async_step_user of Shinobi Video
2022-12-28 18:41:25.530 DEBUG (MainThread) [custom_components.shinobi.configuration.managers.configuration_manager] Validate login
2022-12-28 18:41:25.530 INFO (MainThread) [custom_components.shinobi.component.api.api] Initializing Shinobi Video
2022-12-28 18:41:25.530 INFO (MainThread) [custom_components.shinobi.core.api.base_api] Performing login
2022-12-28 18:41:25.531 DEBUG (MainThread) [custom_components.shinobi.component.api.api] POST http://192.168.2.242:8383/?json=true, Url Encoded: False
2022-12-28 18:41:25.549 DEBUG (MainThread) [custom_components.shinobi.component.api.api] Status of http://192.168.2.242:8383/?json=true: 200
2022-12-28 18:41:25.557 DEBUG (MainThread) [custom_components.shinobi.component.api.api] GET http://192.168.2.242:8383/eef5be77b9eb65a38a33b84b7c0ca80a/api/ucH7i6yZnt/list
2022-12-28 18:41:25.563 DEBUG (MainThread) [custom_components.shinobi.component.api.api] Status of http://192.168.2.242:8383/eef5be77b9eb65a38a33b84b7c0ca80a/api/ucH7i6yZnt/list: 200
2022-12-28 18:41:25.565 ERROR (MainThread) [custom_components.shinobi.component.api.api] Login attempt failed, Error: 'str' object has no attribute 'get', Line: 293
image

[FR] Change log level

Hi,

would be possibile to move the following log line from "INFO" to "DEBUG" log level ?

2022-07-22 05:38:03 INFO (MainThread) [custom_components.shinobi.component.api.shinobi_api] Updating data from Shinobi Video Server (Shinobi Video)

Just to keep the log at a decent size and avoid spamming.
Thank you in advance for considering my request.

Simone

Motion detector not working

I have motion detector enabled for a camera, I have the region setup and when I am watching the logs via the triangle in shinobie I do see the following.

hP4K31upsS : Ot1xEiBbDf Event Occurred 2 minutes ago plug : built-in name : multipleRegions reason : motion confidence : 6 matrices : 0 : confidence : 5 width : 96 height : 196 x : 472 y : 215 tag : LAI7T imgHeight : 480 imgWidth : 640

So to me this looks like the motion detection is working on the Shinobi side. The HA side, I see the motion detector and its set as an entity to the device. However it only ever says clear. Nothing seems to change that. I'd like to get this working and also get it working with deepstack-face but I can't seem to get just basic motion detector working.

camera entity not capturing any frames

For some reason the logs shows the following during startup:

`
This error originated from a custom integration.

Logger: custom_components.shinobi.core.components.camera
Source: custom_components/shinobi/core/components/camera.py:166
Integration: Shinobi Video NVR (documentation, issues)
First occurred: 10:51:21 AM (2 occurrences)
Last logged: 10:51:21 AM

Failed to initialize CoreCamera instance, Error: invalid literal for int() with base 10: '', Line: 63
`

And I assume this is the reason why the card on the dashboard does not display any video feed and the logs shows the following when trying to access the shinobi card in the dashboard:

`
This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/shinobi/core/components/camera.py:119
Integration: Shinobi Video NVR (documentation, issues)
First occurred: 10:53:36 AM (3 occurrences)
Last logged: 10:53:38 AM

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 722, in get
return await self.handle(request, camera)
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 740, in handle
image = await _async_get_image(
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 169, in _async_get_image
if image_bytes := await camera.async_camera_image(
File "/config/custom_components/shinobi/core/components/camera.py", line 119, in async_camera_image
url = self._still_image_url.async_render()
AttributeError: 'NoneType' object has no attribute 'async_render'

`

Everything works as expected except the camera feeds (Motion detection works.. etc...)...

Any ideas how to solve this?

Timezone ignoreg

Seems like shinobi records the videos in GMT time no matter what the timezone is set in Shinobi or Home assistant the videos in the Media navigation are shown in gmt time causing the incorrect folder position (events happening today showing in tomorrow's folder and so on) is it possible for the the add-on to capture the timzezone of the shinobi server or at least use the home assistant time zone ?

Feature Request: Option to Omit Camera

I have a ton of cameras and don't want them all to load in HA. Could you please provide an option to omit a camera when using this integration?

Thank you

"Path" setup field, not defined in readme, required?

Trying to add my Shinobi server, sat behind nginx proxy, so adding as follows:

Host: https://shinobi.example.com
Path: ?? Left blank
Port: 443
Username: [email protected]
Password: ***

But am getting "Invalid server details" error

Also a tad confused on the API key, I have generated one, but there doesn't appear to be anywhere to put it, instructions mention generating one, but not anything after that? Maybe that is as expected

Checked the logs, but nothing being entered when Home Assistant attempts a connection

Integration broken

The latest update broke the integration, removing, and attempting to re-add results in Config flow could not be loaded: {"message":"Invalid handler specified"}

Invalid server details

Hi
running core-2021.5.5 on Debian + Docker
have Shinobi running and all working standalone, trying to login at the initial setup integration keeps saying "Invalid server details"
Its the same details i use to access the shinobi server dashboard?

does it only work on the Shinobi Pro?

thanks

Motion detection issue

Hi,

First of all; thanks for all the work you have put into this plugin!
Secondly; I'm aware that another issue with a similar topic has been opened, but I don't think it is the same and I didn't want to highjack the other thread to I hope it is ok that I open a new one.

My issue
I have two cameras in Shinobi that has been configured with the “built-in motion detection” set to “No”, but using Tensorflow instead (and also objection detection enabled). This is working in Shinobi, events are logged to DB and visible in “video list” and power viewer.
But these events are not forwarded to HA. When an event is triggered in Shinobi, this error is shown in HA:

Logger: homeassistant
Source: custom_components/shinobi/api/shinobi_websocket.py:170
Integration: Shinobi Video NVR ([documentation](https://github.com/elad-bar/ha-shinobi), [issues](https://github.com/elad-bar/ha-shinobi/issues))
First occurred: 19.40.41 (4 occurrences)
Last logged: 20.09.41

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/shinobi/api/shinobi_websocket.py", line 170, in parse_message
    message_parts = message.split("[")
TypeError: a bytes-like object is required, not 'str'

Here is the debug output from HA when starting:

2022-02-23 19:39:28 DEBUG (MainThread) [custom_components.shinobi] Starting async_setup_entry of shinobi
2022-02-23 19:39:28 DEBUG (MainThread) [custom_components.shinobi.managers.configuration_manager] get_basic_data, data: {'host': 'bogusurl.com', 'port': 80, 'ssl': False, 'username': 'myusername', 'password': 'myPassword', 'use_original_stream': False, 'path': ''}
2022-02-23 19:39:28 DEBUG (MainThread) [custom_components.shinobi.models.base_entity] Starting async_setup_entry binary_sensor
2022-02-23 19:39:28 DEBUG (MainThread) [custom_components.shinobi.models.base_entity] Starting async_setup_entry camera
2022-02-23 19:39:28 INFO (MainThread) [custom_components.shinobi.managers.home_assistant] Handling ConfigEntry change: {'entry_id': 'af27cb4413cb1b657eebb4e8ede19ed5', 'version': 1, 'domain': 'shinobi', 'title': 'Shinobi Video', 'data': {'host': 'bogusurl.com', 'port': 80, 'ssl': False, 'username': 'myusername', 'password': 'myPassword', 'use_original_stream': False, 'path': ''}, 'options': {}, 'pref_disable_new_entities': False, 'pref_disable_polling': False, 'source': 'user', 'unique_id': None, 'disabled_by': None}
2022-02-23 19:39:28 INFO (MainThread) [custom_components.shinobi.api.shinobi_api] Initializing Shinobi Video
2022-02-23 19:39:28 INFO (MainThread) [custom_components.shinobi.api.shinobi_api] Performing login
2022-02-23 19:39:28 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] POST http://bogusurl.com:80/?json=true
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Status of http://bogusurl.com:80/?json=true: 200
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Temporary auth token: tempToken
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] GET http://bogusurl.com:80/tempToken/api/Apj0a4QosV/list
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Status of http://bogusurl.com:80/tempToken/api/Apj0a4QosV/list: 200
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Permanent access token: randomToken
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.managers.home_assistant] Updating @2022-02-23 19:39:29.250540
2022-02-23 19:39:29 INFO (MainThread) [custom_components.shinobi.api.shinobi_api] Updating data from Shinobi Video Server (Shinobi Video)
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Retrieving camera list
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] GET http://bogusurl.com:80/randomToken/monitor/Apj0a4QosV
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_api] Status of http://bogusurl.com:80/randomToken/monitor/Apj0a4QosV: 200
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Initializing WS connection
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.managers.entity_manager] Setting entity: Shinobi Video Terrasse: {'id': 'cam01ID', 'unique-id': 'shinobi-camera-Shinobi Video Terrasse', 'name': 'Shinobi Video Terrasse', 'state': 'Watching', 'attributes': {'friendly_name': 'Shinobi Video Terrasse', 'stream_source': 'http://bogusurl.com:80/randomToken/hls/Apj0a4QosV/cam01ID/s.m3u8', 'still_image_url': 'http://bogusurl.com:80/randomToken/jpeg/Apj0a4QosV/cam01ID/s.jpg', 'Status': 'Watching', 'Mode': 'start', 'Type': 'h264', 'fps': '2'}, 'icon': 'mdi:alarm-light', 'device-name': 'Shinobi Video Terrasse (cam01ID)', 'entity-status': 'entity-status-created', 'binary-sensor-device-class': None, 'camera-details': {'name': 'Shinobi Video Terrasse', 'still_image_url': Template("http://bogusurl.com:80/randomToken/jpeg/Apj0a4QosV/cam01ID/s.jpg"), 'stream_source': 'http://bogusurl.com:80/randomToken/hls/Apj0a4QosV/cam01ID/s.m3u8', 'limit_refetch_to_url_change': False, 'framerate': 2, 'content_type': 'image/jpeg', 'verify_ssl': False, 'username': 'myusername', 'password': 'randompassword', 'authentication': 'basic', 'support_stream': False, 'motion_detection': True}, 'disabled': False}
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.managers.entity_manager] Setting entity: Shinobi Video Terrasse Motion: {'id': 'cam01ID', 'unique-id': 'shinobi-binary_sensor-Shinobi Video Terrasse Motion', 'name': 'Shinobi Video Terrasse Motion', 'state': 'off', 'attributes': {'friendly_name': 'Shinobi Video Terrasse Motion'}, 'icon': 'mdi:alarm-light', 'device-name': 'Shinobi Video Terrasse (cam01ID)', 'entity-status': 'entity-status-created', 'binary-sensor-device-class': <BinarySensorDeviceClass.MOTION: 'motion'>, 'camera-details': {}, 'disabled': False}
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.managers.entity_manager] Setting entity: Shinobi Video Hoveddor: {'id': 'cam02ID', 'unique-id': 'shinobi-camera-Shinobi Video Hoveddor', 'name': 'Shinobi Video Hoveddor', 'state': 'Watching', 'attributes': {'friendly_name': 'Shinobi Video Hoveddor', 'stream_source': 'http://bogusurl.com:80/randomToken/hls/Apj0a4QosV/cam02ID/s.m3u8', 'still_image_url': 'http://bogusurl.com:80/randomToken/jpeg/Apj0a4QosV/cam02ID/s.jpg', 'Status': 'Watching', 'Mode': 'start', 'Type': 'h264', 'fps': '2'}, 'icon': 'mdi:alarm-light', 'device-name': 'Shinobi Video Hoveddor (cam02ID)', 'entity-status': 'entity-status-created', 'binary-sensor-device-class': None, 'camera-details': {'name': 'Shinobi Video Hoveddor', 'still_image_url': Template("http://bogusurl.com:80/randomToken/jpeg/Apj0a4QosV/cam02ID/s.jpg"), 'stream_source': 'http://bogusurl.com:80/randomToken/hls/Apj0a4QosV/cam02ID/s.m3u8', 'limit_refetch_to_url_change': False, 'framerate': 2, 'content_type': 'image/jpeg', 'verify_ssl': False, 'username': 'myusername', 'password': 'randompassword', 'authentication': 'basic', 'support_stream': False, 'motion_detection': True}, 'disabled': False}
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.managers.entity_manager] Setting entity: Shinobi Video Hoveddor Motion: {'id': 'cam02ID', 'unique-id': 'shinobi-binary_sensor-Shinobi Video Hoveddor Motion', 'name': 'Shinobi Video Hoveddor Motion', 'state': 'off', 'attributes': {'friendly_name': 'Shinobi Video Hoveddor Motion'}, 'icon': 'mdi:alarm-light', 'device-name': 'Shinobi Video Hoveddor (cam02ID)', 'entity-status': 'entity-status-created', 'binary-sensor-device-class': <BinarySensorDeviceClass.MOTION: 'motion'>, 'camera-details': {}, 'disabled': False}
2022-02-23 19:39:29 INFO (MainThread) [custom_components.shinobi.api.shinobi_websocket] Starting to listen connected
2022-02-23 19:39:29 INFO (MainThread) [custom_components.shinobi.binary_sensor] Added new Shinobi Video Terrasse Motion
2022-02-23 19:39:29 INFO (MainThread) [custom_components.shinobi.binary_sensor] Added new Shinobi Video Hoveddor Motion
2022-02-23 19:39:29 INFO (MainThread) [custom_components.shinobi.camera] Added new Shinobi Video Terrasse
2022-02-23 19:39:29 INFO (MainThread) [custom_components.shinobi.camera] Added new Shinobi Video Hoveddor
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] No message handler available, Message: 0{"sid":"mySID","upgrades":[],"pingInterval":25000,"pingTimeout":5000}
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] WebSocket connection state changed to ready
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Sending message, Data: 42["f", {"auth": "randomToken", "f": "init", "ke": "Apj0a4QosV", "uid": "oYIdfXt0KY"}], Connected: True
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] WebSocket Connected
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Sending message, Data: 42["f", {"auth": "randomToken", "f": "monitor", "ff": "watch_on", "id": "cam01ID", "ke": "Apj0a4QosV", "uid": "oYIdfXt0KY"}], Connected: True
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Sending message, Data: 42["f", {"auth": "randomToken", "f": "monitor", "ff": "watch_on", "id": "cam02ID", "ke": "Apj0a4QosV", "uid": "oYIdfXt0KY"}], Connected: True
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: users_online
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: user_status_change
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: diskUsed
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: init_success
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: detector_plugged
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: monitor_snapshot
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: monitor_snapshot
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: monitor_watch_on
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: None
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: monitor_watch_on
2022-02-23 19:39:29 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: None
2022-02-23 19:39:30 DEBUG (MainThread) [custom_components.shinobi.api.shinobi_websocket] Payload received, Type: os

Any idea why I get this error?

BR

Invalid server details

Hello,

I can not connect to Shinobi server

I authorize API Key for 0.0.0.0 in Shinobi

In Home assistant :
I set Host as "http://192.168.xx.yy" ( with my local access )
Let default path to "/"
and port to "8080"

I try different versions of your integration V3.0.0 and the latest and always having same error
Here is the log in home assistant - it seems to be an usual error as I have seen several discussion about it in the list of issues.
I am newbie in Home assistant, and the "integration" in domoticz was working well previously for me to activate my cameras.


Logger: custom_components.shinobi.managers.rest_api
Source: custom_components/shinobi/managers/rest_api.py:157
Integration: Shinobi Video NVR (documentation, issues)
First occurred: 16:47:14 (12 occurrences)
Last logged: 17:09:01

Failed to post JSON to {base_url}?json=true, Error: Cannot connect to host http:80 ssl:False [Name has no usable address], Line: 233
Failed to login, Response is empty
Status changed from 'Establishing connection to API' to 'Failed to access API'

problem with initial config form

Hi,
image
i have this PATH field, but i do not find it in your documentation. Furthermore, at First i had so much errors, now, it loads for 30 minutes, and then nothing. in path, i put / . So i really don't know
Thanks for the work on this integration by the way, it seems to work for many.
Have a good day

Shinobi integration stops working after some time

Home Assistant 2022.11.5 Running in Docker. ha-shinobi v2.0.30

Have automations that key off of the motion binary sensors in shinobi. they'll work for a few hours and then stop responding.

Enabled debug logging and see this message repeatedly when the integration is not working:
2022-12-21 19:30:22.060 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second

Restarting the integration or HA revives it. Any ideas?

Various issues with creating the integration

Hello,

I'm trying to use the integration on a freshly installed shinobi.
Shinobi itself seems to work fine with my one camera, but I can't seem to get the integration in HA to work.

First of all: What is supposed to go into the "Path" configuration (I left it empty)?
Second: I cannot seem to find the logging options settings in the integration

Once I've created the integration, I get a couple of errors:

This error originated from a custom integration.

Logger: custom_components.shinobi.api.shinobi_api
Source: custom_components/shinobi/api/shinobi_api.py:213
Integration: Shinobi Video NVR (documentation, issues)
First occurred: 16:12:01 (11 occurrences)
Last logged: 16:16:33

Failed to get permanent API Key, please go to Shinobi Video Dashboard and add API for `[email protected]`

I have - however - created the API key for the user [email protected] in Shinobi (0.0.0.0 and everything else set to "yes")

Also, this one:

This error originated from a custom integration.

Logger: custom_components.shinobi.managers.home_assistant
Source: custom_components/shinobi/managers/home_assistant.py:257
Integration: Shinobi Video NVR (documentation, issues)
First occurred: 16:11:38 (6 occurrences)
Last logged: 16:20:30

Failed to async_update, Error: 'str' object has no attribute 'get', Line: 247

What am I doing wrong?

Regards,
SnakezZZ

No camera entinty added.

I installed this plugin today and connected to my Shinobi instance, it connected successfully but I don't get a camera entity or any video stream of any sort only binary sensors and switches.

2022-07-14_16-30
2022-07-14_16-31

Missing Binary Motion Sensors

Hello, I've had this plugin for a while but just started to seriously try and utilize it. I did a bunch of updates to HA and this plugin and configured my cameras in Shinobi to have different motion/quality settings and noticed that my binary sensors became invalid, and upon removing them and even removing the plugin and re-installing it I only see 2 entities and 2 devices (my actual 2 camera feeds).

What happened to the binary sensor for when there is motion? How can I get something to trigger an automation rule when Tensorflow detects a person in Shinobi? Thanks!

Motion detection stopped working since 3.x

HA doesn't detect motion events.

Just checked the previous version (v2.0.34), it works fine there. Updated again to 3.0.1 - stopped working. Shinobi server hasn't changed during the test.

Here's the log, but there's nothing interesting there unfortunately. Debug logging is enabled.

The loghome-assistant | 2023-08-01 00:43:49.354 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:50.025 DEBUG (MainThread) [custom_components.shinobi.managers.websockets] Sending message, Data: 42["pong", {"beat": 1}], Status: Connected to the API home-assistant | 2023-08-01 00:43:50.354 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:51.005 DEBUG (MainThread) [custom_components.shinobi.managers.websockets] Payload (42) received, Type: diskUsed home-assistant | 2023-08-01 00:43:51.038 DEBUG (MainThread) [custom_components.shinobi.managers.websockets] Payload (42) received, Type: diskUsed home-assistant | 2023-08-01 00:43:51.354 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:52.354 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:53.353 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:54.355 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:55.019 DEBUG (MainThread) [custom_components.shinobi.managers.websockets] Payload (42) received, Type: os home-assistant | 2023-08-01 00:43:55.353 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:56.355 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:57.355 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:58.025 DEBUG (MainThread) [custom_components.shinobi.managers.websockets] Sending message, Data: 42["pong", {"beat": 1}], Status: Connected to the API home-assistant | 2023-08-01 00:43:58.354 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:43:59.354 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:44:00.354 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:44:01.355 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:44:02.353 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:44:03.355 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:44:04.353 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True) home-assistant | 2023-08-01 00:44:05.018 DEBUG (MainThread) [custom_components.shinobi.managers.websockets] Payload (42) received, Type: os home-assistant | 2023-08-01 00:44:05.354 DEBUG (MainThread) [custom_components.shinobi.managers.coordinator] Finished fetching Shinobi Video data in 0.000 seconds (success: True)

HA version: Home Assistant 2023.7.3
Shinobi version: the latest dev branch with changes from this MR running in docker

User Input Malformed

Trying to setup the integration with Shinobi docked on unraid. When entering the details get "User input malformed". Does not provide any more details and cannot find anything in the logs. Any ideas?
image

ValueError: invalid literal for int() with base 10: ''

The plugin is not starting,
Home assistant logs this:

Logger: homeassistant
Source: custom_components/shinobi/models/camera_data.py:25
Integration: Shinobi Video NVR (documentation, issues)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/shinobi/managers/home_assistant.py", line 146, in _async_init
await self.async_update_entry()
File "/config/custom_components/shinobi/managers/home_assistant.py", line 180, in async_update_entry
await self.api.async_update()
File "/config/custom_components/shinobi/api/shinobi_api.py", line 161, in async_update
await self.load_camera()
File "/config/custom_components/shinobi/api/shinobi_api.py", line 240, in load_camera
camera = CameraData(monitor)
File "/config/custom_components/shinobi/models/camera_data.py", line 25, in init
self.fps = int(monitor_details.get(ATTR_CAMERA_DETAILS_FPS, "1"))
ValueError: invalid literal for int() with base 10: ''

It sounds like I am missing something in the camera configuration in Shinobi?
Please assist!

/Magnus

2.0.24: broken feeds

After the 2.0.24 update my browser console is showing 404 responses for both my monitor feeds.

YAML:

type: picture-elements
elements:
  - type: image
    entity: camera.shinobi_video_oprit
    camera_image: camera.shinobi_video_oprit
    camera_view: live

Reverting to 2.0.23 made them re-appear again.

Let me know if you want me to post more debugging info.

Path parameter causing issues

Hi,

I was trying to setup this integration and ran into the following error:

2021-07-09 21:22:52 ERROR (MainThread) [custom_components.shinobi.api.shinobi_api] Failed to post data to ?json=true, Error: 404, message='Not Found', url=URL('http://192.168.5.5:8080//?json=true'), Line: 115
2021-07-09 21:22:52 ERROR (MainThread) [custom_components.shinobi.api.shinobi_api] Failed to get permanent API Key, please go to Shinobi Video Dashboard and add API for `[email protected]`

Whenever I curl to the given address, I get a 404. Whenever I remove one of the slashes (http://192.168.5.5:8080/?json=true instead of http://192.168.5.5:8080//?json=true) I get valid response. However; I cannot leave the Path parameter empty, thus am unable to add this integration.

Looking forward to your advise.

Kind regards,
Rob

On initial Home Assistant start the "original stream" is loaded. After reloading the integration the Shinobi stream is used.

Issue explained

  1. Start Home Assistant
  2. Preview the video stream entities in Home Assistant and validate they are not the same as the streams show in Shinobi (assumption these are the "original streams" from the cameras)
  3. Go to Integrations and reload the Shinobi integration
  4. Preview the video stream entities in Home Assistant and validate they are now showing the same stream is in Shinobi

Assumption
My current assumption (and I didn't dive in code yet) - is that on original load of the Shinobi integration, the "use original stream" checkbox is checked by default.

After a reload of the integration, the checkbox is correct checked with the configuration and the correct streams load.

Expected behaviour
The correct streams get loaded on initial boot of Home Assistant

Thanks!

AUTH_TOKEN not correctly parsed

Hi,

currently installed plugin (v1.1.26) via HACS (1.24.5). Shinobi is also latest as of today (commit af37a5791f53fec4cd400e57b7eabda1bb0f951b)

With dashboard-v3 enabled, I have a problem that the login does not work properly. I see a problem where the AUTH_TOKEN is not properly parsed even though the login process is completed and the API key is send from shinobi. (checked via wireshark).

The bogus request ends up like this:
[Full request URI: http://shinobi.local:8080/%5BAUTH_TOKEN%5D/monitor/NmtVC6d4fr]

2022-05-16 08:54:42 ERROR (MainThread) [custom_components.shinobi.api.shinobi_api] Failed to get data from [AUTH_TOKEN]/api/[GROUP_ID]/list, Error: , Line: 141
2022-05-16 08:54:42 ERROR (MainThread) [custom_components.shinobi.api.shinobi_api] Failed to get permanent API Key, please go to Shinobi Video Dashboard and add API for `ksh@local`
2022-05-16 08:54:42 WARNING (MainThread) [custom_components.shinobi.managers.config_flow_manager] Failed to access Shinobi Video server (shinobi.local)
2022-05-16 08:54:42 WARNING (MainThread) [custom_components.shinobi.config_flow] Cannot complete login
2022-05-16 08:54:46 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/shinobi/api/shinobi_websocket.py", line 132, in async_send_heartbeat
    await self.send_ping_message()
  File "/home/homeassistant/.homeassistant/custom_components/shinobi/api/shinobi_websocket.py", line 323, in send_ping_message
    await self._ws.ping(SHINOBI_WS_PING_MESSAGE)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/client_ws.py", line 143, in ping
    await self._writer.ping(message)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/http_websocket.py", line 676, in ping
    await self._send_frame(message, WSMsgType.PING)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/http_websocket.py", line 646, in _send_frame
    self._write(header + mask + message)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/http_websocket.py", line 663, in _write
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

Audio on stream

Hi guys,

I'm wondering if there is anyway to get audio streaming directly on HA.

Audio is working fine on Shinobi UI. I tried with both codecs: aac / mp3. No audio.
I tried with different browser Brave/Chrome/Safari

Do you know if it's possible or have any suggestion?

Thank you!

Shinobi device keeps disappearing randomly.

I recently added the Shinobi home assistant integration it works. But it keeps appearing and disappearing randomly and sometimes disappears for quite some time.

2022-07-16_20-25
2022-07-16_20-26

Also there is some lag in stream it doesn't play smoothly and sometimes plays fast like the playback speed is set to 2x or something.

HomeAssistant log is showing errors

HomeAssistant logs keep showing errors. Shinobi Hub version is 79f60848a40766f53cb0a3944cecedaa0e0b0cbc . Shinobi was not restarted

2023-02-02 18:08:42.016 DEBUG (MainThread) [custom_components.shinobi.component.api.api] Updating data from Shinobi Video Server (10.0.0.10)
2023-02-02 18:08:42.016 DEBUG (MainThread) [custom_components.shinobi.component.api.api] Retrieving monitors
2023-02-02 18:08:42.016 DEBUG (MainThread) [custom_components.shinobi.component.api.api] GET http://10.0.0.10:8090/z3OA9d7FOExdaGjva7gjEEbbILUQ3A/monitor/Jr1ZGE7KEB
2023-02-02 18:08:42.021 DEBUG (MainThread) [custom_components.shinobi.component.api.api] Status of http://10.0.0.10:8090/z3OA9d7FOExdaGjva7gjEEbbILUQ3A/monitor/Jr1ZGE7KEB: 200
2023-02-02 18:08:42.777 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:43.778 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:44.778 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:45.779 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:46.780 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:47.782 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:48.783 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:49.784 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:50.785 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:51.785 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:52.787 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:53.787 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:54.788 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:55.789 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:56.790 INFO (MainThread) [custom_components.shinobi.component.api.websocket] Message queue is empty, will try to resample in a second
2023-02-02 18:08:57.023 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/shinobi/component/managers/home_assistant.py", line 61, in async_send_heartbeat
await self.ws.async_send_heartbeat()
File "/config/custom_components/shinobi/component/api/websocket.py", line 171, in async_send_heartbeat
await self._ws.ping(SHINOBI_WS_PING_MESSAGE)
File "/usr/lib/python3.10/site-packages/aiohttp/client_ws.py", line 143, in ping
await self._writer.ping(message)
File "/usr/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 676, in ping
await self._send_frame(message, WSMsgType.PING)
File "/usr/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 646, in _send_frame
self._write(header + mask + message)
File "/usr/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 663, in _write
raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

Latest home assistant update (2023.08.1) seems broken shinobi integration

Here the error log:

2023-08-03 12:12:10.546 ERROR (MainThread) [custom_components.shinobi] Failed to load Shinobi Video, error: , line: 34

2023-08-03 12:12:15.083 ERROR (MainThread) [homeassistant.helpers.integration_platform] Error processing platform shinobi.media_source

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/helpers/integration_platform.py", line 61, in _async_process_single_integration_platform_component

await integration_platform.process_platform(hass, component_name, platform)

File "/usr/src/homeassistant/homeassistant/components/media_source/__init__.py", line 92, in _process_media_source_platform

hass.data[DOMAIN][domain] = await platform.async_get_media_source(hass)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/config/custom_components/shinobi/media_source.py", line 48, in async_get_media_source

coordinator = hass.data[DOMAIN][entry.entry_id]

~~~~~~~~~^^^^^^^^

KeyError: 'shinobi'

Motion sensor is being created although it's not enabled

The description of this addon says:

Description
Integration with Shinobi Video NVR. Creates the following components:

Camera - per-camera defined.
Binary Sensors (MOTION, SOUND) - per-camera defined.

The result of adding 1 shinobi camera with your addon:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.