#477-Update-Electricity-Data #540

Merged
b24johka merged 5 commits from #477-Update-Electricity-Data into team_1_week_3 2026-04-28 08:39:08 +00:00
Collaborator

Finished hooking up the Electricity mockup to the new middleware and it works on linux. Would like if a windows user could test to see if it works on windows

to test the data go to the localhost then paste this parts into the url when running a build
http://localhost/api/energy/all
http://localhost/api/energy/total-all
http://localhost/api/energi/total/

sensor names are
elec-sensor-001
elec-sensor-002
elec-sensor-003
elec-sensor-004

Finished hooking up the Electricity mockup to the new middleware and it works on linux. Would like if a windows user could test to see if it works on windows to test the data go to the localhost then paste this parts into the url when running a build http://localhost/api/energy/all http://localhost/api/energy/total-all http://localhost/api/energi/total/<sensor name> sensor names are elec-sensor-001 elec-sensor-002 elec-sensor-003 elec-sensor-004
b24johka 2026-04-27 07:08:10 +00:00
Collaborator

I have issues setting up the enviorment, as the read container keeps restarting with this error message:

Unhandled exception. MQTTnet.Adapter.MqttConnectingFailedException: Connecting with MQTT server failed (NotAuthorized).
   at MQTTnet.Client.MqttClient.Authenticate(IMqttChannelAdapter channelAdapter, MqttClientOptions options, CancellationToken cancellationToken)
   at MQTTnet.Client.MqttClient.ConnectInternal(IMqttChannelAdapter channelAdapter, CancellationToken cancellationToken)
   at MQTTnet.Client.MqttClient.ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken)
   at MQTTnet.Client.MqttClient.ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken)
   at ElecSensorRead.Program.Main(String[] args) in /app/Program.cs:line 41
   at ElecSensorRead.Program.

from

await client.ConnectAsync(options, CancellationToken.None); on Line 41

I don't know why or how, since the exact same lines exist in the temperature and it works fine. Does it work on your end?

I have issues setting up the enviorment, as the read container keeps restarting with this error message: ``` csharp Unhandled exception. MQTTnet.Adapter.MqttConnectingFailedException: Connecting with MQTT server failed (NotAuthorized). at MQTTnet.Client.MqttClient.Authenticate(IMqttChannelAdapter channelAdapter, MqttClientOptions options, CancellationToken cancellationToken) at MQTTnet.Client.MqttClient.ConnectInternal(IMqttChannelAdapter channelAdapter, CancellationToken cancellationToken) at MQTTnet.Client.MqttClient.ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken) at MQTTnet.Client.MqttClient.ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken) at ElecSensorRead.Program.Main(String[] args) in /app/Program.cs:line 41 at ElecSensorRead.Program. ``` from await client.ConnectAsync(options, CancellationToken.None); on Line 41 I don't know why or how, since the exact same lines exist in the temperature and it works fine. Does it work on your end?
Collaborator

Never mind, the compose files were missing the MQTT variables. Tihi

Never mind, the compose files were missing the MQTT variables. Tihi
-Added missing paths to the Windows installation script
- Added MQTT creds to docker compose
- Added the MQTT environment variables to readMockup file
- Added energyMockup csproj to Solution file
a24timsv requested changes 2026-04-27 09:32:15 +00:00
Dismissed
a24timsv left a comment
Collaborator

Container keeps restarting with errors. I've pushed a commit that hopefully solves this.

Container keeps restarting with errors. I've pushed a commit that hopefully solves this.
a24timsv approved these changes 2026-04-27 11:58:23 +00:00
a24timsv left a comment
Collaborator

Review on #540

Whats done

Review following things

Tested on Windows 11 using Firefox

  • App starts, doesn't break any other component.
    • Tested all endpoints that the service should provide.
    • Checked the read container to see printouts which seem to post the data needed.

Inspected following files

  • readMockup/readEnergySensor/readEnergySensor/Program.cs
    • Indentation/code styling
      • Follows the coding conventions.
    • Naming convention
      • Follows the coding conventions.
    • Comments
      • Good amount of comments
    • General code quality
      • Looks good, and it works. Also nice since it applies to the new middleware.
  • service/energyService/energyService/Program.cs
    • Indentation/code styling
      • Follows the coding conventions.
    • Naming convention
      • Follows the coding conventions.
    • Comments
      • Good amount of comments
    • General code quality
      • Looks good, and it works. Also nice since it applies to the new middleware.
  • All scripts
    • Indentation/code styling
      • Ok
    • Naming convention
      • Ok
    • Comments
      • Ok
    • General code quality
      • Ok, looks the same as all other commands in all the scripts
  • DockerCompose/compose.yaml
    • Indentation/code styling
      • Ok
    • Naming convention
      • Ok
    • Comments
      • No comment applied here
    • General code quality
      • Now that the MQTT credentials are applied it works fine. Good that we use those as it ups security in a real implementation.

What needs to be done

  • Nothing, looks good

Conclusion

  • Looks good to be merged.
# Review on #540 ## Whats done Review following things ### Tested on Windows 11 using Firefox + App starts, doesn't break any other component. + Tested all endpoints that the service should provide. + Checked the read container to see printouts which seem to post the data needed. ### Inspected following files + readMockup/readEnergySensor/readEnergySensor/Program.cs + Indentation/code styling + Follows the coding conventions. + Naming convention + Follows the coding conventions. + Comments + Good amount of comments + General code quality + Looks good, and it works. Also nice since it applies to the new middleware. + service/energyService/energyService/Program.cs + Indentation/code styling + Follows the coding conventions. + Naming convention + Follows the coding conventions. + Comments + Good amount of comments + General code quality + Looks good, and it works. Also nice since it applies to the new middleware. + All scripts + Indentation/code styling + Ok + Naming convention + Ok + Comments + Ok + General code quality + Ok, looks the same as all other commands in all the scripts + DockerCompose/compose.yaml + Indentation/code styling + Ok + Naming convention + Ok + Comments + No comment applied here + General code quality + Now that the MQTT credentials are applied it works fine. Good that we use those as it ups security in a real implementation. ## What needs to be done + Nothing, looks good ## Conclusion + Looks good to be merged.
b24johka merged commit 61488bd362 into team_1_week_3 2026-04-28 08:39:08 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!540
No description provided.