genielabs / HomeGenie

HomeGenie, the programmable automation intelligence

Home Page:https://homegenie.it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DHT sensor code does not work with latest versions of HG [BUG]

bkenobi opened this issue · comments

Version
Which HomeGenie version/OS/.NET framework version are you using. (REQUIRED)
1.3.19

Describe the bug
A clear and concise description of what the bug is.
After adding the DHT11 or DHT22 packages from the package manager, the code does not compile. The errors center on 2 lines (28 and 29) which are where the sensor data is written to the sensor module via Program.RaiseEvent. The error text and images are below.

There is a test program included with the library but I was unable to compile with my RPi. I tried with RPi1B running mono-devel 6.12. It was difficult enough to get mono-devel installed so I have not tried an older version yet.

Code to Reproduce
Write a small snippet to isolate your bug and could be possible to our team test. (REQUIRED)
Use the provided DHT code in the package manager. For me, these showed up as programs 63 (DHT22) and 70 (DHT11).

Expected behavior
A clear and concise description of what you expected to happen.
Install the package via package manager. Compile the code.

Screenshots/Stacktrace
If applicable, add screenshots/stacktrace
image

Error
×
Line 28, Column 50 (Code):
    The type `UnitsNet.Ratio' is defined in an assembly that is not referenced. Consider adding a reference to assembly `UnitsNet, Version=3.46.1.0, Culture=neutral, PublicKeyToken=null'

Line 28, Column 67 (Code):
    The `.' operator cannot be applied to operand of type `UnitsNet.Ratio'

Line 29, Column 53 (Code):
    The type `UnitsNet.Temperature' is defined in an assembly that is not referenced. Consider adding a reference to assembly `UnitsNet, Version=3.46.1.0, Culture=neutral, PublicKeyToken=null'

Line 29, Column 65 (Code):
    The `.' operator cannot be applied to operand of type `UnitsNet.Temperature'

Additional context
Add any other context about the problem here.
It appears the issue is related to the use of the UnitsNet library. The locations in code that appear to be responsible for this are in the raspberry-sharp-io library.

Locations in code where error is likely sourced:
https://github.com/genemars/raspberry-sharp-io/blob/master/Raspberry.IO.Components/Sensors/Temperature/Dht/Dht11Connection.cs#L42
https://github.com/genemars/raspberry-sharp-io/blob/master/Raspberry.IO.Components/Sensors/Temperature/Dht/DhtData.cs#L6

Location where UnitsNet is referenced:
https://github.com/genemars/raspberry-sharp-io/blob/master/Raspberry.IO.Components/Raspberry.IO.Components.csproj#L46

Test program that should help diagnose the issue:
https://github.com/genemars/raspberry-sharp-io/blob/master/Tests/Test.Gpio.DHT11/Program.cs

Just hoping this issue along with your other issue referencing the BCM driver are resolved at some stage. Not much point in making further releases of HG with this long running bug still present.