Automation Thermostat : Get Analog Value

9 years 2 months ago #411 by ipaqman
Hello,

First thank you very much for your awesome project !

I am trying to make a simple thermostat automation program in EasyIot, but I can't get the temperature sensor value.

public void Run()
{
ModuleParameter temp = ModuleHelper.GetProperty(Domains.MYSENSORS, "N3S10", "Sensor.Temperature");

if (temp!= null && temp.Value<21.0) {DriverHelper.ProcessCommad(Domains.MYSENSORS, "N2S2", "ControlOn", "");}
else {DriverHelper.ProcessCommad(Domains.MYSENSORS, "N2S2", "ControlOff", "");}
}

When I update it says me " Operator `<' cannot be applied to operands of type `string' and `double' " .

I think that i don't get the right variable, but as I am a beginner in programming I didn't find a solution.

Please, could you help me ?

Thank you :-)

Please Log in or Create an account to join the conversation.

9 years 2 months ago #413 by Xavier
Hello,
Yes, as a float 21.0 is a double.
But sorry I don't have the solution.
:unsure:

Please Log in or Create an account to join the conversation.

9 years 2 months ago #422 by EasyIoT

ipaqman wrote: Hello,

First thank you very much for your awesome project !

I am trying to make a simple thermostat automation program in EasyIot, but I can't get the temperature sensor value.

public void Run()
{
ModuleParameter temp = ModuleHelper.GetProperty(Domains.MYSENSORS, "N3S10", "Sensor.Temperature");

if (temp!= null && temp.Value<21.0) {DriverHelper.ProcessCommad(Domains.MYSENSORS, "N2S2", "ControlOn", "");}
else {DriverHelper.ProcessCommad(Domains.MYSENSORS, "N2S2", "ControlOff", "");}
}

When I update it says me " Operator `<' cannot be applied to operands of type `string' and `double' " .

I think that i don't get the right variable, but as I am a beginner in programming I didn't find a solution.

Please, could you help me ?

Thank you :-)



Try temp.DecimalValue function.

Please Log in or Create an account to join the conversation.

9 years 2 months ago #466 by ipaqman
It works great :).

Thank you !

Please Log in or Create an account to join the conversation.

9 years 1 month ago #518 by VasilijHCN
Can U please post working automation code ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.243 seconds

Forum latest

  • No posts to display.