TRI0N Posted March 8, 2023 Posted March 8, 2023 Here is just a simple example of a dynamic web page build. This is simply a file that will be built and then my main designs in php/mysql will parse this data either into my touch screen console home screen, to database (temps) or both (contact/motion sensors). Right now my problem is just the Zooz ZSE44 Information. I can't seem to get the variable value for each Temp or Humidity. I've tried just using the standard ST for Status, 1 for first int value, temp, te, etc... In the example I have 1 but It just posts 1. The alert is working fine and it's building the page perfectly and I'm able to parse whatever I'm looking for for each of my data needs, just stumped on getting that value into the the build. The light was easy for the Kasa Node. ST being Status and CV being Current Voltage. No brainer on that one but the Zooz, FIDDLESTICKS! Code: <div id="post_stamp">${alert.date}, ${alert.time}</div> <div id="alert_1_level">Alert Level: ${var.61.1}</div> <div id="alert_light_1_st">Alert Light Status: ${sys.node.n001_1c61b4674b3403.ST}</div> <div id="alert_light_1_cv">Alert Light Current Voltage: ${sys.node.n001_1c61b4674b3403.CV}</div> <div id="o_temperature_1">Outside Temperature: ${sys.node.ZY019_118.1}</div> <div id="o_humidity_1">Outside Humidity: ${sys.node.ZY019_373.1}</div> Build Page Results: 2023/03/07, 10:21:59 PM Alert Level: 3 Alert Light Status: Off Alert Light Current Voltage: 117.84 Volts Outside Temperature: 1 Outside Humidity: 1 Any help on this would be great... TRI0N
Solution mjrush Posted March 8, 2023 Solution Posted March 8, 2023 (edited) I use ${sys.node.ZY020_118.CLITEMP} and Humidity ${sys.node.ZY020_373.CLIHUM}. The wiki has a list of variable substitutions. https://wiki.universal-devices.com/index.php?title=ISY-994i_Series:EMail_and_Networking_Substitution_Variables#User_Variables. Edited March 8, 2023 by mjrush 1
TRI0N Posted March 8, 2023 Author Posted March 8, 2023 (edited) 8 hours ago, mjrush said: I use ${sys.node.ZY020_118.CLITEMP} and Humidity ${sys.node.ZY020_373.CLIHUM}. The wiki has a list of variable substitutions. https://wiki.universal-devices.com/index.php?title=ISY-994i_Series:EMail_and_Networking_Substitution_Variables#User_Variables. FANTASTIC! Ahhh and a .raw extension!!!! WooHoo! Cool now I can just output unformatted text where UTF-8 Unicode Latin-1 "°" was used to represent the Degree Symbol in the output rather than using "°" in place for output of the degree symbol. Where I had to parse that out for specific lines dealing with temperatures. Less parser code work needed. Though it wasn't really a problem it just a pain to go through all the ones that are temp based outputs. I may play with Meta UTF-8 in the HTML output to see if that will revert it to the correct format but I don't think that will help since the build is outputting data before any Character Set. Thinking about it, it might just revert to HTML Unicode by using the .url extension for on screen purposes, but otherwise once I have all the data exporting in the build, all the formatting and descriptions will be removed so that it's simply the data between DIV ID's. This parsing the data into a database for Climate, Tripped Sensors, etc. I'll deal with real formatting in the automation homepage as it parses such data using a cron job every time changes are made to the page. THANKS A TON @mjrush TRI0N Edited March 9, 2023 by TRI0N
TRI0N Posted March 9, 2023 Author Posted March 9, 2023 (edited) Okay after playing, all is working. The idea using the .url extension does not however parse Degree. The solutions would be to either include HTML formatting inside your Custom Notification. I'm not sure on the limits of this. But I will be surely pressing them in the next day or two. I will offer an example for others that run down this path. The other option would be to just add the %deg;F by using the raw format. Example of using just using the raw formatting no Character Set: <div id="noaa_sbd_temperature">Temperature: ${sys.node.n005_controller.CLITEMP.raw}°F</div> Example of using HTML to force UTF-8 without the Latin-1 default. <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Fort Lisso | NOAA Weather Information</title> </head> <body> <div class="noaa"><b>NOAA</b> San Bernardino County Airport (SBD) Weather Data<br> <div id="noaa_sbd_temperature">Temperature: ${sys.node.n005_controller.CLITEMP}</div> <div id="noaa_sbd_humidity">Humidity: ${sys.node.n005_controller.CLIHUM}</div> <div id="noaa_sbd_dew_point">Dew Point: ${sys.node.n005_controller.DEWPT}</div> <div id="noaa_sbd_barometric_pressure">Atmospheric Pressure: ${sys.node.n005_controller.BARPRES}</div> <div id="noaa_sbd_wind_speed">Wind Speed: ${sys.node.n005_controller.SPEED}</div> <div id="noaa_sbd_wind_direction">Wind Direction: ${sys.node.n005_controller.WINDDIR}</div> </div> </body> </html> Tomorrow I will be testing some php inside the Custom Notifications. For example the WINDDIR either says "No Wind" or the degree the wind is traveling. I need to valuate the degrees into a compass conversion N|NE|E|SE|S|SW|W|NW directions based on standards if value is != "No Wind". So I'll see how it does with PHP next and looks like this will be a breeze to build custom interfaces with. I have yet to look at the AJAX examples of controlling devices. But for now. Extracting data needed and finding limitations is my focus. I did look at the Web Portal just to get an idea of operations and Good Lord! That obviously needs work and right now not my focus. I used the Airport for an example because I have no desire to track SBD weather and will be including the Custom Notification I make for a on_over Pop-Up.. While home outside temperatures and such will be parsed from my main Custom Notification that is made every 1 minute from raw into MySQL for historical data, sensor trip counts, etc, etc, Again thanks! TRI0N Edited March 9, 2023 by TRI0N
TRI0N Posted March 9, 2023 Author Posted March 9, 2023 (edited) Not sure if eisy is actually trying to tick people off or make things extremally difficult. PHP? LOL Yeah right... Access to file location via LAN? LoL yeah right... Pull up homepage without needing to login? Lol Yeah right... Dynamic Webpages? EXTREAMLY LIMITED!!!! You need to change your passwords so they can pass through a http://username:password@local-ip:8080/FILES/USER/WEB/status.htm.... RIght... That would defeat your entire OVERKILL on security for viewing an html page passing your username and password thru HTML because the ENTIRE local directory (var/isy/FILES/USER/WEB) cannot be accessed even SSH to create a local network share. Honestly I don't see what exactly I'm suppose to do with such limitations. Why can't we even SU to access that? But to top it off for some odd reason I logged in to eisy via SSH and find out the admin password is NOT my password, but "admin". Are you freaking kidding me? Not exactly the expectation I was looking for. TRI0N Edited March 9, 2023 by TRI0N
TRI0N Posted March 10, 2023 Author Posted March 10, 2023 (edited) Done venting.. Now the test I performed worked. It did indeed built a the php file perfectly and the data is correct. As I was talking about yesterday putting in a code that would take degrees and turn it into wind cardinal directions. The problem is there is no PHP Server so you can't view the page, it downloads like a file but it is indeed budling the php correctly. I don't want to install something that isn't approved or might break the eisy security integrity. Honestly I need is the ability to read that directory via a mounted share on my RH Linux Server where I do have Apache and PHP running the latest. I just need to be able to pull that page locally from the eisy without passing username and passwords. Example of the code I used to test: (could be useful for others to use later if this ever becomes more assessable) <?php //Force Refresh header("Cache-Control: no-store, no-cache, must-revalidate") ; //Wind Direction Degree from eisy NOAA Data $degree = '${sys.node.n005_controller.WINDDIR.raw}' ; //If No Wind if ($degree == 'No Wind') { $wind_direction = $degree ; goto b ; } //Convert Degree to Cardinal if ($degree >= '348.76' && $degree <= '360') { $cardinal = 'N' ; goto a ; } if ($degree >= '0' && $degree <= '11.25') { $cardinal = 'N' ; goto a ; } if ($degree >= '11.26' && $degree <= '33.75') { $cardinal = 'NNE' ; goto a ; } if ($degree >= '33.76' && $degree <= '56.25') { $cardinal = 'NE' ; goto a ; } if ($degree >= '56.26' && $degree <= '78.75') { $cardinal = 'ENE' ; goto a ; } if ($degree >= '78.76' && $degree <= '101.25') { $cardinal = 'E' ; goto a ; } if ($degree >= '101.26' && $degree <= '123.75') { $cardinal = 'ESE' ; goto a ; } if ($degree >= '123.76' && $degree <= '146.25') { $cardinal = 'SE'; goto a ; } if ($degree >= '146.26' && $degree <= '168.75') { $cardinal = 'SSE' ; goto a ; } if ($degree >= '168.76' && $degree <= '191.25') { $cardinal = 'S' ; goto a ; } if ($degree >= '191.26' && $degree <= '213.75') { $cardinal = 'SSW' ; goto a ; } if ($degree >= '213.76' && $degree <= '236.25') { $cardinal = 'SW' ; goto a ; } if ($degree >= '236.26' && $degree <= '258.75') { $cardinal = 'WSW' ; goto a ; } if ($degree >= '258.76' && $degree <= '281.25') { $cardinal = 'W' ; goto a ; } if ($degree >= '281.26' && $degree <= '303.75') { $cardinal = 'WNW' ; goto a ; } if ($degree >= '303.76' && $degree <= '326.25') { $cardinal = 'NW' ; goto a ; } if ($degree >= '326.26' && $degree <= '348.75') { $cardinal = 'NNW' ; goto a ; } //Build Wind Direction Information a: $wind_direction = $degree.'° [ '.$cardinal.' ]' ; goto b ; //End Wind Direction b: //Continue Testing Other Needs //Climate ZSE44 Sensors for Data Entry Test ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="refresh" content="60"> <title>Fort Lisso | Home Beta - No Cosmetics</title> </head> <body> <div id="noaa_sbd_wind_direction">Wind Direction: <?php echo $wind_direction ; ?></div> </body> </html> What It would have produced if it was PHP enable:Wind Direction: 250° [ WSW ] At this point my entire idea of building the console the way I want obviously has serious restrictions that shouldn't be. It can make the php file and the values, but you can't load a php off the eisy, no documentation or discussion of PHP that I found. Not being able to access the web without a login is also hindering the abilities. There is so much that could be done. Honestly I'm really disappointed in this. TRI0N Edited March 10, 2023 by TRI0N
TRI0N Posted March 11, 2023 Author Posted March 11, 2023 (edited) Since we can't access the eisy without passing HTML Auth through plain text and "rest" doesn't work at all since php isn't enabled and well you can't even create a .htaccess file nor can you copy it over via your own interface (irony) due to file type validation, nor can you upload it as htaccess.txt and rename it to .htaccess, yeah I tried that too, it won't allow you . So I had to program a script to login eisy grab my data xml. parse it to database. The script is called each time any of the automation pages are loaded. This bypassing any plain text auth in a user session and keeping the auth completely server side. Yes that's a pretty wacky way of doing it, but it WORKS and is more secure than sending Auth via plain text using a user session. Downside: Too many to list but most notably a possible slight delay with large amount of data being parsed before the page loads. Basically you have to do three jobs when it could be just one job. FYI: if you're wondering why I'm concerned about passing Auth via HTML on a local connection between eisy and my RH Linux Server? I'm not just designing a home panel display. I have admin pages I plan to use and be able to access remotely and this is where HTML Auth is NOT happening... At least not with any eisy login. Which only bring up another frustration that the eisy is NOT creating and saving users you create through the UDAC. So I can't just make a user just for that purpose. You have to use the admin account and that's obviously a "Not Happening" moment. TRI0N Edited March 11, 2023 by TRI0N
TRI0N Posted March 11, 2023 Author Posted March 11, 2023 Could you imagine the reports and interfaces I could make if it was more accessible? I did this for a gaming community on my free time. Took about 4 weeks to complete. Should help understand my frustration. What I could do, but... TRI0N
Recommended Posts