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

Unhandled Exception #2

Closed
chuck-boudreau opened this issue Nov 25, 2022 · 12 comments
Closed

Unhandled Exception #2

chuck-boudreau opened this issue Nov 25, 2022 · 12 comments
Assignees

Comments

@chuck-boudreau
Copy link

chuck-boudreau commented Nov 25, 2022

Here is my configuration:

{
    "platform": "WeatherFlowTempest",
    "name": "WeatherFlow Tempest Platform",
    "interval": 10,
    "token": "<token>",
    "station_id": "<station_id>",
    "sensors": [
        {
            "name": "Temperature",
            "sensor_type": "Temperature Sensor",
            "value_key": "air_temperature"
        }
    ]
}

The following log shows the unhandled exception that is being produced when initializing the bridge using HOOBS 4.2.8, Homebridge 1..5.0,

11/25/2022, 12:26:50 AMWeatherflow Tempest Bridge starting
11/25/2022, 12:27:01 AMWeatherflow Tempest BridgeLoaded plugin 'homebridge-weatherflow-tempest'
11/25/2022, 12:27:01 AMWeatherflow Tempest BridgeLoading 1 platforms...
11/25/2022, 12:27:01 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformFinished initializing platform: WeatherFlow Tempest Platform
11/25/2022, 12:27:01 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformTempestApi initialized.
11/25/2022, 12:27:01 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformExecuted didFinishLaunching callback
11/25/2022, 12:27:02 AMWeatherflow Tempest BridgeBridge is running on port 51866.
11/25/2022, 12:27:02 AMWeatherflow Tempest BridgeWARNINGunhandled rejection: TypeError: Cannot use 'in' operator to search for 'obs' in ����U�n�0����gG5-[�xk����=��AK���D
�i�
��]�eŒ�����>F3�+���R+.3���6����D	��].,���M����,H���L������gx�I����[�a ��d���1����H�� ^�k� V��O+_�k	F���wPG�e��c3�a4Y'A�'�U�F[�o7�"k��A�5�ڡ]M�kw���}��P���{=���~<=��˪NI�<n��BYa�3���'���RV�U�R鳤�cu�oR��4��F�
*G(�h�$�0�T��������.+���8�v6��p��G�ݰ��q����4C��]�����%X$�2�e�����5�Kb����C1�2���x�J�I{n_z����i�J^��r��	�SQ�L�o��s��L�����I*�r����C�
��rq<����逃�m�.\��Ժ����I�e��g��Cn����М�:��������t�ߌ���IH�S�f`L�����x�(����%�a9.���-�\6kfp╖M��X�w��J`�|(������Vp�)3�U{��A��v_G�e4��0�4�Lu���A4/f��U���������*	蜜Y�
�f�`yK�s�Az����n���D�\���ح��'�2J�x?���l��\��,�h�Nl�(ݎ��I����N���u�d��#�y��ռ��͆n����c���f�\Y���ٯ��ȃ�22b�\���>=
��d�����c�����[�ޠ�,7a���+0����L�����Je+�4�
@omarshahine
Copy link

Similar problem. Just got my Tempest and installed the plugin on HomeBridge UI and same error.

@chasenicholl
Copy link
Owner

chasenicholl commented Nov 29, 2022

Thanks for the feedback! I'll look into it. In the meantime I would recommend removing your actual token and station id from the issue! (updated for you).

Are you two using a HOOBS device by any chance? This could be a NodeJS issue I'll need to come up with a solution for...

Additionally if you wouldn't mind could you run this command (filling in your station details) and share with me? I want to make sure your API is returning a valid data object.

curl https://swd.weatherflow.com/swd/rest/observations/station/{insert your station id} --header "Authorization: Bearer {insert your token}"

Thank you.

@chuck-boudreau
Copy link
Author

chuck-boudreau commented Nov 29, 2022

Thanks for removing the personal info. I'm using HOOBS.

The command you requested returned this JSON string:

{"station_id":80786,"station_name":"Chateau Boudreau","public_name":"Hawkeye Cir","latitude":38.92613,"longitude":-104.82841,"timezone":"America/Denver","elevation":1949.3895263671875,"is_public":true,"status":{"status_code":0,"status_message":"SUCCESS"},"station_units":{"units_temp":"f","units_wind":"mph","units_precip":"in","units_pressure":"mb","units_distance":"mi","units_direction":"cardinal","units_other":"imperial"},"outdoor_keys":["timestamp","air_temperature","barometric_pressure","station_pressure","pressure_trend","sea_level_pressure","relative_humidity","precip","precip_accum_last_1hr","precip_accum_local_day","precip_accum_local_day_final","precip_accum_local_yesterday_final","precip_minutes_local_day","precip_minutes_local_yesterday_final","wind_avg","wind_direction","wind_gust","wind_lull","solar_radiation","uv","brightness","lightning_strike_last_epoch","lightning_strike_last_distance","lightning_strike_count","lightning_strike_count_last_1hr","lightning_strike_count_last_3hr","feels_like","heat_index","wind_chill","dew_point","wet_bulb_temperature","wet_bulb_globe_temperature","delta_t","air_density"],"obs":[{"timestamp":1669687567,"air_temperature":3.8,"barometric_pressure":787.9,"station_pressure":787.9,"sea_level_pressure":999.4,"relative_humidity":32,"precip":0.0,"precip_accum_last_1hr":0.0,"precip_accum_local_day":0.0,"precip_accum_local_day_final":0.0,"precip_accum_local_yesterday":0.0,"precip_accum_local_yesterday_final":0.0,"precip_minutes_local_day":0,"precip_minutes_local_yesterday":0,"precip_minutes_local_yesterday_final":0,"precip_analysis_type_yesterday":0,"wind_avg":0.6,"wind_direction":172,"wind_gust":1.4,"wind_lull":0.1,"solar_radiation":0,"uv":0.0,"brightness":0,"lightning_strike_last_epoch":1666551734,"lightning_strike_last_distance":26,"lightning_strike_count":0,"lightning_strike_count_last_1hr":0,"lightning_strike_count_last_3hr":0,"feels_like":3.8,"heat_index":3.8,"wind_chill":3.8,"dew_point":-11.4,"wet_bulb_temperature":-1.7,"wet_bulb_globe_temperature":5.2,"delta_t":5.5,"air_density":0.99106,"pressure_trend":"steady"}]}

@omarshahine
Copy link

omarshahine commented Dec 1, 2022

I am NOT using HOOBS

Node.js Version | v16.16.0

Node.js Version v16.16.0

Here is my response.

{
	"station_id":,
	"station_name": "Home",
	"public_name": "",
	"latitude": ,
	"longitude": ,
	"timezone": "America/Los_Angeles",
	"elevation": ,
	"is_public": true,
	"status": {
		"status_code": 0,
		"status_message": "SUCCESS"
	},
	"station_units": {
		"units_temp": "f",
		"units_wind": "mph",
		"units_precip": "in",
		"units_pressure": "inhg",
		"units_distance": "mi",
		"units_direction": "cardinal",
		"units_other": "imperial"
	},
	"outdoor_keys": [
		"timestamp",
		"air_temperature",
		"barometric_pressure",
		"station_pressure",
		"pressure_trend",
		"sea_level_pressure",
		"relative_humidity",
		"precip",
		"precip_accum_last_1hr",
		"precip_accum_local_day",
		"precip_accum_local_day_final",
		"precip_accum_local_yesterday_final",
		"precip_minutes_local_day",
		"precip_minutes_local_yesterday_final",
		"wind_avg",
		"wind_direction",
		"wind_gust",
		"wind_lull",
		"solar_radiation",
		"uv",
		"brightness",
		"lightning_strike_count",
		"lightning_strike_count_last_1hr",
		"lightning_strike_count_last_3hr",
		"feels_like",
		"heat_index",
		"wind_chill",
		"dew_point",
		"wet_bulb_temperature",
		"wet_bulb_globe_temperature",
		"delta_t",
		"air_density"
	],
	"obs": [
		{
			"timestamp": 1669866809,
			"air_temperature": 2,
			"barometric_pressure": 995.9,
			"station_pressure": 995.9,
			"sea_level_pressure": 1000.4,
			"relative_humidity": 93,
			"precip": 0,
			"precip_accum_last_1hr": 0,
			"precip_accum_local_day": 2.771427,
			"precip_accum_local_day_final": 10.785524,
			"precip_accum_local_yesterday": 16.033415,
			"precip_accum_local_yesterday_final": 18.43045,
			"precip_minutes_local_day": 276,
			"precip_minutes_local_yesterday": 430,
			"precip_minutes_local_yesterday_final": 430,
			"precip_analysis_type_yesterday": 1,
			"wind_avg": 0.3,
			"wind_direction": 224,
			"wind_gust": 0.8,
			"wind_lull": 0,
			"solar_radiation": 0,
			"uv": 0,
			"brightness": 1,
			"lightning_strike_count": 0,
			"lightning_strike_count_last_1hr": 0,
			"lightning_strike_count_last_3hr": 0,
			"feels_like": 2,
			"heat_index": 2,
			"wind_chill": 2,
			"dew_point": 1,
			"wet_bulb_temperature": 1.6,
			"wet_bulb_globe_temperature": 7.3,
			"delta_t": 0.4,
			"air_density": 1.26089,
			"pressure_trend": "steady"
		}
	]
}

chasenicholl added a commit that referenced this issue Dec 1, 2022
@chasenicholl
Copy link
Owner

I was not able to reproduce. With that said this looks like Axios the HTTP library I'm using may not be returning a JSON object as it should. In a Hail Mary attempt to patch this for you I added JSON string parsing and more exception handling.

Please let me know if this works! Thank you!

https://github.com/chasenicholl/homebridge-weatherflow-tempest/releases/tag/v1.2.1

@chasenicholl
Copy link
Owner

This seems like a relative thread after you two respond I'll try pinning the library to a lower version.

@chuck-boudreau
Copy link
Author

I updated. I see a different error in the log now... And it appears to result in an infinite loop.

PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:58:59 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:58:59 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 1 of 30. No cached "obs" data.
12/1/2022, 10:59:00 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:00 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:00 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 2 of 30. No cached "obs" data.
12/1/2022, 10:59:01 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:01 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:01 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 3 of 30. No cached "obs" data.
12/1/2022, 10:59:03 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:03 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:03 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 4 of 30. No cached "obs" data.
12/1/2022, 10:59:07 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:07 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:07 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 5 of 30. No cached "obs" data.
12/1/2022, 10:59:11 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:11 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:11 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 6 of 30. No cached "obs" data.
12/1/2022, 10:59:16 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:16 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:16 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 7 of 30. No cached "obs" data.
12/1/2022, 10:59:22 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:22 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:22 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 8 of 30. No cached "obs" data.
12/1/2022, 10:59:30 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:30 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:30 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 9 of 30. No cached "obs" data.
12/1/2022, 10:59:38 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:38 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:38 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 10 of 30. No cached "obs" data.
12/1/2022, 10:59:47 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformERRORSyntaxError: Unexpected token � in JSON at position 0
12/1/2022, 10:59:47 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGResponse missing "obs" data.
12/1/2022, 10:59:47 PMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformWARNINGRetrying 11 of 30. No cached "obs" data.

@chasenicholl
Copy link
Owner

This seems to be related to a regression introduced in the Axios dependency where it does not decompress the gzipped http responses. The unknown char is http gzip binary response data.

Today I’ll pin the dependencies on an early version before the regression for introduced which should fix this.

Thanks for the feedback!

@chasenicholl
Copy link
Owner

1.2.2 should fix this issue. Please confirm? Thank you!

@chuck-boudreau
Copy link
Author

Confirmed. Fixed. Bravo! Thank YOU!

12/2/2022, 11:54:26 AMWeatherflow Tempest Bridge starting
12/2/2022, 11:54:37 AMWeatherflow Tempest BridgeLoaded plugin 'homebridge-weatherflow-tempest'
12/2/2022, 11:54:37 AMWeatherflow Tempest BridgeLoading 1 platforms...
12/2/2022, 11:54:37 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformFinished initializing platform: WeatherFlow Tempest Platform
12/2/2022, 11:54:37 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformTempestApi initialized.
12/2/2022, 11:54:37 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformLoading accessory from cache: Temperature
12/2/2022, 11:54:37 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformExecuted didFinishLaunching callback
12/2/2022, 11:54:38 AMWeatherflow Tempest BridgeBridge is running on port 51866.
12/2/2022, 11:54:38 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformRestoring existing accessory from cache: Temperature
12/2/2022, 11:54:38 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformAdding new accessory: Relative Humidity
12/2/2022, 11:54:38 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformAdding new accessory: Light Level
12/2/2022, 11:54:38 AMWeatherflow Tempest BridgeWeatherFlow Tempest PlatformAdding new accessory: Wind Speed (Average)

@chasenicholl
Copy link
Owner

Thanks everyone for their feedback. Closing out this issue. Thank you!

@omarshahine
Copy link

Thank you! It's working great!

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