- Posts: 25
- Thank you received: 5
public void Setup()
{
EventHelper.ModuleChangedHandler((o, m, p) =>
{
bool returnValue = true;
if (m.Domain == "Virtual" && p.Property == "Sensor.AnalogValue")
{
returnValue = sendDataToEsp(m.Address, p.Value);
}
return returnValue;
});
}
Please Log in or Create an account to join the conversation.
medyk8ns wrote: Hello,
I have a question about EventHelper.
I am using ModuleChangedHandler to send data to ESP. Every time when virtual AnalogInput value is changed data is sent to ESP. I would like to be notified when for some reason data cannot be set(ESP is powered off, not connected to network or any Exception occured). How to achieve that?
I've tried following code, but that does not work as expected. Method sendDataToEsp returns true if data is successfully sent, otherwise false.
public void Setup() { EventHelper.ModuleChangedHandler((o, m, p) => { bool returnValue = true; if (m.Domain == "Virtual" && p.Property == "Sensor.AnalogValue") { returnValue = sendDataToEsp(m.Address, p.Value); } return returnValue; }); }
Is there any documentation for
public EventHelper ModuleChangedHandler(Func<object, Module, DriverPropertyChangedData, bool> handler)?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
medyk8ns wrote: I'm using ESP8266 alone. I am reading response from ESP8266 after sending data. If response is ok, then everything is fine. But if there is no response, connection error occurred or any exception is thrown then I would like to be notified about it.
I can use MailHelper or something, but is there a way to be notified about it in UI? Like builtin popup error message "Unable to set value for N1S0"?
I can create virtual node and set its value every time error occurs. But there is no way to set its value to string.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.