Skip to content

Blink (XT2) fully functional Win 10 / C# application to A) download all videos and thumbnails from each camera of all networks, B) to take a snapshot/thumbnail every x seconds and make a video from these images, C) etc. etc.

Notifications You must be signed in to change notification settings

UweR70/Blink-XT2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blink-XT2

Blink (XT2) Win 10 / C # application that still works after the last Blink apk version 6.4.0 published April 12th, 2021.

Content

This repository contains three parts:

  • The complete C# code of my application (see Details).

  • The latest runable version of my application.
    Click here to go directly to the latest and zipped setup.exe, verison 0.14.

  • A wiki that contains more (detailed) information than this landing page.
    Like:
    • A "documentation" class providing all original API calls (incl. the therefore needed URLs)
      of the original Blink mobile phone app.

      Script kiddies will love it.

      Login example as follows because it is most requested:
      
              ...
              @POST("https://rest-{tier}.immedia-semi.com/api/v5/account/login")
              Single login(@Body LoginBody paramLoginBody, @Path("tier") String paramString);
            
      @POST("https://rest-{tier}.immedia-semi.com/api/v5/account/login") Call loginCall(@Body LoginBody paramLoginBody, @Path("tier") String paramString); ...

    • A Tutorial: How to decompile an apk? that demonstrates step-by-step how to get the code
      from the original Blink mobile phone app - which also contains the API calls mentioned above.

Details

Keyfeatures:

  • This app is capable of
    • downloading all videos and thumbnails from each camera of all networks.
    • deleting all downloaded videos on Blinks server on user request.
    • taking a snapshot/thumbnail every x seconds and creating a video from these.

  • The most important API calls are fully developed and ready to use. Out-of-the box!
    Like:
    • Take a snapshot (thumbnail) / download it.
    • Record / download / delete videos.
    • Arm / disarm a complete (Blink) network.
    • Enable / disable motion detection per camera.
    • plus 15+ more

  • Demo implementations like the following are available; see Quicktest.cs.
    
    ...
    var uweR70_Get = new UweR70_Get();
    var uweR70_GetData = new UweR70_GetData();
    var uweR70_PostCallWithEmptyBody = new UweR70_PostCallWithEmptyBody();
    var uweR70_PostCallWithNonEmptyBody = new UweR70_PostCallWithNonEmptyBody();
    ...            
    var network = uweR70_Get.BatteryUssageAsync(baseData).Result;
    var changedMedia = uweR70_Get.ChangedMediaAsync(baseData, 0).Result;
    var cameraStatus = uweR70_Get.CameraStatusAsync(minData).Result;
    var signalStrength = uweR70_Get.SignalStrengthAsync(minData).Result;
    var homescreenV3 = uweR70_Get.HomescreenV3Async(baseData).Result;
    var quickRegionInfo = uweR70_Get.QuickRegionInfoAsync(baseData).Result;
    var syncModules = uweR70_Get.SyncModulesAsync(minData).Result;
    
    var events = uweR70_Get.EventsAsync(minData).Result; var typeList = new[] { "first_boot", "battery", "armed", "disarmed", "scheduled_arm", "scheduled_disarm", "heartbeat", "sm_offline" }; var blinkEvents = events._event; var count = blinkEvents.Length; for (int i = 0; i < typeList.Length; i++) { blinkEvents = blinkEvents.Where(x => !x.type.Equals(typeList[i], StringComparison.InvariantCultureIgnoreCase)).ToArray(); count = blinkEvents.Length; }

    var thumbnailImage = uweR70_GetData.ThumbnailImageAsync(minData, "<enter valid data here>").Result; var video = uweR70_GetData.VideoAsync(baseData, "<enter valid data here>").Result;

    var commandArm = uweR70_PostCallWithEmptyBody.CommandArmDisarmAsync(minData, UweR70_PostCallWithEmptyBody.ArmDisarm.arm).Result; var commandDisarm = uweR70_PostCallWithEmptyBody.CommandArmDisarmAsync(minData, UweR70_PostCallWithEmptyBody.ArmDisarm.disarm).Result; var commandMotionDetectionEnable = uweR70_PostCallWithEmptyBody.CommandMotionDetectionAsync(minData, UweR70_PostCallWithEmptyBody.MotionDetection.enable).Result; var commandMotionDetectionDisable = uweR70_PostCallWithEmptyBody.CommandMotionDetectionAsync(minData, UweR70_PostCallWithEmptyBody.MotionDetection.disable).Result; var commandClip = uweR70_PostCallWithEmptyBody.CommandClipAsync(minData).Result; var commandThumbnail = uweR70_PostCallWithEmptyBody.CommandThumbnailAsync(minData).Result;
    var login = uweR70_PostCallWithNonEmptyBody.LoginAsync(baseData, new LoginBody { email = "<your blink email address>", password = "<your blink password>" }).Result;
    var mediaIdLIstBody = new MediaIdListBody { media_list = new List<long>(new long[] { 12345678, 23456789 }) // Example values }; var test = uweR70_PostCallWithNonEmptyBody.DeleteMediaCall(baseData, mediaIdLIstBody); ...

Dependencies

  • Newtonsoft.Json,
    Accord, Accord.Video, Accord.Video.FFMPEG
  • .NET Framework 4.8

How to compile and run

Sorry, I figured currently not out how to add these packages to the repository:

  • 'Newtonsoft.Json'
  • 'Accord', 'Accord.Video', 'Accord.Video.FFMPEG'
Shame on me ...

Follow these steps to fix this (in Visual Studio):

  • Download the repository as zip file and unzip it.
  • Start Visual Studio (2017) and open the project (file 'Blink-XT2.sln').
    A rebuild at this point will not work due the missing NuGet packages.
  • Select 'Solution Explorer'.
  • Select 'References' in the 'Blink-XT2' project.
  • Right mouse click -> Select 'Manage NuGet Packages ...' in the context menu.
  • A new window/tab should be opened in Visual Studio: 'NuGet: Blink-XT2'.
  • This window/tab contains top most a yellow part that says:
    "Some NuGet packages are missing from this solution. Click to restore from your online packages sources."
    There is also a button called "Restore".
  • Click this button.
  • Make sure the required '.NET Framework 4.8' is installed.
  • Rebuild the solution.
Done!

Remarks

  • This is my very first try to handle Blink XT2.
    -> Optimizations and additional functionality may follow later.

  • There is no official Blink (XT2) API.
    -> So it is difficult to impossible to say whether I am using the right (API) calls or have misunderstood something completely.

  • I own only one Blink XT2 system with three cameras and I am located in Germany.
    -> So, I have no clue whether my app will work with the older Blink XT system and/or outside Germany/Europe.

  • While 'InitAndDownload.cs' (link) contains the fully developed functionality to login and download all videos and thumbnails
    for all networks, is 'Quicktest.cs' (link) meant as demonstration how to use/feed the API calls.

    The tabPage 'InitSummary' plays a little bit with the gathered login, network, camera, video and thumbnail data.

    The old-school Windows Form application is just a wrapper that gives you a user-friendly way to supply
    the main logic with all required values.
    It contains also some 'Task.Factory...' handling to make everything smooth and non-blocking/non-leaking.

  • The form ('Form1.cs [Design]') contains a 'tabControl' control.
    Meant to give you the opportunity to add your own new functionality in a new 'tabPage'.

    Everything you need is provided in a well set instance of the class 'BaseData'.

    Advise:
    Search in 'Form1.cs' (link) for ...
    
        // ToDo: Do NOT remove this "ToDo" line and add here a "SetTabPage_xx_Values(BaseData);" method call in case a new tabPage is added to "tabControl0"!
        
    ... or simply check Visual Studios "Task List" to get an idea how
    to integrate and handle your new tabPage in the existing code well.

  • How do I get the 'Classes.Blink.xxy.cs' classes (link)
    like 'Classes.Blink.CameraStatus.cs' (link), 'Classes.Blink.HomescreenV3' (link), etc.?

    Example:
    Open 'Classes.Blink.UweR70_PostCallWithNonEmptyBody.cs' (link) and serach for the method 'LoginAsync(...)' ...
    
        public async Task<LoginResponse> LoginAsync(BaseData baseData, LoginBody loginBody)
        {
            //  @POST("https://rest-{tier}.immedia-semi.com/api/v4/account/login")
            //   Observable login(@Body LoginBody paramLoginBody, @Path("tier") String paramString);
            //
            //  @POST("https://rest-{tier}.immedia-semi.com/api/v4/account/login")
            //  Call loginCall(@Body LoginBody paramLoginBody, @Path("tier") String paramString);
            var uri = $"https://rest-{baseData.ApiServer}.immedia-semi.com/api/v4/account/login";
            var retString = await FirePostCallAsync(uri, loginBody);
            var ret = JsonConvert.DeserializeObject<LoginResponse>(retString);
            return ret;
         }
        
    ... and set a breakpoint in this line:
    
        var ret = JsonConvert.DeserializeObject<LoginResponse>(retString);
        
    Start debugging / run the code.
    Copy the 'retString' value in to the clipboard when the breakpoint is hit.

    But double check that the copied value is not wrapped in quotation marks!
    looks good:
       {"account":{"id": ... "region":{"e001":"Europe"}}
    looks bad:
       "{"account":{"id": ... "region":{"e001":"Europe"}}"

    Stop the debugger.
    Add a new class 'BlinkTest.cs' in the 'Classes' directory.
    Place the cursor inbetween the inner curly braces
    
        ...
        namespace Blink.Classes
        {
           class BlinkTest 
           { 
               ... place the cursor here ...
           }
        }
        
    Select in Visual Studio (2017) "Edit" -> "Special Paste" -> 'Paste JSON as Classes'
    After Visual Studio generated and added the new class remove the 'wrapping' Rootobject.
    But of course do not remove the properties.
    Done.
    The class can than be used to deserialize 'retString' as shown above.

Last but not least

Enjoy.

About

Blink (XT2) fully functional Win 10 / C# application to A) download all videos and thumbnails from each camera of all networks, B) to take a snapshot/thumbnail every x seconds and make a video from these images, C) etc. etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages