Core: Updater not working

Created on 5 Dec 2016  路  24Comments  路  Source: home-assistant/core

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version):
0.34.2

Python release (python3 --version):
3.4.3

Component/platform:
updater

Description of problem:
The updater component does not work, not showing badge in UI, no notifications either

Expected:

Problem-relevant configuration.yaml entries and steps to reproduce:

updater:

Additional info:
When requesting the url (https://updater.home-assistant.io/) using POSTMAN, I noticed the request still returns version 0.33.2.
Furthermore, when debugging (logging some stuff about the request inside the code), I noticed that it actually does not return any value, meaning the value for res(https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/updater.py#L145) gets set to null.
Using the info_object inside POSTMAN return status code 200, but with a body of null.

Not sure if the 2 are related.

If it helps, this is the info_object that gets send as JSON in the post request:

{
    "python_version": "3.4.3",
    "uuid": "705db8e8ed6e4b3aa9c114e5249cb2a6",
    "os_name": "Linux", 
    "version": "0.34.2", 
    "timezone": "Europe/Brussels", 
    "arch": "i686", 
    "distribution": "ubuntu", 
    "virtualenv": false, 
    "os_version": "14.04",
    "dev": false, 
    "docker": false
}

Most helpful comment

Pretty embarrassing but I wasn't correctly updating the version in the update infrastructure whenever a new Home Assistant release came out. That is now fixed and I fixed the system so I can't make the same error again. You should be seeing the proper version number shortly. There was also an SSL issue which I hope to fix shortly.

Closing for now, please reopen if you continue to see an old version after 6 hours from this comment.

All 24 comments

Not sure what contribution I can provide other than saying that this is happening to me as well. I can't say specifically when it stopped working but the last 2 major releases (0.34 and 0.33) have given me no notification days and weeks after they were released.

I've been seeing the same. I asked about it in the chatroom earlier today but had no takers. I don't know when I stopped seeing the notifications but I want to think it was almost as far back as 0.32 or even 0.30.

After I knew HA 34.2 and .3 were well and truly out I tried looking in at {{ states.updater.updater.state }} in dev tools but it was returning blank and {{ states.updater.updater }} gives None.

Looking at the code for updater.py, is there any way I can try to fire get_newest_version, check_newest_version or any of those manually from the dev tools in the web interface to see if the updater component is working at all? From the documentation it suggests the component only runs once daily when invoked like it is in the sample automation, but it doesn't say when - a specific time of day or delta from when HA is started. Can it be forced?

The last update notification I got was for 0.32.4

I also don't get any update notifications since the last two releases. The only hint I got from my logs was

16-12-07 20:57:00 homeassistant.components.updater: Got unexpected response: None

Interesting.. I had the same error today.

Dec 08 01:23:09 tchellopi hass[1034]: 16-12-08 01:23:09 ERROR (Thread-1) [homeassistant.components.updater] Got unexpected response: None

To troubleshoot it, I've added a few debug marks on the code and got this:

Code

    _LOGGER.debug("UPDATERD info_object: %s", info_object)
    res = None
    try:
        req = requests.post(UPDATER_URL, json=info_object, timeout=5)
        _LOGGER.debug("UPDATERD response1: %s", req)
        res = req.json()
        _LOGGER.debug("UPDATERD response2: %s", res)
        res = RESPONSE_SCHEMA(res)
        _LOGGER.debug("UPDATERD response3: %s", res)

        _LOGGER.info(("Submitted analytics to Home Assistant servers. "
                      "Information submitted includes %s"), info_object)
        return (res['version'], res['release-notes'])
    except requests.RequestException:
        _LOGGER.error("Could not contact Home Assistant Update to check "
                      "for updates")
        return None

    except ValueError:
        _LOGGER.error("Received invalid response from Home Assistant Update")
        return None
    except vol.Invalid:
        _LOGGER.error('Got unexpected response: %s', req.raw.getheaders())
        _LOGGER.error('Got unexpected response: %s', req.raw.data)
        _LOGGER.error('Got unexpected response: %s', res)
        return None

Result:

root@tchellopi:~# journalctl  -f | grep -i -e UPDATERD  -e updater
Dec 09 01:39:46 tchellopi hass[28880]: 16-12-09 01:39:46 INFO (MainThread) [homeassistant.loader] Loaded updater from custom_components.updater
Dec 09 01:41:45 tchellopi hass[28880]: 16-12-09 01:41:45 DEBUG (Thread-6) [custom_components.updater] UPDATERD info_object: {'os_name': 'Linux', 'timezone': 'America/New_York', 'uuid': 'f2a<REDACTED>385', 'distribution': 'raspbian', 'virtualenv': False, 'version': '0.34.2', 'python_version': '3.5.2', 'dev': False, 'arch': 'armv7l', 'docker': False, 'os_version': '8'}
Dec 09 01:41:47 tchellopi hass[28880]: 16-12-09 01:41:47 DEBUG (Thread-6) [custom_components.updater] UPDATERD response1: <Response [200]>
Dec 09 01:41:47 tchellopi hass[28880]: 16-12-09 01:41:47 DEBUG (Thread-6) [custom_components.updater] UPDATERD response2: None
Dec 09 01:41:47 tchellopi hass[28880]: 16-12-09 01:41:47 ERROR (Thread-6) [custom_components.updater] Got unexpected response: HTTPHeaderDict({'X-Cache': 'Miss from cloudfront', 'X-Amz-Cf-Id': 'QNZuXq-QPJcW1o03YutHlxcLrHj-1pS_vpo22SYPXVKMcOiVACHD3A==', 'Content-Length': '4', 'x-amzn-RequestId': '8e34bd6b-bdda-11e6-b600-b58f59fcadcd', 'X-Amzn-Trace-Id': 'Root=1-584a522a-817840b0bd01fd7bcae0eb91', 'Connection': 'keep-alive', 'Date': 'Fri, 09 Dec 2016 06:41:46 GMT', 'Via': '1.1 f4d64c05ae609f6aae2932e779b2944b.cloudfront.net (CloudFront)', 'Content-Type': 'application/json'})
Dec 09 01:41:47 tchellopi hass[28880]: 16-12-09 01:41:47 ERROR (Thread-6) [custom_components.updater] Got unexpected response: b''
Dec 09 01:41:47 tchellopi hass[28880]: 16-12-09 01:41:47 ERROR (Thread-6) [custom_components.updater] Got unexpected response: None

During my tests, I could (a few times, but not always) reproduce the problem.

In [19]: info_object
Out[19]: 
{'arch': 'armv7l',
 'dev': False,
 'distribution': 'raspbian',
 'docker': False,
 'os_name': 'Linux',
 'os_version': '8',
 'python_version': '3.5.2',
 'timezone': 'America/New_York',
 'uuid': 'f2a6de0aaaaaaaaa11178429cfbb221',
 'version': '0.34.2',
 'virtualenv': False}

In [20]: UPDATER_URL
Out[20]: 'https://updater.home-assistant.io/'

In [33]: req1 = requests.post(UPDATER_URL, json=info_object, timeout=5)

In [34]: req1.json()

## however it returned 200
In [35]: req1.status_code
Out[35]: 200

## Looking the headers for req1

In [37]: req1.headers
Out[37]: {'x-amzn-RequestId': '93fb8dbf-bddc-11e6-ac46-51bdaf8e4973', 
'Connection': 'keep-alive', 'X-Cache': 'Miss from cloudfront', '
X-Amzn-Trace-Id': 'Root=1-584a558f-e66ff602231200ff9092cb33', 
'Via': '1.1 e223f938e1f7716ebc7a1a8faefd0900.cloudfront.net (CloudFront)', 
'Date': 'Fri, 09 Dec 2016 06:56:15 GMT', 'Content-Type': 'application/json',
 'X-Amz-Cf-Id': 'b5tMZ23qa1PaVqasoukN_s6LIXtUngzROwBeU2x9dqPQu7OLBtwyzg==', 
'Content-Length': '4'}

### Now info_object empty
In [40]: req2 = requests.post(UPDATER_URL, json={}, timeout=5)

In [41]: req2.json()
Out[41]: 
{'release-notes': 'https://home-assistant.io/blog/2016/11/20/calendar-wink-thermostats-cisco-ios/#release-0334---november-24',
 'version': '0.33.2'}

It seems this problem is due its intermitentcy when calling requests.post(). Sometimes I can reproduce easily and other times it works fine.

Once we fix it, the second issue is the version that should return the latest one and not 0.33.2.

I'll dig into this a little bit more during the weekend.
mmello

Similar output via curl

$ curl -l -X POST -H "Content-Type: application/json"  -d '{"test" : "123"}' https://updater.home-assistant.io/ -v
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 52.84.76.143...
* TCP_NODELAY set
* Connected to updater.home-assistant.io (52.84.76.143) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* ALPN, server accepted to use http/1.1
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*   subject: CN=updater.home-assistant.io
*   start date: Oct 14 19:27:00 2016 GMT
*   expire date: Jan 12 19:27:00 2017 GMT
*   common name: updater.home-assistant.io
*   issuer: CN=Let's Encrypt Authority X3,O=Let's Encrypt,C=US
> POST / HTTP/1.1
> Host: updater.home-assistant.io
> User-Agent: curl/7.51.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 16
> 
* upload completely sent off: 16 out of 16 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 144
< Connection: keep-alive
< Date: Fri, 09 Dec 2016 07:22:19 GMT
< x-amzn-RequestId: 384a832f-bde0-11e6-80de-95fdd042bd87
< X-Amzn-Trace-Id: Root=1-584a5bab-b8d9912a3fda90046f9d6855
< X-Cache: Miss from cloudfront
< Via: 1.1 9bf9a747ded1d70487db032b402bbdd3.cloudfront.net (CloudFront)
< X-Amz-Cf-Id: MC5qRgLzPCToMlZwTWRPtnEPLmEJhfXoZoGZv3-mRHZf3TrUSw7wSQ==
< 
* Curl_http_done: called premature == 0
* Connection #0 to host updater.home-assistant.io left intact
{"version":"0.33.2","release-notes":"https://home-assistant.io/blog/2016/11/20/calendar-wink-thermostats-cisco-ios/#release-0334---november-24"}

@robbiet480, any insight on this?

Any updates? This hasn't been working since the new location features were added and nothing much has been said about it since. Could we at least revert to the original code until something is worked out?

Pretty embarrassing but I wasn't correctly updating the version in the update infrastructure whenever a new Home Assistant release came out. That is now fixed and I fixed the system so I can't make the same error again. You should be seeing the proper version number shortly. There was also an SSL issue which I hope to fix shortly.

Closing for now, please reopen if you continue to see an old version after 6 hours from this comment.

@robbiet480 good work!!! I' ve tried to reproduce the issue today and it worked as expected. I tried multiple times and it worked all the times!!! Thanks for your help on this!

Thanks for taking care of this Robbie!

I got the update notification from 0.36.1, but now, with 0.37 released, I don't get it again.
Logging the updater's request result shows me 0.36.1 is the latest version, I'll wait another day to check, otherwise I'll reopen if needed @robbiet480

same issue. updater not running!

Actually this was the correct behavior. Our new policy is to wait a few hours before announcing the new version via the updater component in case we have any major problems that pop up after release as we believe that a lot of users will update only when notified.

Updater component has now been updated.

I was thinking something along those lines, wanted to make sure it before I reopened without the need to ;)
Anyways, just got the notification so all's good :)

This seems to be happening again, the response from the curl command has the latest version as 0.39 instead of 0.39.1

It is still happening. I upgraded Home Assistant to the latest version (0.43.1) and according to hass --version it is still 0.43.1, however, on the front end, it is reporting back 0.39.3. It is a very odd occurrence indeed..

Is the updater still working for anyone? Mine seems to be broken

It's very hit or miss. I got a notification for 0.44 and 0.44.1, but then I didn't get notified again until 0.48. Haven't seen one for the 0.49 release.

I gave up on the updater after the changes were made to gather info - not because of privacy concerns but because it never worked consistently after that.

I use these command line sensors instead:

-  platform: command_line
   command: python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])"
   name: Current HA Version

-  platform: command_line
   command: "/srv/hass/hass_venv/bin/hass --version"
   name: Installed version

Hmm after I posted this I got a notification for 0.49.1. @rpitera do you have an automation for a change of state? If so can you share.

I never wrote one; I'm on the UI so often in testing and support that I just check it. But it wouldn't be hard to write.

I use this

sensor:
- platform: command_line
  name: Update
  command: pip3 list --outdated|grep homeassistant|awk '{print $3}'
  scan_interval: 1800

binary_sensor:
- platform: template
  sensors:
    update:
      entity_id: sensor.update, sensor.time
      device_class: connectivity
      value_template: >
        {{ states.sensor.update.state != '' and (as_timestamp(now())-as_timestamp(states.sensor.update.last_changed)) < 10 }}
      friendly_name: Update

# update beschikbaar
- alias: Notify update
  trigger:
  - platform: state
    entity_id: updater.updater
  - platform: state
    entity_id: binary_sensor.update
    to: 'on'
  action:
  - service: notify.user
    data_template:
      title: 'Home Assistant'
      message: 'update beschikbaar ({{ states.sensor.update.state }})'
Was this page helpful?
0 / 5 - 0 ratings

Related issues

neotrunks picture neotrunks  路  169Comments

Gio76 picture Gio76  路  223Comments

jeromelaban picture jeromelaban  路  123Comments

sagilo picture sagilo  路  130Comments

abouelric picture abouelric  路  165Comments