nebulous / infinitude

Open control of Carrier/Bryant thermostats
MIT License
225 stars 50 forks source link

Weather does not work on current versions #103

Closed bdf0506 closed 4 years ago

bdf0506 commented 4 years ago

At some point, weather support was likely unintentionally dropped. Weather Underground pulled a bad move and closed down their API. That's fine, but we should resort back to the passthrough capabilities.

It looks like we are still getting a weather forecast, however, on the thermostat itself, I do not see the weather actually being displayed. Looks like it broke starting with the following commit https://github.com/nebulous/infinitude/commit/dee2e948306410442cbe20457c8be53c0b50a5a8

I can look at the file structure on my infinitude, and I do see that I have the following files created, so weather is still being pulled, but not displayed on the unit (xxxxx is my zip code):

root@c7fe3a759c10:/infinitude/state# pwd
/infinitude/state
root@c7fe3a759c10:/infinitude/state# ls -l | grep weather
-rw-r--r-- 1 root root   466 Jun 29 21:18 req-weather-xxxxx-forecast+2etxt.dat
-rw-r--r-- 1 root root  2083 Jun 29 21:18 res-weather-xxxxx-forecast+2etxt.dat
-rw-r--r-- 1 root root  1703 Jun 29 21:18 weather-xxxxx-forecast+2exml.dat
-rw-r--r-- 1 root root    29 Jun 29 21:18 weather-xxxxx-forecast.dat
root@c7fe3a759c10:/infinitude/state# 

There's a forecast in the data, such as in weather-xxxxx-forecast+2exml.dat:

root@c7fe3a759c10:/infinitude/state# cat weather-xxxxx-forecast+2exml.dat
¤Zú^ÿÿÿÿÿÿÿÿ<weather_forecast version="1.48" xmlns:atom="http://www.w3.org/2005/Atom"><atom:link rel="self" href="https://wa-ing-api.azurewebsites.net/weather/xxxxx/forecast"/><atom:link rel="http://www.api.ing.carrier.com/rels/weather" href="https://wa-ing-api.azurewebsites.net/weather/xxxxx"/><timestamp>2020-06-29T17:26:04.6897004Z</timestamp><ping>240</ping><day id="Monday"><timestamp>2020-06-29T00:00:00-04:00</timestamp><min_temp units="f">73</min_temp><max_temp units="f">92</max_temp><status_id>1</status_id><status_message>Thunderstorms</status_message><pop>25</pop></day><day id="Tuesday"><timestamp>2020-06-30T00:00:00-04:00</timestamp><min_temp units="f">70</min_temp><max_temp units="f">88</max_temp><status_id>1</status_id><status_message>Thunderstorms</status_message><pop>60</pop></day><day id="Wednesday"><timestamp>2020-07-01T00:00:00-04:00</timestamp><min_temp units="f">71</min_temp><max_temp units="f">87</max_temp><status_id>1</status_id><status_message>Thunderstorms</status_message><pop>50</pop></day><day id="Thursday"><timestamp>2020-07-02T00:00:00-04:00</timestamp><min_temp units="f">70</min_temp><max_temp units="f">85</max_temp><status_id>1</status_id><status_message>Thunderstorms</status_message><pop>59</pop></day><day id="Friday"><timestamp>2020-07-03T00:00:00-04:00</timestamp><min_temp units="f">70</min_temp><max_temp units="f">87</max_temp><status_id>8</status_id><status_message>Rain</status_message><pop>44</pop></day><day id="Saturday"><timestamp>2020-07-04T00:00:00-04:00</timestamp><min_temp units="f">72</min_temp><max_temp units="f">86</max_temp><status_id>1</status_id><status_message>Thunderstorms</status_message><pop>45</pop></day></weather_forecast>

My docker logs show that weather things are happening:

[Mon Jun 29 19:42:26 2020] [debug] No cache for weather-xxxxx-forecast. Make Carrier request
[Mon Jun 29 19:42:26 2020] [debug] /weather/xxxxx/forecast
[Mon Jun 29 19:42:26 2020] [debug] GET "/weather/xxxxx/forecast"
[Mon Jun 29 19:58:26 2020] [debug] weather-xxxxx-forecast cached or passthru disabled
[Mon Jun 29 19:58:26 2020] [debug] /weather/xxxxx/forecast
[Mon Jun 29 19:58:26 2020] [debug] GET "/weather/xxxxx/forecast"
[Mon Jun 29 20:14:27 2020] [debug] No cache for weather-xxxxx-forecast. Make Carrier request
[Mon Jun 29 20:14:27 2020] [debug] /weather/xxxxx/forecast
[Mon Jun 29 20:14:27 2020] [debug] GET "/weather/xxxxx/forecast"
[Mon Jun 29 20:30:27 2020] [debug] weather-xxxxx-forecast cached or passthru disabled
[Mon Jun 29 20:30:27 2020] [debug] /weather/xxxxx/forecast
[Mon Jun 29 20:30:27 2020] [debug] GET "/weather/xxxxx/forecast"
[Mon Jun 29 20:46:27 2020] [debug] No cache for weather-xxxxx-forecast. Make Carrier request
[Mon Jun 29 20:46:28 2020] [debug] /weather/xxxxx/forecast
[Mon Jun 29 20:46:28 2020] [debug] GET "/weather/xxxxx/forecast"
[Mon Jun 29 21:02:28 2020] [debug] weather-xxxxx-forecast cached or passthru disabled
[Mon Jun 29 21:02:28 2020] [debug] /weather/xxxxx/forecast
[Mon Jun 29 21:02:28 2020] [debug] GET "/weather/xxxxx/forecast"

While we shouldn't support Weather Underground any longer, seems like this commit reference above needs to be reversed, or potentially modified. I'll continue digging into this but let me know if you have any idea about this.

nebulous commented 4 years ago

pushed a commit which will more aggressively shovel Carrier's changes to the stat - weather included. Feel free to close this issue if you can confirm it worked, otherwise I'll check back in a bit later.

bdf0506 commented 4 years ago

This fixes the weather issue, so that's a nice win! Thanks @nebulous .

However, it appears this broke the front end http pages. I'm not sure the front end matter all that much, but it is definitely broken. Almost looks like a CSS file didn't get loaded or something, but not sure what. Any ideas? It complains about things like app.js and those files havent been modified in this repo in many years.

image

nebulous commented 4 years ago

derp. sure enough. thanks. I'll see if I can fix it once the kids are in bed.

nebulous commented 4 years ago

for the time being, just run in production mode and this shouldn't be an issue. In fact, production mode makes sense for almost everything anyway. I need to go back and untangle the mess of npm/grunt/javascriptbs scaffolding that yeoman generated years ago - but not tonight.

bdf0506 commented 4 years ago

Production mode will load the UI, however, it still doesn't fully work on my end, as values are not populated, and all I see is humidity, in an unpopulated manner. I've been running in development mode for the sake of getting logs. Production mode doesn't give enough logs as discussed in #101

Navigating to /api/config or /api/status give me the data I'd expect, though.

image

scyto commented 4 years ago

I think i am having exactly the same issue - it is passing data through to the carrier servers just fine but nothing in the UI. I just removed my null serial variables and it made no difference to the error above

scyto commented 4 years ago

@bdf0506 are you running in docker? I am wondering if both you and I made some same error in setup or approach?

bdf0506 commented 4 years ago

@scyto yes, I am also running in Docker, on an Unraid host machine. Here's the docker run command that I am using which gets me that same issue that you are seeing where the UI displays bare data.

docker run -d --name='infinitude' --net='host' -e 'TCP_PORT_3000'='3000' -e 'PASS_REQS'='300' -v '/mnt/user/appdata/infinitude/state':'/infinitude/state':'rw' 'nebulous/infinitude'

scyto commented 4 years ago

@bdf0506 I tested nebulous/infinitude too as well as building from scratch - definitely a breaking change somewhere. Good to know it isn't something unique to one of us (though i note neither you or I are using the YAML file, but i don't see anything in there that's lacking from what you and I did.) @nebulous let us know what additional info you need from us, if any.

nebulous commented 4 years ago

I know what needs to be done, just need to string together the time and tuits. I'm hoping to be able to use a separate grunt container to handle the npm dev build nightmare. Can at least push the fix for prod mode though - one sec.

nebulous commented 4 years ago

The most recent commit works for me in prod mode(with increased logging enabled). You might need let it run for a couple minutes to backfill and furiously refresh to blow out caches.

bdf0506 commented 4 years ago

All set now. Thanks @nebulous for the weather bug fix as well as fixing the unintended consequences! :)