Coder Social home page Coder Social logo

gmeks / myuplinksmartconnect Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 1.0 649 KB

This program connect to the myuplink.com and adjust the schedule of Høiax CONNECTED hot water heaters, and adjust the schedule so that it uses electricity when the price is low.

C# 97.67% Dockerfile 0.85% Batchfile 0.08% PowerShell 1.40%
smarthome charp homeassistant-integration mtqq

myuplinksmartconnect's People

Contributors

gmeks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

simonepittis

myuplinksmartconnect's Issues

Failed to check VgApi

System.Text.Json.JsonException: The JSON value could not be converted to System.Collections.Generic.List1[System.Double]. Path: $.priceByHour.pricesObj.oslo[2] | LineNumber: 0 | BytePositionInLine: 1512. ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a number. at System.Text.Json.Utf8JsonReader.TryGetDouble(Double& value) at System.Text.Json.Utf8JsonReader.GetDouble() at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
at System.Text.Json.Serialization.JsonConverter1.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.ObjectDefaultConverter1.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.JsonPropertyInfo1.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.JsonConverter1.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.ObjectDefaultConverter1.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.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at xElectricityPriceApiShared.ElectricityPrice.VgApi.GetVgPriceInformation(String vgURL) in /src/xElectricityPriceApiShared/ElectricityPrice/VgApi.cs:line 59

Four minor issues

Have been using the program for a while now and it seems to work great.

I have identified 4 minor issues that you might want to correct.

When the daily scedule is running I find the following in the log file:
...
[16:17:25 WRN] Failed to find tekniskal name of powerzone from fr
[16:17:25 WRN] Failed to find tekniskal name of powerzone from nl
Is tekniskal a misspelling for technical?

When the schedule was running today 20.02.2023 I find teh following in the log
[16:17:29 DBG] Schedule update was successfull next one will be 02/20/2023 15:17:00
Shoud not next one be on 02/21/2023 instead of 02/20/2023

Looking at the code I see the following in myUplinkSmartConnect/xElectricityPriceApiShared/ElectricityPrice/Nordpoolgroup.cs
Line 61: _logger.LogInformation($"Login to myUplink API failed with status {tResponse.StatusCode} and message {tResponse.Content}");
Line 100: _logger.LogInformation($"Login to myUplink API failed with status {tResponse.StatusCode} and message {tResponse.Content}");
As I read and undestand the code these are not the correct messages to log here. Perhaps cut and paste from other file and not changed.

Error message: System.FormatException: Input string was not in a correct format.

Hi,

An error message has started to arrive. Has been stable for a long time but suddenly this started to pop up. My MQTT updates stopped and that is how i dioscovered it. But after restart MQTT messages started to work again. But it seems to stop after this message arrive....

[14:52:35 INF] Target Schedule change time is 17:17
server_1 | [14:52:35 INF] Starting up service
server_1 | [14:52:35 INF] Reading settings from environmental variables
server_1 | [14:52:35 INF] Reporting to MQTT is: True
server_1 | [14:53:36 INF] Found device with ID: HOIAX_##
server_1 | [15:00:55 ERR] Failed to run heater status job
server_1 | System.FormatException: Input string was not in a correct format.
server_1 | at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
server_1 | at MyUplinkSmartConnect.ExternalPrice.BasePriceAPI.Parse(String input) in /src/myUplink/ExternalPrice/BasePriceAPI.cs:line 100
server_1 | at MyUplinkSmartConnect.ExternalPrice.Nordpoolgroup.GetPriceInformation()
server_1 | at MyUplinkSmartConnect.JobReScheuleheating.GetPriceInformation() in /src/myUplink/JobReScheuleheating.cs:line 26
server_1 | at MyUplinkSmartConnect.JobReScheuleheating.Work() in /src/myUplink/JobReScheuleheating.cs:line 45
server_1 | at MyUplinkSmartConnect.BackgroundJobSupervisor.WorkerSchedule() in /src/myUplink/BackgroundJobSupervisor.cs:line 165
server_1 | [15:00:56 INF] Found device with ID: HOIAX_##
server_1 | [15:01:57 INF] Found device with ID: HOIAX_##

How does the software interact with "modi"

Hi, nice work. Just got a 200L Høiax Connected installed and found your software. I tested it out in a container and it seems to have connected ok. I just wanted to know how it interacts with the different "MODI"s. I had a set point for 60 and it changed to 70. But I have not changed and done anything to the MODI setup. Does your software use MODIS in an intelligent way? Did not find anything in the documentation for this. Below is my log file

[16:19:44 INF] Starting up service
[16:19:44 INF] Reading settings from configuration file
[16:19:46 ERR] Failed to get updated price information, from EU API. Checking nordpool
[16:19:48 INF] Found device with ID: ###########
[16:19:49 WRN] Water heater target temperature is incorrect ({setting.value}) for {mode.name} , changing to 70
[16:19:49 WRN] Water heater desired power level is incorrect for {mode.name} , changing from {setting.HelperDesiredHeatingPower} to M4 (70C, 700W)
[16:19:49 WRN] Water heater target temperature is incorrect ({setting.value}) for {mode.name} , changing to 70
[16:19:49 WRN] Water heater desired power level is incorrect for {mode.name} , changing from {setting.HelperDesiredHeatingPower} to M5 (70C, 1300W)
[16:19:51 INF] Changed schedule for #########
[16:19:51 ERR] Failed to connect to MTQQ server

But so far this looks very promising. :-)

Inconsistant use of dotnet versions

I believe there is an inconsistancy in the use of dotnet versions between the Dockerfile (6.0) and the csproj files (7.0).
Copeied the projet e few days ago and the only way I was able to build a new image was to change the Dockerfile to use 7.0
On my rpi4 i used dotnet-7.0.400 without problems.

Home Assistant example in readme.md

In the Home Assistant integration example in readme.md following mqtt sensor is defined

- name: "Energi in tank"
  state_topic: "heater/18760NE2240322014631/EnergiStored"
  unique_id: "Waterheater.EnergiStored"
  device_class: power
  unit_of_measurement : kWh 

This result in the following warning in HA:
023-03-27 16:38:45.172 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.energi_in_tank (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'kWh' which is not a valid unit for the device class ('power') it is using; expected one of ['W', 'kW']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22

This is caused by
device_class: power
unit_of_measurement : kWh
as this is energy and not power. Chanhing to
device_class: energy
unit_of_measurement : kWh
seems to fix the issue

myUplinkSmartConnect fails to run

Today myUplinkSmartConnect does not run correctly and does not create a new schedule.

It fails with the message:
[17:55:54 ERR] Failed to run heater schedule job System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index') at System.Collections.Generic.List1.get_Item(Int32 index)
at MyUplinkSmartConnect.CostSavingsRules.RulesBase.GetScheduleTimes(Int32 index) in /data/src/myUplink/CostSavingsRules/RulesBase.cs:line 275
at MyUplinkSmartConnect.CostSavingsRules.RulesBase.CreateLegionellaHeating(DateTime[] datesToSchuedule) in /data/src/myUplink/CostSavingsRules/RulesBase.cs:line 206
at MyUplinkSmartConnect.CostSavingsRules.RulesBase.GenerateRemoteSchedule(String weekFormat, Boolean runLegionellaProgram, IReadOnlyList1 schedule, DateTime[] datesToSchuedule) in /data/src/myUplink/CostSavingsRules/RulesBase.cs:line 87 at MyUplinkSmartConnect.CostSavings.SimplePriceBasedRules.GenerateSchedule(String weekFormat, Boolean runLegionellaHeating, DateTime[] datesToSchuedule) in /data/src/myUplink/CostSavingsRules/SimplePriceBasedRules.cs:line 48 at MyUplinkSmartConnect.JobReScheuleheating.Work() in /data/src/myUplink/JobReScheuleheating.cs:line 93 at MyUplinkSmartConnect.BackgroundJobSupervisor.WorkerSchedule() in /data/src/myUplink/BackgroundJobSupervisor.cs:line 196

This is happening in a docker on RPI 4 that I built a few days ago.

Debug log file attached
hoiax.log

Stack overflow.

Hi.

From this weekend the docker version started crashing.
It's random and can go fine for hours before it stops working and goes in to a "restart loop"

The log from the docker:

2022-10-04 18:05:14.734829+00:00[18:05:14 WRN] Water heater target temperature is incorrect (65) for M2 (65C, 1300W) , changing to 75
2022-10-04 18:05:14.735831+00:00[18:05:14 WRN] Water heater desired power level is incorrect for M2 (65C, 1300W) , changing from Watt2000 to Watt2000
2022-10-04 18:05:14.749307+00:00Stack overflow.
2022-10-04 18:05:14.819075+00:00Repeat 261581 times:
2022-10-04 18:05:14.819099+00:00--------------------------------
2022-10-04 18:05:14.819104+00:00at MyUplinkSmartConnect.WaterHeaterModeLookup.get_WaterHeaterModes()
2022-10-04 18:05:14.819108+00:00--------------------------------
2022-10-04 18:05:14.819113+00:00at MyUplinkSmartConnect.JobReScheuleheating+d__1.MoveNext()
2022-10-04 18:05:14.819125+00:00at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[MyUplinkSmartConnect.JobReScheuleheating+d__1, MyUplink-smartconnect, Version=1.1.0.4, Culture=neutral, PublicKeyToken=null]].ExecutionContextCallback(System.Object)
2022-10-04 18:05:14.819135+00:00at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
2022-10-04 18:05:14.819139+00:00at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[MyUplinkSmartConnect.JobReScheuleheating+d__1, MyUplink-smartconnect, Version=1.1.0.4, Culture=neutral, PublicKeyToken=null]].MoveNext(System.Threading.Thread)
2022-10-04 18:05:14.819147+00:00at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[MyUplinkSmartConnect.JobReScheuleheating+d__1, MyUplink-smartconnect, Version=1.1.0.4, Culture=neutral, PublicKeyToken=null]].MoveNext()
....

Log from Truenas Scale:
Oct 4 20:10:41 nas kernel: traps: .NET ThreadPool[1060017] general protection fault ip:7f48da43d602 sp:7f48d9403b90 error:0 in libc-2.31.so[7f48da43d000+14b000]
Oct 4 20:10:41 nas kernel: Process 1(.NET ThreadPool) has RLIMIT_CORE set to 1
Oct 4 20:10:41 nas kernel: Aborting core

Have troubleshooted, readded the docker, created a new myuplink account but can't find any solutions.
When it's working it is not updating the schedule, only pulling data.

Not sure if this is the correct place, but hope so, it has been a very useuful tool so far.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.