blueman2 Posted October 10, 2015 Posted October 10, 2015 Can ISY put a variable value into the body of a REST PUT command? You could have echo put the requested temp value for a thermostat command into an ISY variable, and then have ISY send the REST command to NEST inserting the variable value... Or is this something we are waiting for the 5.x firmware to support? Great idea!! I am on 5.02 now, but cannot find a way to include a variable as part of a PUT/POST command. I will ask in the 5.0 area if this is possible. But you are right, this would be a very nice way to do it. Quote
jruben4 Posted October 10, 2015 Posted October 10, 2015 Great idea!! I am on 5.02 now, but cannot find a way to include a variable as part of a PUT/POST command. I will ask in the 5.0 area if this is possible. But you are right, this would be a very nice way to do it. I thought I saw somewhere this was going to be in 5.x.... can you put $VARNAME in the body of the post command? Quote
jruben4 Posted October 10, 2015 Posted October 10, 2015 For those still manually programming the hue bridge, this code worked for me. An echo command of "set thermostat to 72" will change the ISY variable. { "name": "Thermostat", "deviceType": "switch", "offUrl": "http://UN:PW@IP/rest/vars/set/1/4/${intensity.percent}", "onUrl": "http://UN:PW@IP/rest/vars/set/1/4/${intensity.percent}" } Quote
barrygordon Posted October 10, 2015 Posted October 10, 2015 (edited) There is a new feature coming out for the HUE Emulator by BWS systems. This will allow for a suffix of the form ${intensity.math(<function of X>)} Where the function of X is the body of a function you would like evaluated with X as the input to the function. The emulator takes whatever the Echo sends as the spoken value and sets that as the value of X. This allows you to write such things as ${intensity.math(2*X)}. This capability is not quite ready yet. but I suspect will be next week. The next version of the AWS configuration system will allow for the setting up of the math expression. as part of either the onURL or offURL. There will be a new button named "Use Math" which will open a dialog box to allow you to define the function. I am not yet using ISY version 5.x.x but will be switching to that shortly. I will add the ability to the configuration system to form the URL to reference a variable of the integer or state type. For the state type the onURL will set the variable to true (1), the offURL will set it to false (0) . For integer variables the value will be the spoken word with some limitation. The following is what I have gleamed from trying things and looking at whet the emulator receives from the Echo: The Echo does not handle all spoken integers. If using the word 'Set" then the integer spoken (1 to 99) is taken as a percentage of 255. If you say 'Alexa set . . . to 75'; the echo sends the emulator a value of 191 since 191=.75*255. When I get the time I will look at other Echo phrases involving values, such as 'Alexa dim . . . . to xx', IIRC, Alexa sends a value that is a multiple of 10 so dimming or brightening occurs in steps of 10% Edited October 10, 2015 by barrygordon Quote
jruben4 Posted October 10, 2015 Posted October 10, 2015 Maybe dumb question, but what is the "HUE Emulator by BWS systems"? Is this the hue bridge we've been using from the beginning (at https://github.com/armzilla/amazon-echo-ha-bridge)? Quote
barrygordon Posted October 10, 2015 Posted October 10, 2015 I am not sure since the link you supplied yields a 404, page not found. the Hue Bridge had a limit of about 22 devices. A newer version of the emulator was written by the person who owns BWS systems (bwssystems.com) and handles about 44 devices. Many ISY people have switched over to it. I wrote a configuration system for that version (if you are on the original, think Mapper) which understands the ISY and starts by reading the complete configuration of the ISY and that of the emulator. It then runs with very little typing in a click/select environment making l;ife a lot easier (at least for me) Quote
jruben4 Posted October 10, 2015 Posted October 10, 2015 (edited) Yeah, sounds like something different than I've been using. https://github.com/armzilla/amazon-echo-ha-bridge Or maybe it is the forked development of the original bridge. Looks like the operation is very similar. Edited October 10, 2015 by jruben4 Quote
barrygordon Posted October 10, 2015 Posted October 10, 2015 I believe it was a complete re-write with attribution to the original author. The original version did not really understand the ISY but rather the Me Casa Verde product. The new version of the emulator when coupled with my Configuration system knows how to deal with the ISY as it builds the commands for the emulator. Quote
blueman2 Posted October 11, 2015 Posted October 11, 2015 There is a new feature coming out for the HUE Emulator by BWS systems. This will allow for a suffix of the form ${intensity.math(<function of X>)} Where the function of X is the body of a function you would like evaluated with X as the input to the function. Looks like the 0.4.8 version with that support is already up. Running it now. Thanks for communicating to BWS! BTW, how does BWS support it's development costs? I was thinking of doing a small donation to them for the emulator they are working on. Quote
barrygordon Posted October 11, 2015 Posted October 11, 2015 (edited) Yes I know 4.8 is up. I have a problem with it if the function does a division. The emulator throws an error on trying to cast a double, the result of the divide, to an integer. It is obvious in the emulators debug log file. BWS systems has been told. Also the documentation is bad on describing the ${ . . . }. ${intensity.math()} is the correct format. I have a new version of the configuration system that handles variables and builds the correct URLs and also allows for the setting up of a function. If you want an advance copy drop me an email so I know where to send it. I am holding off putting it on the web site until the emulator is corrected. I am not sure how BWS supports its development, ask them. Edited October 11, 2015 by barrygordon Quote
blueman2 Posted October 12, 2015 Posted October 12, 2015 (edited) Eric, When I try to get my session key, I keep getting this response (removed my client info of course) {"url":"/oauth2/access_token?code=xxxxxx&client_id=xxxxxx&client_secret=xxxx&grant_type=authorization_code","message":"404 Not Found"} Any thoughts? Maybe a CORS issue?? Also, any new family additions yet???? Edited October 12, 2015 by blueman2 Quote
jruben4 Posted October 12, 2015 Posted October 12, 2015 (edited) With the ha-bridge, it claims it can't access my device.db file so doesn't write any new devices to any file. I set up the default subdirectory (data) and chmod 777 it. If I create a blank device.db file in there, then the bridge totally bombs out. Shouldn't it create the device.db file if it doesn't exist yet? Edited October 12, 2015 by jruben4 Quote
blueman2 Posted October 12, 2015 Posted October 12, 2015 jruben4, I just noticed this issue as well today. Not sure what is going on, whether it is the ha-bridge software or Barry's mapping tool. I just copied a db file from another location, used Barry's tool to delete the devices in it, and went from there. Very odd. Quote
barrygordon Posted October 12, 2015 Posted October 12, 2015 I have never seen that, but then again I can't recall the last time I ran without a .db file present. I will try and isolate it tomorrow, but I don't think it is the configuration system, but will look anyways. I have been wrong before. The configuration system does start by requesting the db file from the emulator, so it is possible it is not handling the case where it is missing correctly. Quote
jruben4 Posted October 13, 2015 Posted October 13, 2015 It doesn't come with a db file. Can someone post a very simple db file so I can at least start it and modify it? Quote
blueman2 Posted October 13, 2015 Posted October 13, 2015 (edited) OK, something broke with the BWS emulator after 0.4.4 if running under Windows environment. I am running 0.4.8 just fine on my RPi, but trying to run it on my PC fails to write to the db file. But it does not sound like you are running under Windows, since you talk of chmod 777. But in any case, try to use 0.4.4. If you cannot find the legacy file on their site, I can email it to you. EDIT: Here is the link to 0.4.4 version if you need it. Edited October 13, 2015 by blueman2 Quote
jruben4 Posted October 13, 2015 Posted October 13, 2015 Thanks. I'm using Pi. Version 0.4.4 was able to create a fresh device.db file, and now I can go back to running 0.4.8 now that it exists. Quote
blueman2 Posted October 13, 2015 Posted October 13, 2015 Thanks. I'm using Pi. Version 0.4.4 was able to create a fresh device.db file, and now I can go back to running 0.4.8 now that it exists. But just make sure you can really save changes in 0.4.8. For windows, 0.4.8 would access the file, appear to edit and delete, but never saved any changes. Quote
barrygordon Posted October 13, 2015 Posted October 13, 2015 (edited) For those having issues with the Emulator and no device.db file. From the Author of the emulator: The device.db file is loaded on startup only and then it's managed from memory. When an update is done to the file It is renamed, the new file is written and then the old renamed file is deleted. Also, the file is only used to read from on startup. The device.DB should not be stored in a privileged location i.e. accessible only to root. I store all the Emulators working files in /home/pi/echobridge. I use two sub directories at that location, "logs" and data", so my four device.db files are in /home/pi/echobridge/data and any log files are in /home/pi/echobridge/logs. the jars I use are all in /home/pi/echobridge and the start up commands are located in the bash script /etc/rc.local which is a privileged (root access only) file. I use WINSCP to access the RPi files from my PC as I did not set up Samba on those systems. I believe a blank device.db file can be "", "[]" or "[{}}]", but I am not sure. I trust the Emulator to handle the issue of a missing device.db file. But remember it only reads that file when the emulator starts up. Deleting the file while the emulator is running has no effect on the running instance of the emulator, and if you do something that causes the emulator to need to update the device.db file it might crash the emulator as it is not there to be renamed and deleted. I have never run the Emulator on Windows. Edited October 17, 2015 by barrygordon Quote
jruben4 Posted October 13, 2015 Posted October 13, 2015 I can confirm that at least in Linux, version 0.4.8 can not create a new device.db file if non exists. 0.4.4 will however. Quote
barrygordon Posted October 13, 2015 Posted October 13, 2015 Try starting the emulator and when it fails, start it again. I do this by rebooting my system as that is the easiest way for me. How about if the Device.db file exists but is empty when you start the emulator? Does it give you a problem? Where is your device.db file stored on the system? Quote
jruben4 Posted October 13, 2015 Posted October 13, 2015 With 0.4.8 had the same error every time I started the emulator, of missing device.db file and it would not create one if I added devices (program would continue running though). It was stored in the default spot (/data/device.db). A completely blank device.db file (created with linux touch command) would cause the program to bomb out. Quote
barrygordon Posted October 13, 2015 Posted October 13, 2015 Did you have any luck with a device.db file that was "[]" (open and close square brackets) or "[{}]".? I will discuss this with the author or you can just send an email to info@bwssystems.com and explain what you have found Quote
jruben4 Posted October 13, 2015 Posted October 13, 2015 It seems ok with a device.db file of just [] Quote
blueman2 Posted October 13, 2015 Posted October 13, 2015 The developer sent me an email saying he found a bug that was causing this issue, at least for Windows environments. This fix should be rolled into the next drop. Not sure when. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.