Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue arming and disarming panel from Home Assistant #36

Closed
ratsputin opened this issue May 9, 2019 · 13 comments
Closed

Issue arming and disarming panel from Home Assistant #36

ratsputin opened this issue May 9, 2019 · 13 comments

Comments

@ratsputin
Copy link

I posted this issue over in Home Assistant and it was suggested this may be an issue with the total connect client. I think this was working correctly in the home assistant v80-v89, but it seems it broke around v90 (I didn't previously use this very much).

If I attempt to make a call to arm the panel from the UI or from an HA service call, I get the following error:

2019-05-09 13:56:28 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140169950116944] Could not disarm system
Traceback (most recent call last):
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call
    self._execute_service(handler, service_call))
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
    await handler.func(service_call)
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 194, in handle_service
    required_features
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/service.py", line 316, in entity_service_call
    future.result()  # pop exception if have
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/components/totalconnect/alarm_control_panel.py", line 91, in alarm_arm_home
    self._client.arm_stay()
  File "/srv/homeassistant/lib64/python3.6/site-packages/total_connect_client/TotalConnectClient.py", line 121, in arm_stay
    self.arm(ARM_TYPE_STAY, location_name)
  File "/srv/homeassistant/lib64/python3.6/site-packages/total_connect_client/TotalConnectClient.py", line 155, in arm
    raise Exception('Could not disarm system')
Exception: Could not disarm system

The suggestion was made that I run test.py; here are the results from that run:

--- all location/system data ---
OrderedDict([('LocationID', *******),
             ('LocationName', 'Home'),
             ('PhotoURL', None),
             ('LocationModuleFlags',
              'Security=1,Video=0,Automation=0,GPS=0,VideoPIR=0,TimeTriggeredEvent=0,TemperatureUnits=F,ConfigureContent=0,SyncLocation=0,ConfigureSlideshow=0,TimezoneOffset=-5.0,SmartAction=0,CustomArm=0,NoTriggerScene=0,NoScene=0,AutoSyncEnabled=0,WiFIThermostatEnabled=1,SupportsOnlyHDPhotos=0,SyncStatusSupported=1,WiFiHBSupported=1,DoorBellSupported=0,masterUserCodeSync=0,GeofenceStatus=3,RSISupported=0,VideoServiceEnabled=0,HasAddressUpdated=1,WifiGaragedoorSupported=0,OutboundServiceEnabled=0,HasSmartScenes=0,MotionViewerServiceEnabled=0'),
             ('SecurityDeviceID', *******),
             ('DeviceList',
              OrderedDict([('DeviceInfoBasic',
                            [OrderedDict([('DeviceID', *******),
                                          ('DeviceName', 'Security Panel'),
                                          ('DeviceClassID', 1),
                                          ('DeviceSerialNumber',
                                           '************'),
                                          ('DeviceFlags',
                                           'PromptForUserCode=1,PromptForInstallerCode=0,PromptForImportSecuritySettings=0,AllowUserSlotEditing=0,CalCapable=1,CanBeSentToPanel=0,CanArmNightStay=0,CanSupportMultiPartition=0,PartitionCount=0,MaxPartitionCount=3,OnBoardingSupport=0,PartitionAdded=0,DuplicateUserSyncStatus=0,PanelType=2,PanelVariant=1,BLEDisarmCapable=0,ArmHomeSupported=0,DuplicateUserCodeCheck=0,CanSupportRapid=0,IsKeypadSupported=1,WifiEnrollmentSupported=0,IsConnectedPanel=0,ArmNightInSceneSupported=0'),
                                          ('SecurityPanelTypeID', None)])])]))])




--- panel meta data ---
{
    'ResultCode': 0,
    'ResultData': 'Success',
    'PanelMetadataAndStatus': {
        'Partitions': {
            'PartitionInfo': [
                {
                    'PartitionID': 1,
                    'ArmingState': 10200,
                    'IsAlarmResponded': False
                }
            ]
        },
        'Zones': {
            'ZoneInfo': [
                {
                    'ZoneID': 1,
                    'ZoneDescription': '',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 2,
                    'ZoneDescription': 'MASTER BATHROOM MOTION',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 3,
                    'ZoneDescription': 'LIVING ROOM MOTION',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 4,
                    'ZoneDescription': 'FOYER MOTION',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 5,
                    'ZoneDescription': 'GARAGE EXIT MOTION',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 6,
                    'ZoneDescription': 'RECREATION MOTION',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 7,
                    'ZoneDescription': '',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 8,
                    'ZoneDescription': '',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 9,
                    'ZoneDescription': 'DINING WINDOW 1',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 10,
                    'ZoneDescription': 'DINING WINDOW 2',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 11,
                    'ZoneDescription': 'KITCHEN WINDOW 1',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 12,
                    'ZoneDescription': 'KITCHEN WINDOW 2',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 13,
                    'ZoneDescription': 'KITCHEN WINDOW 3',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 14,
                    'ZoneDescription': 'LIVING WINDOW 1',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 15,
                    'ZoneDescription': 'LIVING WINDOW 2',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 16,
                    'ZoneDescription': 'LIVING WINDOW 3',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 17,
                    'ZoneDescription': 'LIVING WINDOW 4',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 18,
                    'ZoneDescription': 'LIVING WINDOW 5',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 19,
                    'ZoneDescription': 'CLOSET WINDOW',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 20,
                    'ZoneDescription': 'MASTER WINDOW 1',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 21,
                    'ZoneDescription': 'MASTER WINDOW 2',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 22,
                    'ZoneDescription': 'MASTER WINDOW 3',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 23,
                    'ZoneDescription': 'STUDY WINDOW 1',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 24,
                    'ZoneDescription': 'STUDY WINDOW 2',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 25,
                    'ZoneDescription': 'STUDY WINDOW 3',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 26,
                    'ZoneDescription': 'FRONT DOOR',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 27,
                    'ZoneDescription': 'GARAGE EXIT DOOR',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 28,
                    'ZoneDescription': 'LAUNDRY DOOR',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 29,
                    'ZoneDescription': 'BREAKFAST ROOM DOOR',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 30,
                    'ZoneDescription': 'LIVING ROOM DOOR',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                },
                {
                    'ZoneID': 31,
                    'ZoneDescription': 'MASTER BATHROOM DOOR',
                    'ZoneStatus': 0,
                    'PartitionID': 1
                }
            ]
        },
        'PromptForImportSecuritySettings': False,
        'LastUpdatedTimestampTicks': 636929947420000000,
        'ConfigurationSequenceNumber': 4,
        'IsInACLoss': False,
        'IsInLowBattery': False
    }
}




--- Devices name(s) ---
Security Panel
--- Device Status ---
Low Battery: False
AC Loss: False

I have a Vista-21IP panel and the Total Connect 2.0 client works fine. Do you think this is an issue with this client or HA calling it?

I should note that communications are just fine. HA always accurately knows the state of the panel and responds appropriately. It just can't arm the panel.

@austinmroczek
Copy link
Collaborator

Please change line 155 in TotalConnectClient.py to
raise Exception('Could not disarm system. Total Connect returned code %s.', response.ResultCode)
and post what result code it's giving

@austinmroczek
Copy link
Collaborator

That should be all one line of code

@ratsputin
Copy link
Author

I apologize for the slow response. I was having some difficulty with it initially for some reason (it wasn't displaying the response code). It worked this time.

May 13 15:33:33 hass scl: 2019-05-13 15:33:33 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140627502424752] ('Could not disarm system.  Total Connect returned code %s.', -4114)
May 13 15:33:33 hass scl: Traceback (most recent call last):
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
May 13 15:33:33 hass scl: connection.context(msg))
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call
May 13 15:33:33 hass scl: self._execute_service(handler, service_call))
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
May 13 15:33:33 hass scl: await handler.func(service_call)
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 194, in handle_service
May 13 15:33:33 hass scl: required_features
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/service.py", line 316, in entity_service_call
May 13 15:33:33 hass scl: future.result()  # pop exception if have
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call
May 13 15:33:33 hass scl: await getattr(entity, func)(**data)
May 13 15:33:33 hass scl: File "/opt/rh/rh-python36/root/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
May 13 15:33:33 hass scl: result = self.fn(*self.args, **self.kwargs)
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/components/totalconnect/alarm_control_panel.py", line 91, in alarm_arm_home
May 13 15:33:33 hass scl: self._client.arm_stay()
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/total_connect_client/TotalConnectClient.py", line 121, in arm_stay
May 13 15:33:33 hass scl: self.arm(ARM_TYPE_STAY, location_name)
May 13 15:33:33 hass scl: File "/srv/homeassistant/lib64/python3.6/site-packages/total_connect_client/TotalConnectClient.py", line 155, in arm
May 13 15:33:33 hass scl: raise Exception('Could not disarm system.  Total Connect returned code %s.', response.ResultCode)
May 13 15:33:33 hass scl: Exception: ('Could not disarm system.  Total Connect returned code %s.', -4114)

@ratsputin
Copy link
Author

I just realized I posted that from /var/log/messages. Here is the result from home-assistant.log (a bit cleaner):

2019-05-13 15:33:33 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140627502424752] ('Could not disarm system.  Total Connect returned code %s.', -4114)
Traceback (most recent call last):
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call
    self._execute_service(handler, service_call))
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
    await handler.func(service_call)
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 194, in handle_service
    required_features
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/service.py", line 316, in entity_service_call
    future.result()  # pop exception if have
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/components/totalconnect/alarm_control_panel.py", line 91, in alarm_arm_home
    self._client.arm_stay()
  File "/srv/homeassistant/lib64/python3.6/site-packages/total_connect_client/TotalConnectClient.py", line 121, in arm_stay
    self.arm(ARM_TYPE_STAY, location_name)
  File "/srv/homeassistant/lib64/python3.6/site-packages/total_connect_client/TotalConnectClient.py", line 155, in arm
    raise Exception('Could not disarm system.  Total Connect returned code %s.', response.ResultCode)
Exception: ('Could not disarm system.  Total Connect returned code %s.', -4114)

@uchagani
Copy link
Collaborator

@ratsputin do you have a lyric controller security panel?

@ratsputin
Copy link
Author

@uchagani Nope. It's a Vista-21IP with cellular and Internet access. I believe this used to work in the 0.8x versions of Home Assistant.

@austinmroczek
Copy link
Collaborator

The response -4114 is not covered by our current code, so @ratsputin is hitting the Exception at line 155.

@austinmroczek
Copy link
Collaborator

@ratsputin please try one more time for me. Change line 155 to the below and try again.

raise Exception('Could not disarm system. ResultCode: ' + str(response.ResultCode) + '. ResultData: ' + str(response.ResultData))

The ResultData is essentially an error message coming from Total Connect. It will hopefully explain what -4114 means.

@ratsputin
Copy link
Author

@austinmroczek Thank you so much for following up on this. I think this is going to clarify the issue:

2019-05-18 16:49:51 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139690843558128] Could not disarm system. ResultCode: -4114. ResultData: System User Code not available/invalid in Database
Traceback (most recent call last):
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call
    self._execute_service(handler, service_call))
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
    await handler.func(service_call)
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 194, in handle_service
    required_features
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/service.py", line 316, in entity_service_call
    future.result()  # pop exception if have
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib64/python3.6/site-packages/homeassistant/components/totalconnect/alarm_control_panel.py", line 91, in alarm_arm_home
    self._client.arm_stay()
  File "/srv/homeassistant/lib64/python3.6/site-packages/total_connect_client/TotalConnectClient.py", line 121, in arm_stay
    self.arm(ARM_TYPE_STAY, location_name)
  File "/srv/homeassistant/lib64/python3.6/site-packages/total_connect_client/TotalConnectClient.py", line 155, in arm
    raise Exception('Could not disarm system. ResultCode: ' + str(response.ResultCode) + '. ResultData: ' + str(response.ResultData))
Exception: Could not disarm system. ResultCode: -4114. ResultData: System User Code not available/invalid in Database

So, that actually gave me something to go from. I just checked my TC 2.0 app and it was set to prompt me for my User ID. I disabled that and it seems to be working better, although interestingly that didn't affect how the app behaves on the phone--it still prompts me.

I need to do some further testing as there appears to be a communication problem with my panel; however, it looks like this may have been the root cause of the issue. I can't really test this further until I address the comm problem but I am no longer getting the -4114 error since I disabled prompting in my profile.

@ratsputin
Copy link
Author

Okay, I straightened out the communication problem with my panel. It turned out to be a bad Ethernet cable. Things are working much better now.

I did some further troubleshooting and am able to reliably reproduce (and eliminate) the -4114 result code. It appears to be the result of the profile setting "Prompt for user code" in the TC 2.0 app on the "My Profile" page. If I turn that field on and save my profile, attempting to arm (or disarm) the panel from Home Assistant will give the -4114 error. Turning it back off makes the error go away.

Thank you so much for working with me on this. I don't know if you plan to make a code change and need my assistance testing or not. I'll leave this open if you do, otherwise, feel free to close this ticket.

Kind regards,

Brett

@uchagani
Copy link
Collaborator

uchagani commented May 18, 2019 via email

@ratsputin
Copy link
Author

I don't recall explicitly setting it to prompt so I'm guessing this was a feature added to the TC 2.0 client sometime in the last 3-4 months. That would have been the last time I tried (and succeeded) arming the system from HA.

austinmroczek added a commit to austinmroczek/total-connect-client that referenced this issue May 19, 2019
@austinmroczek
Copy link
Collaborator

#39 will help us diagnose similar issues more quickly in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants