Hi there,
I am currently in the middle of switching over from FHEM to Home Assistant and currently working on “porting” my Harmony Hub related automations.
I have a few automations that react on certain activities being started on the hub and I notice that in HA there is a noticable delay of around 14 seconds before the trigger (new activity) is recognized.
I looked into the log (attached below) and saw, that immediately after starting the activity via the Harmony remote [2020-05-05 16:01:18]
, there is action registered by HA and written to the log, but only after said 14 seconds at [2020-05-05 16:01:32]
, the activity is noted as changed.
Would it be possible to trigger on that earlier event somehow?
In FHEM the harmony state would first change to “starting ActivityX” immediately after pressing the Harmony remote and then to “ActivityX” after a while (probably those 14 seconds). So I would always trigger on the “starting *” state to be early in the game. But I guess to make these intermediate states available to HA would require work on aioharmony module, right?
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.hubconnector] 192.168.178.42: Response payload: {"type":"control.button?pressType","data":{"type":"short"}}
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.responsehandler] Message received: {'type': 'control.button?pressType', 'data': {'type': 'short'}}
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.responsehandler] No match for handler Activity_Changed
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.responsehandler] No match for handler Notification_Received
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.responsehandler] Checking for expired handlers
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.hubconnector] 192.168.178.42: Response payload: {"type":"connect.stateDigest?notify","data":{"sleepTimerId":-1,"runningZoneList":[],"discoveryServerCF":"https:\/\/cf-svcs.myharmony.com\/Discovery\/Discovery.svc","activityId":"38774311","syncStatus":0,"time":1588678861,"stateVersion":445,"tzOffset":"7200","mode":3,"contentVersion":92,"hubSwVersion":"4.15.264","deviceSetupState":[],"tzoffset":"7200","isSetupComplete":true,"sequence":false,"configVersion":320,"discoveryServer":"http:\/\/svcs.myharmony.com\/Discovery\/Discovery.svc","activitySetupState":false,"activityStatus":1,"wifiStatus":1,"tz":"CET-1CEST,M3.4.0,M10.4.0\/3","runningActivityList":"","IPIRConversionDate":"2019-06-23T17:58:50.299Z","hubUpdate":false,"updates":{"97":"4.13.100"},"accountId":"xxxxxxx"}}
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.responsehandler] Message received: {'type': 'connect.stateDigest?notify', 'data': {'sleepTimerId': -1, 'runningZoneList': [], 'discoveryServerCF': 'https://cf-svcs.myharmony.com/Discovery/Discovery.svc', 'activityId': '38774311', 'syncStatus': 0, 'time': 1588678861, 'stateVersion': 445, 'tzOffset': '7200', 'mode': 3, 'contentVersion': 92, 'hubSwVersion': '4.15.264', 'deviceSetupState': [], 'tzoffset': '7200', 'isSetupComplete': True, 'sequence': False, 'configVersion': 320, 'discoveryServer': 'http://svcs.myharmony.com/Discovery/Discovery.svc', 'activitySetupState': False, 'activityStatus': 1, 'wifiStatus': 1, 'tz': 'CET-1CEST,M3.4.0,M10.4.0/3', 'runningActivityList': '', 'IPIRConversionDate': '2019-06-23T17:58:50.299Z', 'hubUpdate': False, 'updates': {'97': '4.13.100'}, 'accountId': 'xxxxxxx'}}
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.responsehandler] No match for handler Activity_Changed
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.responsehandler] Match for Notification_Received
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.helpers] Scheduling coroutine Notification_Received with UUID 37b0f8d3-ff0e-494c-be43-26be55f7adb7
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.responsehandler] Checking for expired handlers
2020-05-05 16:01:18 DEBUG (MainThread) [aioharmony.harmonyclient] 192.168.178.42: Notification was received
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.hubconnector] 192.168.178.42: Response payload: {"type":"connect.stateDigest?notify","data":{"sleepTimerId":-1,"runningZoneList":[],"discoveryServerCF":"https:\/\/cf-svcs.myharmony.com\/Discovery\/Discovery.svc","activityId":"38774311","syncStatus":0,"time":1588678861,"stateVersion":446,"tzOffset":"7200","mode":3,"contentVersion":92,"hubSwVersion":"4.15.264","deviceSetupState":[],"tzoffset":"7200","isSetupComplete":true,"sequence":false,"configVersion":320,"discoveryServer":"http:\/\/svcs.myharmony.com\/Discovery\/Discovery.svc","activitySetupState":false,"activityStatus":2,"wifiStatus":1,"tz":"CET-1CEST,M3.4.0,M10.4.0\/3","runningActivityList":"","IPIRConversionDate":"2019-06-23T17:58:50.299Z","hubUpdate":false,"updates":{"97":"4.13.100"},"accountId":"xxxxxxx"}}
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Message received: {'type': 'connect.stateDigest?notify', 'data': {'sleepTimerId': -1, 'runningZoneList': [], 'discoveryServerCF': 'https://cf-svcs.myharmony.com/Discovery/Discovery.svc', 'activityId': '38774311', 'syncStatus': 0, 'time': 1588678861, 'stateVersion': 446, 'tzOffset': '7200', 'mode': 3, 'contentVersion': 92, 'hubSwVersion': '4.15.264', 'deviceSetupState': [], 'tzoffset': '7200', 'isSetupComplete': True, 'sequence': False, 'configVersion': 320, 'discoveryServer': 'http://svcs.myharmony.com/Discovery/Discovery.svc', 'activitySetupState': False, 'activityStatus': 2, 'wifiStatus': 1, 'tz': 'CET-1CEST,M3.4.0,M10.4.0/3', 'runningActivityList': '', 'IPIRConversionDate': '2019-06-23T17:58:50.299Z', 'hubUpdate': False, 'updates': {'97': '4.13.100'}, 'accountId': 'xxxxxxx'}}
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] No match for handler Activity_Changed
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Match for Notification_Received
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.helpers] Scheduling coroutine Notification_Received with UUID 37b0f8d3-ff0e-494c-be43-26be55f7adb7
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Checking for expired handlers
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.harmonyclient] 192.168.178.42: Notification was received
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.hubconnector] 192.168.178.42: Response payload: {"type":"harmony.engine?startActivityFinished","data":{"activityId":"38774311","errorCode":"200","errorString":"OK"}}
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Message received: {'type': 'harmony.engine?startActivityFinished', 'data': {'activityId': '38774311', 'errorCode': '200', 'errorString': 'OK'}}
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Match for Activity_Changed
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] No match for handler Notification_Received
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.helpers] Scheduling coroutine Activity_Changed with UUID fddda0e0-4eb7-4a97-bd1c-684d0cccaa65
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Checking for expired handlers
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.harmonyclient] 192.168.178.42: New activity was started
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.harmonyclient] 192.168.178.42: New activity: AndroidTV(38774311)
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.helpers] Calling callback new_activity_callback with UUID 192.168.178.42
2020-05-05 16:01:32 DEBUG (MainThread) [homeassistant.components.harmony.remote] Harmony: activity reported as: AndroidTV
2020-05-05 16:01:32 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=remote.harmony, old_state=<state remote.harmony=off; current_activity=PowerOff, friendly_name=Harmony, supported_features=0 @ 2020-05-05T16:00:39.249069+02:00>, new_state=<state remote.harmony=on; current_activity=AndroidTV, friendly_name=Harmony, supported_features=0 @ 2020-05-05T16:01:32.844119+02:00>>
2020-05-05 16:01:32 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.34642463696] Sending {'id': 2, 'type': 'event', 'event': <Event state_changed[L]: entity_id=remote.harmony, old_state=<state remote.harmony=off; current_activity=PowerOff, friendly_name=Harmony, supported_features=0 @ 2020-05-05T16:00:39.249069+02:00>, new_state=<state remote.harmony=on; current_activity=AndroidTV, friendly_name=Harmony, supported_features=0 @ 2020-05-05T16:01:32.844119+02:00>>}
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.hubconnector] 192.168.178.42: Response payload: {"type":"connect.stateDigest?notify","data":{"sleepTimerId":-1,"runningZoneList":[],"discoveryServerCF":"https:\/\/cf-svcs.myharmony.com\/Discovery\/Discovery.svc","activityId":"38774311","syncStatus":0,"time":1588678861,"stateVersion":447,"tzOffset":"7200","mode":3,"contentVersion":92,"hubSwVersion":"4.15.264","deviceSetupState":[],"tzoffset":"7200","isSetupComplete":true,"sequence":false,"configVersion":320,"discoveryServer":"http:\/\/svcs.myharmony.com\/Discovery\/Discovery.svc","activitySetupState":false,"activityStatus":2,"wifiStatus":1,"tz":"CET-1CEST,M3.4.0,M10.4.0\/3","runningActivityList":"38774311","IPIRConversionDate":"2019-06-23T17:58:50.299Z","hubUpdate":false,"updates":{"97":"4.13.100"},"accountId":"xxxxxxx"}}
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Message received: {'type': 'connect.stateDigest?notify', 'data': {'sleepTimerId': -1, 'runningZoneList': [], 'discoveryServerCF': 'https://cf-svcs.myharmony.com/Discovery/Discovery.svc', 'activityId': '38774311', 'syncStatus': 0, 'time': 1588678861, 'stateVersion': 447, 'tzOffset': '7200', 'mode': 3, 'contentVersion': 92, 'hubSwVersion': '4.15.264', 'deviceSetupState': [], 'tzoffset': '7200', 'isSetupComplete': True, 'sequence': False, 'configVersion': 320, 'discoveryServer': 'http://svcs.myharmony.com/Discovery/Discovery.svc', 'activitySetupState': False, 'activityStatus': 2, 'wifiStatus': 1, 'tz': 'CET-1CEST,M3.4.0,M10.4.0/3', 'runningActivityList': '38774311', 'IPIRConversionDate': '2019-06-23T17:58:50.299Z', 'hubUpdate': False, 'updates': {'97': '4.13.100'}, 'accountId': 'xxxxxxx'}}
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] No match for handler Activity_Changed
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Match for Notification_Received
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.helpers] Scheduling coroutine Notification_Received with UUID 37b0f8d3-ff0e-494c-be43-26be55f7adb7
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.responsehandler] Checking for expired handlers
2020-05-05 16:01:32 DEBUG (MainThread) [aioharmony.harmonyclient] 192.168.178.42: Notification was received