barrygordon Posted August 16, 2015 Posted August 16, 2015 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.
LeeG Posted August 16, 2015 Posted August 16, 2015 (edited) Sure. http://192.168.2.2/rest/nodes/33 95 41 1/notes <NodeProperties> <location>Location Bedroom</location> <description>Note text.</description> <isLoad>false</isLoad> <spoken/> </NodeProperties> Edited August 16, 2015 by LeeG
MWareman Posted August 16, 2015 Posted August 16, 2015 Cool! When did /notes get added to the REST interface? I have a .php script that does most thing via REST, but notes I've been getting via SOAP.
LeeG Posted August 16, 2015 Posted August 16, 2015 Notes was added in 4.3.10 according to the announcement.
Michel Kohanim Posted August 18, 2015 Posted August 18, 2015 LeeG, You are simply amazing! Thanks so very much. With kind regards,Michel
barrygordon Posted August 18, 2015 Author Posted August 18, 2015 It would be nice if the same "Notes" capability existed for Scenes and Programs. Scenes shouldn't be difficult to implement, but programs might be a bit tougher.
MWareman Posted August 18, 2015 Posted August 18, 2015 Away for the computer right now, but I thought programs did already have a 'Comments' section....?
barrygordon Posted August 18, 2015 Author Posted August 18, 2015 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.
MWareman Posted August 20, 2015 Posted August 20, 2015 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.
barrygordon Posted August 20, 2015 Author Posted August 20, 2015 (edited) 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 Edited August 20, 2015 by barrygordon
MWareman Posted August 20, 2015 Posted August 20, 2015 I agree, its easy enough to work around. It's just the 404 is syntactically correct for devices that don't exist, not so much for a /notes request for a device that does exist.
barrygordon Posted August 20, 2015 Author Posted August 20, 2015 But, The thing you asked for was the Notes entry, not the Node, and it does not exist; ergo the 404 is what should be returned IMHO
Michel Kohanim Posted August 20, 2015 Posted August 20, 2015 Hi MWareman, I must agree with barrygordon. The resource does not exist! With kind regards, Michel
Recommended Posts