{"action":"created","issue":{"url":"https://api.github.com/repos/ggravlingen/pytradfri/issues/214","repository_url":"https://api.github.com/repos/ggravlingen/pytradfri","labels_url":"https://api.github.com/repos/ggravlingen/pytradfri/issues/214/labels{/name}","comments_url":"https://api.github.com/repos/ggravlingen/pytradfri/issues/214/comments","events_url":"https://api.github.com/repos/ggravlingen/pytradfri/issues/214/events","html_url":"https://github.com/ggravlingen/pytradfri/pull/214","id":391294372,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4ODU0ODA1","number":214,"title":"Observation reset","user":{"login":"alex3305","id":5155694,"node_id":"MDQ6VXNlcjUxNTU2OTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5155694?v=4","gravatar_id":"","url":"https://api.github.com/users/alex3305","html_url":"https://github.com/alex3305","followers_url":"https://api.github.com/users/alex3305/followers","following_url":"https://api.github.com/users/alex3305/following{/other_user}","gists_url":"https://api.github.com/users/alex3305/gists{/gist_id}","starred_url":"https://api.github.com/users/alex3305/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex3305/subscriptions","organizations_url":"https://api.github.com/users/alex3305/orgs","repos_url":"https://api.github.com/users/alex3305/repos","events_url":"https://api.github.com/users/alex3305/events{/privacy}","received_events_url":"https://api.github.com/users/alex3305/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-12-14T22:02:07Z","updated_at":"2018-12-17T21:12:20Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ggravlingen/pytradfri/pulls/214","html_url":"https://github.com/ggravlingen/pytradfri/pull/214","diff_url":"https://github.com/ggravlingen/pytradfri/pull/214.diff","patch_url":"https://github.com/ggravlingen/pytradfri/pull/214.patch"},"body":"This commit resets the observations when they hit a timeout, and also prevents duplicate state changes. Also observations are cancelled whenever possible instead of erroring out.\r\n\r\n 1. Whenever the light or socket already contains a specific state (ie. the light is on and is dimmed at 20%), and a change is requested, a filter will be applied and only the changed states will be send to the device.\r\n 2. Observations are reset whenever no state change was received for a limited amount of time. This is dependent on the first change, because Tradfri does not send a successful callback back to us, when no change was applied.\r\n 3. Cancelling observations instead of erroring out will create less error logging. There is still some error logging left, but this is because of the `aiocoap` library.\r\n\r\nThis was tested for more than a week on my own production installation and the first fix, makes the pytradfri lib about 4 times more stable for me. The second change resets the observations when something bad happens and works wonderfully for me.\r\n\r\nThere is still something odd happening with observation cancellation which must be errored out instead of cancelled, because otherwise no new observation will be launched by Home Assistant. This is because the `aiocoap` library does not report when a cancellation happened, but it does on errors.\r\n\r\nI and some others have tested these changes from: https://github.com/alex3305/hass-components debug and reception has generally been positive.\r\n\r\nReferences:\r\n * alex3305/hass-components-debug#3\r\n * home-assistant/home-assistant#9822\r\n * home-assistant/home-assistant#14386\r\n * cc. @mitsumaui, @morberg"},"comment":{"url":"https://api.github.com/repos/ggravlingen/pytradfri/issues/comments/448000526","html_url":"https://github.com/ggravlingen/pytradfri/pull/214#issuecomment-448000526","issue_url":"https://api.github.com/repos/ggravlingen/pytradfri/issues/214","id":448000526,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODAwMDUyNg==","user":{"login":"coveralls","id":2354108,"node_id":"MDQ6VXNlcjIzNTQxMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2354108?v=4","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2018-12-17T21:12:20Z","updated_at":"2018-12-17T21:12:20Z","author_association":"NONE","body":"\n[![Coverage Status](https://coveralls.io/builds/20682037/badge)](https://coveralls.io/builds/20682037)\n\nCoverage decreased (-1.6%) to 77.384% when pulling **b099b7a8b30041ef3403f349288b44bb14de139c on alex3305:observation-reset** into **685027bf18cbfe9ad79c64283fa6ea81abd5281b on ggravlingen:master**.\n"}}
{"actor":{"display_login":"coveralls"}}