# frozen_string_literal: true module DjiMqttConnect # Factories for building example messages # Do not include this in your production code module Factories # Events def build_device_exit_homing_notify_events_message message_data = { action: 1, sn: "DOCK01", reason: "0" } Thing::Product::DeviceExitHomingNotifyEventsMessage.new( _method: "device_exit_homing_notify", bid: Message.generate_bid, tid: Message.generate_tid, need_reply: 1, gateway: "GATEWAY01", timestamp: Message.current_timestamp, data: message_data, _data: message_data ) end def build_thing_product_device_reboot_events_message message_data = { result: 0, output: { status: "ok", progress: { percent: 100 } } } Thing::Product::DeviceRebootEventsMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "device_reboot", need_reply: 1, data: message_data, _data: message_data ) end def build_file_upload_callback_events_message message_data = { file: { object_key: "object_key", path: "xxx", name: "dog.jpeg", ext: { flight_id: "xxx", drone_model_key: "0-67-0", payload_model_key: "0-67-0", is_original: true }, metadata: { shoot_position: { lat: 22.1, lng: 122.5 }, gimbal_yaw_degree: -91.4, absolute_altitude: 56.311, relative_altitude: 41.124, created_time: "2021-05-10 16:04:20" } }, result: 0 } Thing::Product::FileUploadCallbackEventsMessage.new( _method: "file_upload_callback", bid: Message.generate_bid, tid: Message.generate_tid, need_reply: 1, gateway: "xxx", timestamp: Message.current_timestamp, data: message_data, _data: message_data ) end def build_fileupload_progress_events_message message_data = { output: { ext: { files: [ { module: "0", size: 155232, device_sn: "drone_sn", key: "4bf0039f-6434-44a8-b891-8d7b6b7ff138/drone_sn/video_20220621_110830.log", fingerprint: "4f65b891f3bc09bdb6d4c36a996b532d", progress: { current_step: 19, progress: 100, finish_time: 1655781395926, upload_rate: 0, result: 0, status: "ok" } }, { module: "3", size: 155232, device_sn: "dock_sn", key: "4bf0039f-6434-44a8-b891-8d7b6b7ff138/dock_sn/video_20220621_110830.log", fingerprint: "4f65b891f3bc09bdb6d4c36a996b532d", progress: { current_step: 19, total_step: 30, progress: 100, finish_time: 1655781395926, upload_rate: 0, result: 0, status: "ok" } } ] }, status: "ok" } } Thing::Product::FileuploadProgressEventsMessage.new( _method: "fileupload_progress", need_reply: 0, bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "dock_sn", _data: message_data, data: message_data ) end def build_flighttask_progress_events_message message_data = { output: { ext: { current_waypoint_index: 3, media_count: 6, track_id: "track_id", flight_id: "flight_id", break_point: { index: 1, state: 0, progress: 0.34, wayline_id: 0, break_reason: 1, latitude: 23.4, longitude: 113.99, height: 100.23, attitude_head: 30 } }, progress: { current_step: 19, percent: 100 }, status: "ok" }, result: 0 } Thing::Product::FlighttaskProgressEventsMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, data: message_data, _data: message_data, _method: "flighttask_progress", timestamp: Message.current_timestamp ) end def build_flighttask_ready_events_message message_data = { flight_ids: [ SecureRandom.uuid, SecureRandom.uuid ] } Thing::Product::FlighttaskReadyEventsMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, data: message_data, _data: message_data, _method: "flighttask_ready", timestamp: Message.current_timestamp ) end def build_highest_priority_upload_flighttask_media_events_message message_data = { flight_id: SecureRandom.uuid } Thing::Product::HighestPriorityUploadFlighttaskMediaEventsMessage.new( bid: Message.generate_bid, _data: message_data, data: message_data, _method: "highest_priority_upload_flighttask_media", need_reply: 1, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "DOCK01" ) end # OSD def build_thing_product_dock_osd_message_with_sub_device message_data = { network_state: { type: 2, quality: 0, rate: 0.1459999978542328 }, drone_charge_state: { state: 0, capacity_percent: 0 }, drone_in_dock: 0, rainfall: 1, wind_speed: 0, environment_temperature: 18.8, temperature: 19.6, humidity: 58, latitude: 0, longitude: 0, height: 0, alternate_land_point: { latitude: "-33.865143", longitude: "151.209900", height: 0, safe_land_height: 30, is_configured: 0 }, first_power_on: 1631945855969, position_state: { is_calibration: 1, is_fixed: 1, quality: 1, gps_number: 0, rtk_number: 0 }, storage: { total: 82045336, used: 56385704 }, mode_code: 1, cover_state: 1, supplement_light_state: 0, emergency_stop_state: 0, air_conditioner: { air_conditioner_state: 32767, switch_time: 32767 }, battery_store_mode: 2, alarm_state: 0, putter_state: 1, sub_device: { device_sn: "M30DRONE01", device_model_key: "0-67-0", device_online_status: 0, device_paired: 0 } } Thing::Product::DockOsdMessage.new( tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, gateway: "gatewaysn", data: message_data, _data: message_data ) end def build_thing_product_dock_osd_message_with_maintenance_status message_data = { job_number: 52, acc_time: 146930, activation_time: 1682969151, maintain_status: { maintain_status_array: [ { state: 0, last_maintain_type: 17, last_maintain_time: 0, last_maintain_work_sorties: 0 } ] }, electric_supply_voltage: 0, working_voltage: 0, working_current: 0, backup_battery: { voltage: 24365, temperature: 32767, switch: 1 }, drone_battery_maintenance_info: { batteries: [ { index: 0, capacity_percent: 32767, voltage: 32767, temperature: 32767 }, { index: 1, capacity_percent: 32767, voltage: 32767, temperature: 32767 } ] } } Thing::Product::DockOsdMessage.new( tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, gateway: "gatewaysn", data: message_data, _data: message_data ) end def build_thing_product_dock_osd_message_with_link_status message_data = { drc_state: 0, flighttask_prepare_capacity: 1, flighttask_step_code: 255, media_file_detail: { remain_upload: 140 }, sdr: { down_quality: 0, frequency_band: 5.8, up_quality: 0 }, wireless_link: { _4g_freq_band: 2.4, _4g_gnd_quality: 0, _4g_link_state: 0, _4g_quality: 0, _4g_uav_quality: 0, dongle_number: 0, link_workmode: 0, sdr_freq_band: 2.4, sdr_link_state: 0, sdr_quality: 0 } } Thing::Product::DockOsdMessage.new( tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, gateway: "gatewaysn", data: message_data, _data: message_data ) end # Status def build_device_online_update_topo_message message_data = { type: 98, sub_type: 0, device_secret: "secret", nonce: "nonce", version: 1, sub_devices: [ { sn: "drone001", type: 116, sub_type: 0, index: "A", device_secret: "secret", nonce: "nonce", version: 1 } ] } Sys::Product::UpdateTopoStatusMessage.new( _method: "update_topo", tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, data: message_data, _data: message_data.deep_stringify_keys ) end def build_update_topo_status_reply_message Sys::Product::UpdateTopoStatusReplyMessage.new( _method: "update_topo", tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, data: { result: 0 } ) end # Requests def build_thing_product_config_requests_message message_data = { config_type: "json", config_scope: "product" } Thing::Product::ConfigRequestsMessage.new( _method: "config", tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, gateway: "gatewaysn", data: message_data, _data: message_data.deep_stringify_keys ) end def build_thing_product_config_requests_reply_message request_message = build_thing_product_config_requests_message reply_data = { ntp_server_host: "http://time.google.com/", app_id: "123456", app_key: "app_key", app_license: "app_license" } Thing::Product::ConfigRequestsReplyMessage.build_for(request_message, data: reply_data) end def build_thing_product_airport_bind_status_requests_message message_data = { devices: [ { sn: "drone-sn" }, { sn: "dock-sn" } ] } Thing::Product::AirportBindStatusRequestsMessage.new( _method: "airport_bind_status", _data: message_data, tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, data: message_data ) end def build_thing_product_airport_bind_status_requests_reply_message airport_bind_status_request = build_thing_product_airport_bind_status_requests_message Thing::Product::AirportBindStatusRequestsReplyMessage.build_for( airport_bind_status_request, result: 0, bind_status: airport_bind_status_request.data.devices.map.with_index do |device, index| { sn: device.sn, is_device_bind_organization: (index % 2).zero?, organization_id: "12345678", organization_name: "12345", device_callsign: "Device organization callsign" } end ) end def build_thing_product_airport_organization_bind_requests_message message_data = { bind_devices: [ { device_binding_code: "", organization_id: "curo", device_callsign: "", sn: "DOCK01", device_secret: "DEVICE_SECRET", device_nonce: "DEVICE_NONCE", device_model_key: "3-1-0" }, { device_binding_code: "", organization_id: "curo", device_callsign: "", sn: "M30DRONE01", device_secret: "DEVICE_SECRET", device_nonce: "DEVICE_NONCE", device_model_key: "0-67-0" } ] } Thing::Product::AirportOrganizationBindRequestsMessage.new( _method: "airport_organization_bind", _data: message_data, tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, data: message_data, gateway: "DOCK01" ) end def build_thing_product_airport_organization_bind_requests_reply_message airport_organization_bind_request = build_thing_product_airport_organization_bind_requests_message Thing::Product::AirportOrganizationBindRequestsReplyMessage.build_for( airport_organization_bind_request, result: 0 ) end def build_thing_product_airport_organization_get_requests_message message_data = { device_binding_code: "device_binding_code", organization_id: "organization_id" } Thing::Product::AirportOrganizationGetRequestsMessage.new( _method: "airport_organization_get", _data: message_data, tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, data: message_data ) end def build_thing_product_airport_organization_get_requests_reply_message airport_organization_get_request = build_thing_product_airport_organization_get_requests_message Thing::Product::AirportOrganizationGetRequestsReplyMessage.build_for( airport_organization_get_request, result: 0, output: { organization_name: "12345" } ) end def build_thing_product_flight_areas_drone_location_events_message message_data = { drone_locations: [ { area_id: "d275c4e1-d864-4736-8b5d-5f5882ee9bdd", area_distance: 100.11, is_in_area: true } ] } Thing::Product::FlightAreasDroneLocationEventsMessage.new( _method: "flight_areas_drone_location", tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, data: message_data, _data: message_data.deep_stringify_keys ) end def build_thing_product_flight_areas_sync_progress_events_message message_data = { file: { name: "geofence_xxx.json", checksum: "sha256" }, status: "synchronized", reason: 0 } Thing::Product::FlightAreasSyncProgressEventsMessage.new( _method: "flight_areas_sync_progress", tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, data: message_data, _data: message_data.deep_stringify_keys ) end def build_thing_product_flight_areas_get_requests_message message_data = {} Thing::Product::FlightAreasGetRequestsMessage.new( _method: "flight_areas_get", tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, gateway: "gatewaysn", data: message_data, _data: message_data.deep_stringify_keys ) end def build_thing_product_flight_areas_get_requests_reply_message request_message = build_thing_product_flight_areas_get_requests_message Thing::Product::FlightAreasGetRequestsReplyMessage.build_for(request_message, files: []) end def build_thing_product_flighttask_resource_get_requests_message message_data = { flight_id: SecureRandom.uuid } Thing::Product::FlighttaskResourceGetRequestsMessage.new( tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, _method: "flighttask_resource_get", data: message_data, _data: message_data ) end def build_thing_product_flighttask_resource_get_requests_reply_message flighttask_resource_get_request = build_thing_product_flighttask_resource_get_requests_message Thing::Product::FlighttaskResourceGetRequestsReplyMessage.build_for( flighttask_resource_get_request, result: 0, file: { fingerprint: "signxxxx", url: "https://xx.oss-cn-hangzhou.aliyuncs.com/xx.kmz?Expires=xx&OSSAccessKeyId=xxx&Signature=xxx" } ) end def build_thing_product_storage_config_get_requests_message message_data = { module: 0 } Thing::Product::StorageConfigGetRequestsMessage.new( _method: "storage_config_get", _data: message_data, tid: Message.generate_tid, bid: Message.generate_bid, timestamp: Message.current_timestamp, data: message_data ) end def build_thing_product_storage_config_get_requests_reply_message storage_config_get_request = build_thing_product_storage_config_get_requests_message Thing::Product::StorageConfigGetRequestsReplyMessage.build_for( storage_config_get_request, result: 0, output: { bucket: "bucket_name", credentials: { access_key_id: "access_key_id", access_key_secret: "access_key_secret", expire: 3600, security_token: "security_token" }, endpoint: "https://oss-cn-hangzhou.aliyuncs.com", object_key_prefix: "b4cfaae6-bd9d-4cd0-8472-63b608c3c581", provider: "ali", region: "hz" } ) end # Services def build_thing_product_alarm_state_switch_services_message Thing::Product::AlarmStateSwitchServicesMessage.build(action: Thing::Product::AlarmStateSwitchServicesMessage::ACTION_OPEN) end def build_thing_product_cover_close_services_message Thing::Product::CoverCloseServicesMessage.build end def build_thing_product_cover_open_services_message Thing::Product::CoverOpenServicesMessage.build end def build_thing_product_debug_mode_close_services_message Thing::Product::DebugModeCloseServicesMessage.build end def build_thing_product_debug_mode_open_services_message Thing::Product::DebugModeOpenServicesMessage.build end def build_thing_product_fileupload_list_services_message Thing::Product::FileuploadListServicesMessage.build( module_list: [0, 3] ) end def build_thing_product_fileupload_start_services_message timestamp = Message.current_timestamp Thing::Product::FileuploadStartServicesMessage.build( data: { bucket: "stg-dji-service-hz-ksd7", region: "hz", credentials: { access_key_id: "STS.access_key_id", access_key_secret: "access_key_secret", expire: 3600, security_token: "security_token" }, endpoint: "https://oss-cn-hangzhou.aliyuncs.com", params: { files: [ { list: [ { boot_index: 1111, end_time: timestamp - 3000, size: 33789, start_time: timestamp - 4000 }, { boot_index: 22222, end_time: timestamp - 1000, size: 33789, start_time: timestamp - 2000 } ], module: "3", object_key: "object_key" } ] }, provider: "ali" } ) end def build_thing_product_flighttask_execute_services_message Thing::Product::FlighttaskExecuteServicesMessage.build(flight_id: SecureRandom.uuid) end def build_thing_product_flighttask_pause_services_message Thing::Product::FlighttaskPauseServicesMessage.build end def build_thing_product_flighttask_prepare_services_message Thing::Product::FlighttaskPrepareServicesMessage.build( data: { execute_time: 1234567890123, flight_id: "xxxxxxx", task_type: 2, wayline_type: 0, file: { url: "https://xxx.com/xxxx", fingerprint: "xxxx" }, ready_conditions: { battery_capacity: 90, begin_time: 1234567890123, end_time: 1234567890123 }, executable_conditions: { storage_capacity: 1000 }, break_point: { index: 1, state: 0, progress: 0.34, wayline_id: 0 }, rth_altitude: 100, out_of_control_action: 0, exit_wayline_when_rc_lost: 0 } ) end def build_thing_product_flighttask_recovery_services_message Thing::Product::FlighttaskRecoveryServicesMessage.build end def build_thing_product_flighttask_undo_services_message Thing::Product::FlighttaskUndoServicesMessage.build( flight_ids: [SecureRandom.uuid, SecureRandom.uuid] ) end ### Live Stream (Services Messages) ### def build_thing_product_live_lens_change_services_message Thing::Product::LiveLensChangeServicesMessage.build( data: { video_id: "1ZNDH1D0010098/39-0-7/normal-0", video_type: "wide" } ) end def build_thing_product_live_set_quality_services_message Thing::Product::LiveSetQualityServicesMessage.build( data: { video_id: "1ZNDH1D0010098/39-0-7/normal-0", video_quality: 0 } ) end def build_thing_product_live_start_push_services_message Thing::Product::LiveStartPushServicesMessage.build( data: { url: "channel=1ZNDH1D0010098_39-0-7&sn=1ZNDH1D0010098&token=006dca67721582a48768ec4d817b7b25a86IADk%2Fcm%2Fdv%2BHY6qT%2FAKM6y7TcUe4lXNvZpycH7vUMAlM6pFALUKF2zyCIgA82pQE8cCoYAQAAQDxwKhgAgDxwKhgAwDxwKhgBADxwKhg&uid=50000", url_type: 0, video_id: "1ZNDH1D0010098/39-0-7/normal-0", video_quality: 0 } ) end def build_thing_product_live_stop_push_services_message Thing::Product::LiveStopPushServicesMessage.build( data: { video_id: "1ZNDH1D0010098/39-0-7/normal-0" } ) end def build_thing_product_return_home_services_message Thing::Product::ReturnHomeServicesMessage.build end def build_thing_product_return_home_cancel_services_message Thing::Product::ReturnHomeCancelServicesMessage.build end def build_thing_product_alarm_state_switch_services_reply_message message_data = { result: 0, output: { status: "in_progress" } } Thing::Product::AlarmStateSwitchServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "alarm_state_switch", data: message_data, _data: message_data ) end def build_thing_product_cover_close_services_reply_message message_data = { result: 0, output: { status: "in_progress" } } Thing::Product::CoverCloseServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "cover_close", data: message_data, _data: message_data ) end def build_thing_product_cover_close_events_message message_data = { result: 0, output: { status: "in_progress", progress: { percent: 50 } } } Thing::Product::CoverCloseEventsMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "cover_close", data: message_data, _data: message_data ) end def build_thing_product_cover_open_services_reply_message message_data = { result: 0, output: { status: "ok" } } Thing::Product::CoverOpenServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "cover_open", data: message_data, _data: message_data ) end def build_thing_product_cover_open_events_message message_data = { result: 0, output: { status: "in_progress", progress: { percent: 60 } } } Thing::Product::CoverOpenEventsMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "cover_open", data: message_data, _data: message_data ) end def build_thing_product_debug_mode_close_services_reply_message message_data = { result: 0, output: { status: "ok" } } Thing::Product::DebugModeCloseServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "debug_mode_close", data: message_data, _data: message_data ) end def build_thing_product_debug_mode_open_services_reply_message message_data = { result: 0, output: { status: "in_progress" } } Thing::Product::DebugModeOpenServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "debug_mode_open", data: message_data, _data: message_data ) end def build_thing_product_flighttask_prepare_services_reply_message message_data = {result: 0} Thing::Product::FlighttaskPrepareServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "flighttask_prepare", _data: message_data, data: message_data ) end def build_thing_product_flighttask_execute_services_reply_message message_data = {result: 0} Thing::Product::FlighttaskExecuteServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "flighttask_execute", _data: message_data, data: message_data ) end def build_thing_product_flighttask_undo_services_reply_message message_data = {result: 0} Thing::Product::FlighttaskUndoServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "flighttask_undo", _data: message_data, data: message_data ) end def build_thing_product_flighttask_pause_services_reply_message message_data = {result: 0} Thing::Product::FlighttaskPauseServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "flighttask_pause", _data: message_data, data: message_data ) end def build_thing_product_flighttask_recovery_services_reply_message message_data = {result: 0} Thing::Product::FlighttaskRecoveryServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "flighttask_recovery", _data: message_data, data: message_data ) end ### Live Stream (Services Reply Messages) ### def build_thing_product_live_lens_change_services_reply_message message_data = {result: 0} Thing::Product::LiveLensChangeServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "live_lens_change", _data: message_data, data: message_data ) end def build_thing_product_live_set_quality_services_reply_message message_data = {result: 0} Thing::Product::LiveSetQualityServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "live_set_quality", _data: message_data, data: message_data ) end def build_thing_product_live_start_push_services_reply_message message_data = {result: 0} Thing::Product::LiveStartPushServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "live_start_push", _data: message_data, data: message_data ) end def build_thing_product_live_stop_push_services_reply_message message_data = {result: 0} Thing::Product::LiveStopPushServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "live_stop_push", _data: message_data, data: message_data ) end def build_thing_product_return_home_services_reply_message message_data = { result: 0, output: {status: "ok"} } Thing::Product::ReturnHomeServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "return_home", _data: message_data, data: message_data ) end def build_thing_product_return_home_cancel_services_reply_message message_data = {result: 0} Thing::Product::ReturnHomeCancelServicesReplyMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, _method: "return_home_cancel", _data: message_data, data: message_data ) end ### State Messages ### def build_thing_product_live_capacity_state_message message_data = { live_capacity: { available_video_number: 3, coexist_video_number_max: 2, device_list: [ { sn: "DOCK01", available_video_number: 1, coexist_video_number_max: 1, camera_list: [ { camera_index: "165-0-7", available_video_number: 1, coexist_video_number_max: 1, video_list: [ { video_index: "normal-0", video_type: "normal", switchable_video_types: [ "normal" ] } ] } ] }, { sn: "DRONE01", available_video_number: 2, coexist_video_number_max: 2, camera_list: [ { camera_index: "39-0-7", available_video_number: 1, coexist_video_number_max: 1, video_list: [ { video_index: "normal-0", video_type: "normal", switchable_video_types: [ "normal" ] } ] }, { camera_index: "52-0-0", available_video_number: 1, coexist_video_number_max: 1, video_list: [ { video_index: "normal-0", video_type: "wide", switchable_video_types: [ "wide", "zoom", "ir" ] } ] } ] } ] } } Thing::Product::StateMessage.new( bid: Message.generate_bid, tid: Message.generate_tid, timestamp: Message.current_timestamp, gateway: "GATEWAY01", _data: message_data, data: message_data ) end end end