• phildunlap phildunlap

    Hi Andreas, welcome to the forum!

    I think, I have to set the localDevice as a receifer in the notifications class on the the remote device.

    Yes, this is correct. You need to add your device as a destination in the recipientsList property on a notificationClass object. Then, on the object you wish to use that notification class to handle cases of intrinsic reporting, you set the notificationClass property on the object doing the intrinsic reporting to the object instance number of the notificationClass object you wish to use.

    You may need to try a CreateObjectRequest if the remote device doesn't have any existing notification classes.

    posted in BACnet4J general discussion read more
  • phildunlap phildunlap

    Hi N8Hart, welcome to the forum!

    The batch file can be terminated normally and I don't see any errors in the log file

    The batch file should open a CMD window which stays open until closed (a hard kill to the process running in it) or Ctrl+C to tell Mango to shut down. If it opens and closes quickly there was some error during startup.

    To check what the error is, if it's going to stderr and not into the log file, you can open a command prompt and

    cd C:\Path\To\Mango\bin

    and then it will not close the window when it experiences the error and you can post the output or search if it has already been answered.

    posted in Mango Automation Installation read more
  • phildunlap phildunlap

    @craigweb said in SNMP Publisher / Agent:

    Hi @ricardo

    Mango only has 4 publishers: BACnet, Modbus, Mango PTCP and an HTTP publisher

    Also Twilio and Pachube.

    posted in Mango Automation general Discussion read more
  • phildunlap phildunlap

    Hi Ricardo,

    No, Mango does not currently have an SNMP publisher.

    Can Mango send SNMP traps as an Event Handler type?

    Yes, but it isn't really set up to make such a thing easy. I think we'd best to have a running SNMP data source and use some reflection, something like this, in a Set Point Event Handler,

    var snmpDataSourceId = com.serotonin.m2m2.db.dao.DataPointDao.instance.getIdByXid("DS_XID_HERE");
    var snmpDataSourceRT = com.serotonin.m2m2.Common.runtimeManager.getRunningDataSource( snmpDataSourceId );
    if( snmpDataSourceRT !== null ) {
        var field = snmpDataSourceRT.getClass().getDeclearedField("snmp");
        field.setAccessible( true );
        var snmp = field.get( snmpDataSourceRT );
        //get the SNMP version information
        field = snmpDataSourceRT.getClass().getDeclearedField("writeVersion");
        field.setAccessible( true );
        var writeVersion = field.get( snmpDataSourceRT );
        //get the target to send it to
        var target = writeVersion.getTarget( "", 162, 1, 5000 ); //host, port, retries, timeout
        //construct the PDU
        var pdu = writeVersion.createPDU();
        if( target.getVersion === ) {
            pdu.setType( org.snmp4j.PDU.V1TRAP );
            pdu.setEnterprise( new org.snmp4j.smi.OID( "") ); //probably a clever way to get the OID from the event
            pdu.setGenericTrap( org.snmp4j.PDUv1.ENTERPRISE_SPECIFIC );
            pdu.setSpecificTrap( 1 ); //looks like this may need to cycle in value 1-5
            pdu.setAgentAddress( new org.snmp4j.smi.IpAddress( "" )); //Mango's IP on the network here
            snmp.send( pdu, target );
        } else if ( target.getVersion === ) {
            throw "not yet implemented!";
        } else if ( target.getVersion === ) {
            throw "not yet implemented!";
        } else
            throw "unknown snmp version!";
    } else {
        throw "Data source not found to send trap for event: " + event;
    return UNCHANGED; //don't set from the set point handler

    I would be somewhat surprised if this works, but it shouldn't be too far from the way to do it. I consulted this site for the V1 implementation, and there is also a v2c example:

    So, possible, but will probably take some trial and error to figure out.

    posted in Mango Automation general Discussion read more
  • phildunlap phildunlap

    Hi techalton,

    This is the git issue it is being tracked in:

    Michel has responded and it looks like Terry has coded a prospective solution to this specific issue, but that it needs review / assistance to generalize the relaxing of the type checking in reading properties from other devices.

    posted in MangoES Hardware read more
  • phildunlap phildunlap

    No worries, the data file data source probably requires the most Java knowledge outside of writing scripts that invoke the code. Even then, the scripts get to benefit from JavaScripts willingness to store any ole' type into a variable, where everything needs to be properly typed and declared in the data file classes. Tricky when there are but few examples and it's closed source!

    I would guess there was an informative event raised about a failure to instantiate the poll class, but I couldn't say.

    posted in User help read more
  • phildunlap phildunlap

    The issue with the poll class it will not work as an abstract class, it must be able to be instantiated so that it may be run. I just tested and was able to set values to data file points when my poll class looked like this:

    import com.infiniteautomation.datafilesource.rt.AbstractPollClass;
    import com.infiniteautomation.datafilesource.rt.PollClassInvoker;
    import com.serotonin.m2m2.rt.dataImage.DataPointRT;
    import com.serotonin.m2m2.rt.dataImage.PointValueTime;
    import com.serotonin.m2m2.rt.dataImage.SetPointSource;
    public class PutPollClass extends AbstractPollClass {
    	public void run(long time, PollClassInvoker invoker, String[] arguments) {}
    	public boolean setPointValueImpl(DataPointRT dataPoint, PointValueTime valueTime,SetPointSource source) {
    		return true;

    Remember, you'll need to recompile the class, and then restart the data source for the modifications to be applied.

    posted in User help read more
  • phildunlap phildunlap

    Hi jleblancmango,

    How did you set up your path? Can you set the JAVA_HOME environment variable to your JDK directory? Either that, or you'd need to make sure the jar.exe file is in one of the locations defined by the "Path" environment variable for the user that is launching Mango.

    posted in User help read more
  • phildunlap phildunlap

    Hi Fox,

    Can you post your poll class? What is the logging type of your points?

    The PUT endpoint behaves like a set through Mango. If the user your PUT'ing the value through the API has permission to set the point, you should see that get to the poll class's method I said you had to implement:

    public boolean setPointValueImpl(DataPointRT dataPoint, PointValueTime valueTime,
                SetPointSource source)

    You could do something in this method to prove to yourself it got there. If that returns true, then it will call setPointValue on the DataPointRT and that has some subtleties from logging type.

    EDIT: Alternatively, how hard would it be to convert the Data File datasources into Virtual datasources? If I could manage that, it would save a lot of fluff.

    You would have to do some work to ensure the id to xid set was the same (i.e. SELECT id, xid FROM dataPoints; and save that to make a bunch of update statements for the modified points. Here's an old python script that will convert all data source and data points in a JSON file to virtual sources and points (you may want to make them no change point locators):

    You would have to delete the old, import the new, and then run the SQL update statements to set the ID based on the XID such that old data wasn't lost. So, possible by maybe not trivial.

    posted in User help read more
  • phildunlap phildunlap

    Hi Thomas, thanks for bringing this to our attention!

    I have created a git issue for this in the Modbus module's repo.

    posted in Dashboard Designer & Custom AngularJS Pages read more