Open chrisstuart-cl opened 1 year ago
Can you share what the JSON looks like that is being returned? I don't have a stick up cam myself to be able to have a look.
This is the JSON response. I can see the first issue is that the lat/long is now a double whereas the entity defines it as a long. It looks like there's an issue with the motion_zones defintion as well, but I've not been able to dig into that yet.
{
"doorbots": [
{
"id": 12345678,
"kind": "doorbell_graham_cracker",
"description": "Front Door",
"location_id": "5bc70f8c-e391-4aee-83bd-6771bf8dc3e9",
"schema_id": null,
"is_sidewalk_gateway": false,
"created_at": "2021-12-04T19:39:43Z",
"deactivated_at": null,
"owner": {
"id": 12345678,
"first_name": "",
"last_name": "",
"email": ""
},
"device_id": "XXXXXXXXXXX",
"time_zone": "Europe/London",
"firmware_version": "Up to Date",
"latitude": 50.000000,
"longitude": -0.000000,
"address": "",
"owned": true,
"stolen": false,
"ring_id": null,
"shared_at": null,
"health": {
"battery_percentage_category": "unknown",
"battery_voltage_category": "unknown",
"connected": true,
"device_type": "doorbell_graham_cracker",
"external_connection": false,
"firmware_version": "11.0.16",
"floodlight_on": false,
"last_update_time": 1688513380,
"network_connection_value": "wifi",
"night_mode_on": false,
"ota_status": "timeout",
"rss_connected": true,
"rssi": -70.0,
"rssi_category": "okay",
"second_battery_percentage_category": "unknown",
"second_battery_voltage_category": "unknown",
"sidewalk_connection": false,
"transformer_voltage": 19.522,
"transformer_voltage_category": "good",
"white_led_on": false,
"firmware_version_status": "Up to Date",
"packet_loss": 0.0,
"packet_loss_category": "good",
"hatch_open": false,
"bandwidth": 4800,
"status_time": 55329206443551,
"vod_enabled": true,
"bandwidth_last_time": 1680717977,
"firmware_avg_bitrate": "393",
"stream_resolution": 100,
"video_packets_total": "575",
"wifi_is_ring_network": false
},
"subscribed": false,
"subscribed_motions": false,
"battery_life": null,
"external_connection": true,
"ring_net_id": null,
"active_schedule_uuid": null,
"alerts": {
"connection": "online",
"ota_status": "timeout"
},
"motion_snooze": null,
"settings": {
"motion_snooze_preset_profile": "low",
"motion_snooze_presets": [ "none", "low", "medium", "high" ],
"live_view_preset_profile": "middle",
"live_view_presets": [ "low", "middle", "high", "highest" ],
"doorbell_volume": 8,
"chime_settings": {
"enable": true,
"type": 2,
"duration": 10
},
"advanced_motion_detection_enabled": true,
"advanced_motion_detection_human_only_mode": false,
"enable_audio_recording": true,
"people_detection_eligible": true,
"live_view_disabled": false,
"ignore_zones": {
"zone1": {
"name": "undefined",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
}
},
"zone2": {
"name": "undefined",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
}
},
"zone3": {
"name": "undefined",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
}
},
"zone4": {
"name": "undefined",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
}
}
},
"enable_rich_notifications": true,
"rich_notifications_billing_eligible": true,
"rich_notifications_face_crop_enabled": false,
"loitering_threshold": 10,
"advanced_motion_detection_types": [],
"motion_detection_enabled": true,
"rich_notifications_scene_source": "cloud",
"offline_motion_event_settings": {
"subscribed": true,
"enabled": false,
"max_upload_kb": 5000,
"resolution_p": 360,
"frequency_after_secs": 2,
"period_after_secs": 30
},
"cv_settings": {
"detection_types": {
"human": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"loitering": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"motion": {
"enabled": true,
"mode": "edge",
"record": null,
"notification": true
},
"moving_vehicle": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"other_motion": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"package_delivery": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"package_pickup": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
}
},
"threshold": {
"loitering": 10.0,
"package_delivery": 2.0
},
"triggers": []
},
"concierge_settings": { "mode": "disabled" },
"sheila_settings": {
"cv_processing_enabled": false,
"local_storage_enabled": false
},
"server_settings": {
"ring_media_server_enabled": true,
"ring_media_server_host": "rms-eu-west-1.rapi.us-east-1.prod.client.cap.ring.devices.a2z.com"
},
"cv_paid_features": {
"baby_cry": true,
"car_alarm": true,
"co2_smoke_alarm": true,
"dog_bark": true,
"general_sound": true,
"glass_break": true,
"human": true,
"loitering": true,
"motion": true,
"other_motion": true,
"package_delivery": true,
"package_pickup": true,
"cv_triggers": true
},
"other_paid_features": {
"alexa_concierge": true,
"sheila_cv": true,
"sheila_recording": true
},
"zone_settings": {
"motion": [
{
"id": "5bc70f8c-e391-4aee-83bd-6771bf8dc3e9",
"name": "Default Zone",
"state": "enabled",
"properties": {
"detection_types": [ "motion" ],
"style": 1
},
"vertices": [
{
"x": 0.220773,
"y": 0.589863
},
{
"x": 0.475362,
"y": 0.625085
},
{
"x": 0.656038,
"y": 0.786598
},
{
"x": 0.773913,
"y": 0.67835
},
{
"x": 0.995652,
"y": 0.734536
},
{
"x": 1,
"y": 1
},
{
"x": 0.527053,
"y": 0.997423
},
{
"x": 0.241546,
"y": 0.963918
}
]
},
{
"id": "5bc70f8c-e391-4aee-83bd-6771bf8dc3e9",
"name": "Zone 1",
"state": "enabled",
"properties": {
"detection_types": [ "motion" ],
"style": 2
},
"vertices": [
{
"x": 0.865718,
"y": 0.360859
},
{
"x": 0.919807,
"y": 0.271512
},
{
"x": 1,
"y": 0.25
},
{
"x": 0.993702,
"y": 0.73457
},
{
"x": 0.993702,
"y": 0.98457
},
{
"x": 0.85314,
"y": 0.98457
},
{
"x": 0.779728,
"y": 0.996598
},
{
"x": 0.864269,
"y": 0.751753
}
]
}
]
},
"stark_enrolled": null,
"network_settings": {
"mac_address_ble": null,
"max_dynamic_listen_interval": null,
"network_diagnosis": null,
"multi_net_pref": 3,
"mac_address_wifi_24": null,
"mac_address_wifi_5": null
},
"motion_zones": [ 0, 0, 0, 0, 0 ],
"enable_vod": 1,
"exposure_control": 2,
"vod_suspended": 0,
"voice_volume": 11,
"video_settings": {
"encryption_enabled": false,
"encryption_method": 1
},
"advanced_motion_zones": {
"zone1": {
"name": "Default Zone",
"state": 2,
"vertex1": {
"x": 0.220773,
"y": 0.589863
},
"vertex2": {
"x": 0.475362,
"y": 0.625085
},
"vertex3": {
"x": 0.656038,
"y": 0.786598
},
"vertex4": {
"x": 0.773913,
"y": 0.67835
},
"vertex5": {
"x": 0.995652,
"y": 0.734536
},
"vertex6": {
"x": 1,
"y": 1
},
"vertex7": {
"x": 0.527053,
"y": 0.997423
},
"vertex8": {
"x": 0.241546,
"y": 0.963918
}
},
"zone2": {
"name": "Zone 1",
"state": 2,
"vertex1": {
"x": 0.865718,
"y": 0.360859
},
"vertex2": {
"x": 0.919807,
"y": 0.271512
},
"vertex3": {
"x": 1,
"y": 0.25
},
"vertex4": {
"x": 0.993702,
"y": 0.73457
},
"vertex5": {
"x": 0.993702,
"y": 0.98457
},
"vertex6": {
"x": 0.85314,
"y": 0.98457
},
"vertex7": {
"x": 0.779728,
"y": 0.996598
},
"vertex8": {
"x": 0.864269,
"y": 0.751753
}
},
"zone3": {
"name": "Zone 3",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
},
"vertex3": {
"x": 0,
"y": 0
},
"vertex4": {
"x": 0,
"y": 0
},
"vertex5": {
"x": 0,
"y": 0
},
"vertex6": {
"x": 0,
"y": 0
},
"vertex7": {
"x": 0,
"y": 0
},
"vertex8": {
"x": 0,
"y": 0
}
}
},
"advanced_motion_zones_enabled": true,
"advanced_motion_zones_type": "8vertices",
"advanced_pir_motion_zones": {
"zone1_sensitivity": 5,
"zone2_sensitivity": 5,
"zone3_sensitivity": 5,
"zone4_sensitivity": 5,
"zone5_sensitivity": 5,
"zone6_sensitivity": 5
},
"motion_announcement": false,
"motion_sensitivity_profile": 0,
"pir_sensitivity_1": 5,
"lite_24x7": {
"subscribed": true,
"enabled": true,
"frequency_secs": 60,
"resolution_p": 360
}
},
"features": {
"cfes_eligible": true,
"motion_zone_recommendation": false,
"motions_enabled": true,
"show_recordings": true,
"show_vod_settings": true,
"rich_notifications_eligible": true,
"show_offline_motion_events": false,
"sheila_camera_eligible": true,
"sheila_camera_processing_eligible": true,
"dynamic_network_switching_eligible": false,
"motion_message_enabled": false,
"show_24x7_lite": true
},
"ext_power_state": null
}
],
"authorized_doorbots": [],
"chimes": [],
"stickup_cams": [
{
"id": 12345678,
"kind": "cocoa_camera",
"description": "Garden",
"location_id": "5bc70f8c-e391-4aee-83bd-6771bf8dc3e9",
"schema_id": null,
"is_sidewalk_gateway": false,
"created_at": "2022-04-02T12:28:27Z",
"deactivated_at": null,
"owner": {
"id": 12345678,
"first_name": "",
"last_name": "",
"email": ""
},
"device_id": "aaaaaaaaaaaa",
"time_zone": "Europe/London",
"firmware_version": "Up to Date",
"latitude": 50.000000,
"longitude": -0.000000,
"address": "",
"owned": true,
"stolen": false,
"ring_id": null,
"shared_at": null,
"health": {
"ac_power": 1,
"battery_percentage_category": "unknown",
"battery_present": false,
"battery_save": false,
"battery_voltage_category": "unknown",
"connected": true,
"device_type": "cocoa_camera",
"external_connection": true,
"firmware_version": "cam-1.16.12800",
"floodlight_on": false,
"last_update_time": 1688510020,
"network_connection_value": "wifi",
"night_mode_on": true,
"ota_status": "timeout",
"rss_connected": true,
"rssi": -68.0,
"rssi_category": "okay",
"second_battery_percentage_category": "unknown",
"second_battery_voltage_category": "unknown",
"sidewalk_connection": false,
"white_led_on": false,
"firmware_version_status": "Up to Date",
"packet_loss": 0.0,
"packet_loss_category": "good",
"hatch_open": false,
"ext_power_state": 64,
"pref_run_mode": "full_power",
"run_mode": "full_power",
"supported_rpc_commands": [ "ping" ],
"status_time": 55328980608201,
"vod_enabled": true,
"firmware_avg_bitrate": "1552",
"video_packets_total": "9975",
"wifi_is_ring_network": false,
"channel": "3",
"tx_rate": 5
},
"subscribed": false,
"subscribed_motions": false,
"external_connection": true,
"ring_net_id": null,
"active_schedule_uuid": null,
"alerts": {
"connection": "online",
"ota_status": "timeout"
},
"motion_snooze": null,
"camera_location_indoor": false,
"facing_window": false,
"siren_status": { "seconds_remaining": 0 },
"ext_power_state": 64,
"battery_life": null,
"features": {
"cfes_eligible": true,
"motion_zone_recommendation": false,
"motions_enabled": true,
"show_recordings": true,
"show_vod_settings": true,
"rich_notifications_eligible": true,
"show_offline_motion_events": false,
"sheila_camera_eligible": true,
"sheila_camera_processing_eligible": true,
"dynamic_network_switching_eligible": false,
"ptz_setup_complete": false,
"motion_message_enabled": true,
"show_24x7_lite": true
},
"settings": {
"motion_snooze_preset_profile": "low",
"motion_snooze_presets": [ "none", "low", "medium", "high" ],
"live_view_preset_profile": "middle",
"live_view_presets": [ "low", "middle", "high", "highest" ],
"doorbell_volume": 8,
"advanced_motion_detection_enabled": false,
"advanced_motion_detection_human_only_mode": false,
"enable_audio_recording": true,
"people_detection_eligible": true,
"live_view_disabled": false,
"ignore_zones": {
"zone1": {
"name": "undefined",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
}
},
"zone2": {
"name": "undefined",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
}
},
"zone3": {
"name": "undefined",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
}
},
"zone4": {
"name": "undefined",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
}
}
},
"enable_rich_notifications": true,
"rich_notifications_billing_eligible": true,
"rich_notifications_face_crop_enabled": false,
"loitering_threshold": 10,
"advanced_motion_detection_types": [],
"motion_detection_enabled": true,
"rich_notifications_scene_source": "firmware",
"offline_motion_event_settings": {
"subscribed": true,
"enabled": false,
"max_upload_kb": 5000,
"resolution_p": 360,
"frequency_after_secs": 2,
"period_after_secs": 30
},
"cv_settings": {
"detection_types": {
"baby_cry": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"car_alarm": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"co2_smoke_alarm": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"dog_bark": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"general_sound": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"glass_break": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"human": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"loitering": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"motion": {
"enabled": false,
"mode": "none",
"record": null,
"notification": true
},
"moving_vehicle": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"other_motion": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"package_delivery": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
},
"package_pickup": {
"enabled": false,
"mode": "none",
"record": null,
"notification": false
}
},
"threshold": {
"baby_cry": 2.0,
"car_alarm": 2.0,
"co2_smoke_alarm": 2.0,
"dog_bark": 2.0,
"general_sound": 2.0,
"glass_break": 2.0,
"loitering": 10.0,
"package_delivery": 2.0
},
"triggers": []
},
"sheila_settings": {
"cv_processing_enabled": false,
"local_storage_enabled": false
},
"server_settings": {
"ring_media_server_enabled": true,
"ring_media_server_host": "rms-eu-west-1.rapi.us-east-1.prod.client.cap.ring.devices.a2z.com"
},
"cv_paid_features": {
"baby_cry": true,
"car_alarm": true,
"co2_smoke_alarm": true,
"dog_bark": true,
"general_sound": true,
"glass_break": true,
"human": true,
"loitering": true,
"motion": true,
"other_motion": true,
"package_delivery": true,
"package_pickup": true,
"cv_triggers": true
},
"other_paid_features": {
"alexa_concierge": true,
"sheila_cv": true,
"sheila_recording": true
},
"zone_settings": {
"motion": [
{
"id": "5bc70f8c-e391-4aee-83bd-6771bf8dc3e9",
"name": "Default Zone",
"state": "enabled",
"properties": {
"detection_types": [ "motion" ],
"style": 1
},
"vertices": [
{
"x": 0.027991,
"y": 0.10439
},
{
"x": 0.386023,
"y": 0.321951
},
{
"x": 0.673801,
"y": 0.32
},
{
"x": 0.807903,
"y": 0.247804
},
{
"x": 0.788694,
"y": 1
},
{
"x": 0.666666,
"y": 1
},
{
"x": 0.333333,
"y": 1
},
{
"x": 0,
"y": 1
}
]
}
]
},
"stark_enrolled": null,
"network_settings": {
"mac_address_ble": null,
"max_dynamic_listen_interval": null,
"network_diagnosis": null,
"multi_net_pref": 3,
"mac_address_wifi_24": null,
"mac_address_wifi_5": null
},
"motion_zones": [],
"enable_vod": 1,
"exposure_control": 2,
"vod_suspended": 0,
"vod_status": "enabled",
"voice_volume": 11,
"video_settings": {
"encryption_enabled": false,
"encryption_method": 1,
"hevc_enabled": false
},
"advanced_motion_zones": {
"zone1": {
"name": "Default Zone",
"state": 2,
"vertex1": {
"x": 0.027991,
"y": 0.10439
},
"vertex2": {
"x": 0.386023,
"y": 0.321951
},
"vertex3": {
"x": 0.673801,
"y": 0.32
},
"vertex4": {
"x": 0.807903,
"y": 0.247804
},
"vertex5": {
"x": 0.788694,
"y": 1
},
"vertex6": {
"x": 0.666666,
"y": 1
},
"vertex7": {
"x": 0.333333,
"y": 1
},
"vertex8": {
"x": 0,
"y": 1
}
},
"zone2": {
"name": "Zone 2",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
},
"vertex3": {
"x": 0,
"y": 0
},
"vertex4": {
"x": 0,
"y": 0
},
"vertex5": {
"x": 0,
"y": 0
},
"vertex6": {
"x": 0,
"y": 0
},
"vertex7": {
"x": 0,
"y": 0
},
"vertex8": {
"x": 0,
"y": 0
}
},
"zone3": {
"name": "Zone 3",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
},
"vertex3": {
"x": 0,
"y": 0
},
"vertex4": {
"x": 0,
"y": 0
},
"vertex5": {
"x": 0,
"y": 0
},
"vertex6": {
"x": 0,
"y": 0
},
"vertex7": {
"x": 0,
"y": 0
},
"vertex8": {
"x": 0,
"y": 0
}
}
},
"advanced_motion_zones_enabled": false,
"advanced_motion_zones_type": "8vertices",
"advanced_pir_motion_zones": {
"zone1_sensitivity": 5,
"zone2_sensitivity": 5,
"zone3_sensitivity": 5,
"zone4_sensitivity": 5,
"zone5_sensitivity": 5,
"zone6_sensitivity": 5
},
"enable_ir_led": true,
"power_mode": "wired",
"motion_announcement": false,
"ptz_settings": {
"mode": null,
"auto_scan": {
"step_size": 25.0,
"pause_ms": 500
},
"pan_settings": {
"positions": {
"min": -170.0,
"max": 170.0,
"default": 0.0
},
"movement": {
"max_speed": 1.0,
"max_acceleration": 1.0,
"step_size": 15.0
}
},
"tilt_settings": {
"positions": {
"min": -30.0,
"max": 30.0,
"default": 0.0
},
"movement": {
"max_speed": 1.0,
"max_acceleration": 1.0,
"step_size": 5.0
}
}
},
"hybrid_motion_zones": {
"motion_snooze_privacy_timeout": 3,
"enable_ir": null,
"active_motion_filter": 1,
"enable_pir_validation": true,
"enable_rlmd": true,
"sensitivity": 8,
"enable_audio": false,
"zone1": {
"name": "Default Zone",
"state": 2,
"vertex1": {
"x": 0.027991,
"y": 0.10439
},
"vertex2": {
"x": 0.386023,
"y": 0.321951
},
"vertex3": {
"x": 0.673801,
"y": 0.32
},
"vertex4": {
"x": 0.807903,
"y": 0.247804
},
"vertex5": {
"x": 0.788694,
"y": 1
},
"vertex6": {
"x": 0.666666,
"y": 1
},
"vertex7": {
"x": 0.333333,
"y": 1
},
"vertex8": {
"x": 0,
"y": 1
}
},
"zone2": {
"name": "Zone 2",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
},
"vertex3": {
"x": 0,
"y": 0
},
"vertex4": {
"x": 0,
"y": 0
},
"vertex5": {
"x": 0,
"y": 0
},
"vertex6": {
"x": 0,
"y": 0
},
"vertex7": {
"x": 0,
"y": 0
},
"vertex8": {
"x": 0,
"y": 0
}
},
"zone3": {
"name": "Zone 3",
"state": 0,
"vertex1": {
"x": 0,
"y": 0
},
"vertex2": {
"x": 0,
"y": 0
},
"vertex3": {
"x": 0,
"y": 0
},
"vertex4": {
"x": 0,
"y": 0
},
"vertex5": {
"x": 0,
"y": 0
},
"vertex6": {
"x": 0,
"y": 0
},
"vertex7": {
"x": 0,
"y": 0
},
"vertex8": {
"x": 0,
"y": 0
}
},
"advanced_motion_zones_enabled": false,
"advanced_motion_zones_type": "8vertices",
"advanced_pir_motion_zones": {
"zone1_sensitivity": 5,
"zone2_sensitivity": 5,
"zone3_sensitivity": 5,
"zone4_sensitivity": 5,
"zone5_sensitivity": 5,
"zone6_sensitivity": 5
},
"advanced_object_settings": {
"human_detection_confidence": {
"day": 0.7,
"night": 0.7
},
"motion_zone_overlap": {
"day": 0.1,
"night": 0.1
},
"object_time_overlap": {
"day": 0.1,
"night": 0.3
},
"object_size_minimum": {
"day": 0.02,
"night": 0.03
},
"object_size_maximum": {
"day": 0.9,
"night": 0.9
}
}
},
"pir_sensitivity_1": 5,
"lite_24x7": {
"subscribed": true,
"enabled": true,
"frequency_secs": 180,
"resolution_p": 360
}
}
}
],
"base_stations": [],
"beams": [],
"beams_bridges": [],
"other": []
}
Since I am battling with #28 I decided to try querying for Ring Devices to see if I could get each device's IDs and use those to call GetDoorbotsHistory
. However, my calls to Session.GetRingDevices
are throwing an exception very similar to this one, but having to do with the battery_life
field on the stickup cams.
One or more errors occurred. (The JSON value could not be converted to System.Nullable`1[System.Int64]. Path: $.stickup_cams[0].battery_life | LineNumber: 0 | BytePositionInLine: 8165.)`
Cannot get the value of a token type 'String' as a number.
I've seen a number of the ring API fields that were int
or long
in the DTO actually being floating point values in the JSON result. Have you looked at what values you're getting back for battery_life?
I'm doing the same as you in looping over the results of session.GetRingDevices
and then calling session.GetDoorbotsHistory(doorbot.Id, 8000);
I'm trying to download videos and it's incredibly slow now. The value I pass to GetDoorbotsHistory
also seems to be critical. Too large a value and I get an error.
@chrisstuart-cl - The values I'm getting for battery_life
are numeric, and thus should cast to long?
without issue, so I'm wondering if it's a red herring and the problem is elsewhere in the JSON string. By the way, I noticed in your PR that you attempted to solve the MotionZone
parsing by changing it from MotionZone
to List<MotionZone>
. Curious how you got there, I looked at your JSON and see that you're getting back an empty array, so I suppose you concluded it had become an array of MotionZone
instead of a single MotionZone
as was presumably the case before. However, my own JSON comes back with that array looking like this:
"motion_zones": [1,1,1,1,1]
So my best guess is that it should be List<int>
, but I don't know what the significance of those values is, and if they could possibly be decimal/float/double/long etc., since 1 could really be any numeric type. I'll probably leave an inline comment on your PR just to attempt to be helpful. Playing trial and error with this JSON mapping is not the most fun I've had!
Given that the data comes from a JSON number
field, you should just keep it as a decimal rather than trying to coerce it into some fixed-point integer type on deserialization.
Describe the bug var devices = await session.GetRingDevices(); throws an exception. AggregateException: One or more errors occurred. (The JSON value could not be converted to KoenZomers.Ring.Api.Entities.MotionZone. Path: $.stickup_cams[0].settings.motion_zones | LineNumber: 0 | BytePositionInLine: 12850.)
Partial Stack Trace at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo
1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value) at System.Text.Json.Serialization.JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter
1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable
1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo jsonTypeInfo) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options) at KoenZomers.Ring.Api.Session.GetRingDevices() at UserQuery.GetHistory(Session session, HashSet
1 savedIds) inTo Reproduce Authenticate a session and call session.GetRingDevices()
Versions (please complete the following information): 0.5.2