Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Yes, use temperature (AO) virtual node to set temperature and digital output (DO) to switch on and on procedure.bri wrote: Ok, I was looking at it the wrong way , I've found a solution.
I've added another virtual analogue output module for setting the temperature and trigger the heating control via an event handler.
Please Log in or Create an account to join the conversation.
public void Setup() {
EventHelper.ModuleChangedHandler((o, m, p) =>
{
if (m.Domain == Domains.VIRTUAL && m.Address == "N4S0" && p.Property == "Sensor.Temperature") {
ModuleParameter temp = ModuleHelper.GetProperty(Domains.VIRTUAL, "N10S0", "Sensor.Temperature");
ModuleParameter settemp = ModuleHelper.GetProperty(Domains.VIRTUAL, "N4S0", "Sensor.Temperature");
if (temp!= null && temp.DecimalValue<settemp.DecimalValue) {
DriverHelper.ProcessCommad(Domains.VIRTUAL, "N9S0", "ControlOn", "");}
else {
DriverHelper.ProcessCommad(Domains.VIRTUAL, "N9S0", "ControlOff", "");}
return true;
}
});
}
Please Log in or Create an account to join the conversation.
bri wrote: I'm having an issue tying a handler to the temperature (AO)
Here's what I have:public void Setup() { EventHelper.ModuleChangedHandler((o, m, p) => { if (m.Domain == Domains.VIRTUAL && m.Address == "N4S0" && p.Property == "Sensor.Temperature") { ModuleParameter temp = ModuleHelper.GetProperty(Domains.VIRTUAL, "N10S0", "Sensor.Temperature"); ModuleParameter settemp = ModuleHelper.GetProperty(Domains.VIRTUAL, "N4S0", "Sensor.Temperature"); if (temp!= null && temp.DecimalValue<settemp.DecimalValue) { DriverHelper.ProcessCommad(Domains.VIRTUAL, "N9S0", "ControlOn", "");} else { DriverHelper.ProcessCommad(Domains.VIRTUAL, "N9S0", "ControlOff", "");} return true; } }); }
This returns an error: Error CS1643 in line 2 column 36, Not all code paths return a value in lambda expression of type 'System.Func'
Please Log in or Create an account to join the conversation.