the line above this declared pVal and in this line of code you are adding it as a string..."pVal" the code is expecting a value so you would have to do it like this.
Error CS0019 in line 8 column 11, Operator `>' cannot be applied to operands of type `GenericDriver.ModuleParameter' and `int'
Program disabled, fix errors first.
Here is the code
public void Setup()
{
EventHelper.ModuleChangedHandler((o, m, p) =>
{
// filter digital switch - change module address
if (m.Domain == Domains.MYSENSORS && m.Address == "N1S0" && p.Property == "Sensor.DigitalValue"){
ModuleParameter n = ModuleHelper.GetProperty(Domains.MYSENSORS, "N0S0", "Sensor.LightLevel");
if (n > 50) {
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N10S0", "Sensor.DigitalValue", "1");
}
}
return true;
});
}
Error CS1525 in line 7 column 23, Unexpected symbol `.', expecting `,', `;', or `='
Error CS1525 in line 7 column 78, Unexpected symbol `N0S0', expecting `,', `;', or `='
Error CS1525 in line 7 column 86, Unexpected symbol `Sensor.LightLevel', expecting `,', `;', or `='
Program disabled, fix errors first.
Here is the code
public void Setup()
{
EventHelper.ModuleChangedHandler((o, m, p) =>
{
// filter digital switch - change module address
if (m.Domain == Domains.MYSENSORS && m.Address == "N1S0" && p.Property == "Sensor.DigitalValue"){
ModuleParameter n.Value = ModuleHelper.GetProperty(Domains.MYSENSORS, "N0S0", "Sensor.LightLevel");
if (n.Value > "50") {
DriverHelper.ProcessCommad(Domains.MYSENSORS, "N10S0", "Sensor.DigitalValue", "1");
}
}
return true;
});
}
welcome to my world....I normally get 1000 errors and then I have no idea what i did to fix it...
you only need to change the n.Value on the (n.Value > "50") when you declared the first n in ModuleParameter you only put
ModuleParameter n =ModuleHelper.GetProperty
when then happens is the n variable is populated with the data on the server. so there is Value, Name, Description, Unit etc etc....so if you wanted to return one of those values then after you have instansiated the variable you can do stuff like n.Value or n.Description or whatever you need.
PS... I am not 100% sure if its if (n.Value > "50") or if (n.Value > 50) I am pretty sure its the first