Jump to content

Notes field


barrygordon

Recommended Posts

There is a field that can be set for devices called "notes".  Is this described anywhere?  Can it be retrieved by command e.g. over the REST interface as part of the configuration, nodes , . . .. It seems it might be a simple place to provide information that can be used by external systems when dealing with the ISY befor eversion 5 becomes fully available (out of alpha/beta) .  I could use it right now to provide aliases for the device names to use with the Amazon Echo.

Link to comment

Yes there is a comments field.  I do not know if there is any way to retrieve it by a program using the REST interface as there is for a Notes field in a Node.  LeeG?

 

Having a free form(XML or JSON could be used)  field associated with scenes and programs allows one to place auxiliary information needed for some external process like an http endpoint running an Amazon Echo skill. 

Link to comment

I have notices that if I request /notes from a device where there are no notes, no 'Is Load'  and no 'Location' - you get an error indicating that the /CONF/xx.PRP file was not found. It's a 404 satus - but the html in the response messed with the xml parser (which is expecting xml).

 

Any chance the behaviour could be changed to send proper XML with empty fields rather than sending a 404 and error when there is no properties file for the device?

 

Michael.

Link to comment

Yes that is what happens.  In my code I first check the returned header to ensure it is a 200 status.  It returns the 404 since it could not find the file it was looking for, the Note object. If it is not a status of 200, I make up a dummy note that has isloaded set to false. here is a snippet of code that should illustrate the point:

 

Function getNodeNote(node As String) As ISYNoteType   ' return a note object based upon the note contained at the node
    Dim temp As String
    ISY_NodeNote = ""   ' indicate nothing received from the rEST request
    SendRestMessage "nodes/" + encodeURI(node) + "/notes", 4
    While ISY_NodeNote = ""   ' the TCP receiver will set ISY_Node note to the note that exists
        DoEvents
    Wend
    temp = Mid(ISY_NodeNote, InStr(ISY_NodeNote, vbCrLf + vbCrLf) + 4)  ' temp will = the returned body
    If InStr(ISY_NodeNote, "HTTP/1.1 200 OK") Then
        getNodeNote.isLoaded = True
        getNodeNote.Location = ExtractFromXML(temp, "location")
        getNodeNote.Spoken = ExtractFromXML(temp, "spoken")
        getNodeNote.Description = ExtractFromXML(temp, "description")
    Else
        ' there is a problem
        getNodeNote.isLoaded = False
    End If
 
End Function
 
Hope that helps
Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...