Script LUA to read value on a webpage ?

Moderator: leecollings

tinus
Posts: 2
Joined: Saturday 10 October 2020 16:51
Target OS: Windows
Domoticz version:
Contact:

Re: Script LUA to read value on a webpage ?

Post by tinus »

Thank for the help,

When is use the script from the lake level, i get the next response.
Some were in here the value is hidden can anyone help mee to extract it?

Tinus

Code: Select all

* string: <!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
   <head>
       <title>VBus.net Scheme-Designer</title>
       <meta charset="utf-8">
       <meta name="viewport" content="width=device-width, initial-scale=1">

       <!-- build:css styles/main.css -->
       <!--<link href="../../../bower_components/font-awesome-animation/dist/font-awesome-animation.css" type="text/css" rel="stylesheet" /> // bower lib has not all animations included -->

       <link href="bower_components/jquery-ui/themes/base/jquery-ui.min.css" type="text/css" rel="stylesheet" />
       <link href="bower_components/colorpicker/jquery.colorpicker.css" type="text/css" rel="stylesheet" />
       <link href="bower_components/weather-icons/css/weather-icons.css" type="text/css" rel="stylesheet" />
       <link href="bower_components/weather-icons/css/weather-icons-wind.css" type="text/css" rel="stylesheet" />
       <link href="bower_components/font-awesome/css/font-awesome.css" type="text/css" rel="stylesheet" />

       <link href="css/main-built.min.css" type="text/css" rel="stylesheet" />

      <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
      <link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png">

       <meta name="application-name" content="VBus.net" />
       <meta name="msapplication-TileColor" content="#009900" />

       <!--<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>-->
       <!-- endbuild -->

       <!-- build:js scripts/vendor/modernizr.js -->
       <!--<script src="./bower_components/modernizr/src/Modernizr.js"></script>-->
       <!-- endbuild -->
       <style>

       </style>
   </head>
   <body>
       <!--[if lt IE 11]>
           <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
       <![endif]-->
       <div class="navbar navbar-inverse navbar-fixed-top hide" role="navigation">
           <div class="container-fluid">
               <div class="navbar-header" style="margin-top:4px">
                   <a href="/#visualization/schemes">
                       <img src="./images/vbus.png" alt="logo" style="height:22px;border:none;margin-right:10px;" />
                   </a>
                   <i class="fa fa-sun-o"></i>
                   <b class="navbar-scheme-name"></b>
                   <input type="hidden" id="scheme_id" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                   <small class="hide">
                       <i class="fa fa-picture-o"></i>
                       <span class="navbar-image-name"></span>
                       -
                       <i class="fa fa-filter"></i>
                       <span class="navbar-filter-name"></span>
                   </small>
               </div>
               <div class="navbar-collapse collapse">
                   <ul class="nav navbar-nav navbar-right">
                       <div id="togglebar"></div>
                   </ul>
               </div>
           </div>
       </div>

       <div id="resol-vbus-visualization-scheme" class="resol-vbus-visualization-scheme"></div>

        <!-- build:js scripts/main.js -->
        <script data-main="scripts/main" src="bower_components/requirejs/require.js"></script>

<!--        <script src="lib/require.min.js"></script>
        <script>
            require.config({
                paths: {
                    //Comment out this line to go back to loading
                    //the non-optimized main.js source file.
                    "main": "scripts/main-built"
                }
            });
            require(["main"]);
        </script>
-->
       <!-- endbuild -->

    <div class="modal fade" id="modal-energy" tabindex="-1" role="dialog">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <h2 class="modal-title">&sum;&nbsp;/&nbsp;<i class="fa fa-bar-chart"></i> <span class="energyValues"></span></h2>
          </div>
          <div class="modal-body">
            <table class="table">
              <tbody>
                <tr>
                  <td valign="top" width="120px">
                    <label class="energy-label-year"></label>:
                  </td>
                  <td>
                    <div>
                      <input type="radio" name="energy-range-year" class="energy-range-year-current" checked />
                      <span class="energy-current-year"></span>
                    </div>
                    <div>
                      <input type="radio" name="energy-range-year" class="energy-range-year-previous" />
                      <span class="energy-previous-year"></span>
                    </div>
                  </td>
                </tr>
                <tr>
                <td valign="top">
                  <label class="energy-label-energyValuesRange"></label>:
                </td>
                <td>
                  <div>
                    <input type="radio" name="energy-range-month" class="energy-range-month-current" checked />
                    <span class="energy-range-month"></span>
                  </div>
                  <div>
                    <input type="radio" name="energy-range-month" value="selected" id="energy-range-month-selected" />
                    <select class="form-control" id="energy-selected-month" style="height:20px;width:120px;display:inline"></select>
                  </div>
                  <div>
                  <input type="radio" name="energy-range-month" value="year" />
                    <span class="energy-label-wholeYear"></span>
                  </div>
                  </td>
                </tr>
                <tr>
                  <td valign="top">
                    <label class="energy-label-view"></label>:
                  </td>
                  <td>
                    <div>
                      <input type="radio" name="energy-view" value="T" checked />
                      <span class="energy-label-textForm"></span>
                    </div>
                    <div>
                      <input type="radio" name="energy-view" value="D" />
                      <span class="energy-label-diagram"></span>
                    </div>
                    <div style="margin-top:10px;width:300px;">
                      <div style="margin-bottom:10px">
                        <input type="checkbox" id="energy-automatic-title" value="1" checked />
                        <span class="energy-automatic-title"></span>
                      </div>
                      <div style="margin-bottom:20px">
                        <input id="energy-width" type="range" min="140" max="500" step="10" value="280" />
                        <span class="energy-label-width"></span>
                        <span class="energy-width">280</span>px
                      </div>
                      <div>
                        <input id="energy-height" type="range" min="70" max="300" step="10" value="160" />
                        <span class="energy-label-height"></span>
                        <span class="energy-height">160</span>px
                      </div>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
          <div class="modal-footer">
              <button type="button" class="btn btn-default btn-reset-energy-format filteredId" data-dismiss="modal"></button>
              <button type="button" class="btn btn-primary btn-set-energy-format filteredId"></button>
          </div>
        </div>
      </div>
    </div>

  </body>
</html>
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Script LUA to read value on a webpage ?

Post by waaren »

tinus wrote: Sunday 11 October 2020 11:00 Some were in here the value is hidden can anyone help mee to extract it?
What do you mean with "the value"?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
jvdz
Posts: 2280
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Script LUA to read value on a webpage ?

Post by jvdz »

waaren wrote: Saturday 10 October 2020 17:29 [Edit] Sorry, did not see the solution from Jos.. But what about when newfilter="No" ?
The OP will have to define all possible changes / restrictions for the retrieved data first before it ever will be full-proof, so my simple regex was just to demonstrate how it can be done. ;)

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest