Skip to content

Commit

Permalink
Fix issue #2574 (#2688)
Browse files Browse the repository at this point in the history
Co-authored-by: Léo TUAILLON <leo.tuaillon@cgi.com>
  • Loading branch information
TLeoDev and Léo TUAILLON authored Dec 11, 2023
1 parent 61c0589 commit 9d30648
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/IoTHub.Portal.Infrastructure/Jobs/SyncEdgeDeviceJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace IoTHub.Portal.Infrastructure.Jobs
using IoTHub.Portal.Domain;
using IoTHub.Portal.Domain.Entities;
using IoTHub.Portal.Domain.Repositories;
using Microsoft.Azure.Devices;
using Microsoft.Azure.Devices.Shared;
using Microsoft.Extensions.Logging;
using Quartz;
Expand Down Expand Up @@ -130,12 +131,16 @@ private async Task CreateOrUpdateDevice(Twin twin)
var twinWithModule = await this.externalDeviceService.GetDeviceTwinWithModule(twin.DeviceId);
var twinWithClient = await this.externalDeviceService.GetDeviceTwinWithEdgeHubModule(twin.DeviceId);

var connectionState = twin.ConnectionState == DeviceConnectionState.Connected ? "Connected" : "Disconnected";

var device = this.mapper.Map<EdgeDevice>(twin,opts =>
{
opts.Items["TwinModules"] = twinWithModule;
opts.Items["TwinClient"] = twinWithClient;
}) ;

device.ConnectionState = connectionState;

var deviceEntity = await this.edgeDeviceRepository.GetByIdAsync(device.Id, d => d.Tags);

if (deviceEntity == null)
Expand Down

0 comments on commit 9d30648

Please sign in to comment.