home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.4k stars 30.3k forks source link

0.115 RISCO integration error while trying to disarm partition #40231

Closed majkers closed 4 years ago

majkers commented 4 years ago

The problem

After upgrading to HA 0.115 from 0.114.4 while trying to disarm one partition that is armed (via Risco cloud page) and entering PIN code I get an error

Environment

I am using HASSIO on RPi3

Problem-relevant configuration.yaml

Done via UI

Traceback/Error logs

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 137, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1315, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1350, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 459, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 655, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 490, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/risco/alarm_control_panel.py", line 144, in async_alarm_disarm
    await self._call_alarm_method("disarm")
  File "/usr/src/homeassistant/homeassistant/components/risco/alarm_control_panel.py", line 178, in _call_alarm_method
    alarm = await getattr(self._risco, method)(self._partition_id, *args)
  File "/usr/local/lib/python3.8/site-packages/pyrisco/risco.py", line 337, in disarm
    return Alarm(await self._site_post(CONTROL_URL, body))
  File "/usr/local/lib/python3.8/site-packages/pyrisco/risco.py", line 264, in _site_post
    return await self._authenticated_post(site_url, site_body)
  File "/usr/local/lib/python3.8/site-packages/pyrisco/risco.py", line 251, in _authenticated_post
    raise OperationError(str(json))
pyrisco.risco.OperationError: {'result': 52, 'validationErrors': None, 'errorText': None, 'errorTextCodeID': '0', 'status': 200, 'response': {'partitions': None, 'systemStatus': 2, 'systemReady': False, 'trouble': False, 'bellStatus': 0, 'alarmPending': False, 'batteryLow': False, 'acLost': False, 'haEnabled': False, 'bellOn': False, 'zones': None, 'haDevices': None, 'users': None, 'devCollection': None, 'exitDelayTimeout': 0, 'armNotAllowed': False, 'disarmNotAllowed': False, 'cpTime': '2020-09-18T09:11:25.8136935+00:00', 'partReadySupported': False, 'partFullReady': False, 'part1Ready': False, 'part2Ready': False, 'type': 5}}

Additional information

Armin and disarming partition via HA works just fine although if I enter wrong PIN and use glance card I don't get any error...

springstan commented 4 years ago

Please fill out the issue template, you can find it by clicking on New Issue and then selecting Report a bug with Home Assistant. Copy and paste the provided template into this already created issue, click preview to take a look at the empty template and then fill out as much as you can. Any additional information can be helpful!

Thanks for understanding :)

majkers commented 4 years ago

Done

probot-home-assistant[bot] commented 4 years ago

Hey there @onfreund, mind taking a look at this issue as its been labeled with an integration (risco) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

pergolafabio commented 4 years ago

hi, this is an duplicate , already created this issue

https://github.com/home-assistant/core/issues/40217

majkers commented 4 years ago

R u sure that is the same? according to log it is not. I' d rather @OnFreund judge that.

pergolafabio commented 4 years ago

Yes , seems log is different when reading/writing state, I updated mine also, you can close this one

pergolafabio commented 4 years ago

Sorry, you are right, it's indeed different, sorry for confusion

OnFreund commented 4 years ago

This error is returned directly from Risco. My guess is it's a permission issue. Risco is very picky about users working concurrently , especially with different permissions. Are you also using the app/website? Also try to see if you disconnect from everything (especially the MQTT version if you had it running), give it an hour (at least 1 full hour), and then try again.

majkers commented 4 years ago

Yes. I arm it with system owner user from risco cloud and I have a separate user created for HA integration. That might be the case... Sometimes I get an error that I can not arm/disarm it from risco cloud when it was armed/disarmed in HA..

OnFreund commented 4 years ago

My recommendation is to also create a separate non-owner user to use with Risco cloud. Keep your owner user for when you need to make changes to users, etc...

majkers commented 4 years ago

Yeah that's it. I've just armed one partition from HA with simple user and could not disarm it from risco app where I have system owner logged in with info that other session is open and that operation can not be done with 2 different users with different permission level. Anything that can be done in HA besides creating separate non owner user for risco app?

OnFreund commented 4 years ago

My recommendation is to also create a separate non-owner user to use with Risco cloud. Keep your owner user for when you need to make changes to users, etc...

majkers commented 4 years ago

OK. I close it for now

pergolafabio commented 4 years ago

maybe better to put this in documentation?

majkers commented 4 years ago

BTW it is strange that system owner can not disarm/arm when it was set by "simple" user

OnFreund commented 4 years ago

@pergolafabio that's a good idea. Can you change the documentation? (really easy, and can be done directly from github - no need to setup a development environment).

@majkers I agree, but unfortunately that's how Risco works šŸ¤·ā€ā™‚ļø

pergolafabio commented 4 years ago

done

lets see, what happens, never did a PR before šŸ‘

https://github.com/home-assistant/home-assistant.io/pull/14551