diff --git a/css/creative.css b/css/creative.css index 550101a8..79348070 100755 --- a/css/creative.css +++ b/css/creative.css @@ -1332,6 +1332,7 @@ Only add this hover on NON touch devices .col-data { width: calc(100% - 45px); float: left; + text-shadow: 0px 0px 10px black; } .right2col { @@ -3972,6 +3973,9 @@ canvas { background-position: center; background-repeat: no-repeat; background-size: cover; +} + +.dial .background { border-radius: 50% } /*needed? Remove for now ... @@ -4469,4 +4473,38 @@ canvas { .publictransport .delay { background-color: red; color: white; -} \ No newline at end of file +} + +.waqi { + background-color: unset; + padding: 0px !important; + border: 0px; +} + +.waqi .dt_state { + margin: 0px; +} + +.waqi.xxl { + padding-top: 5px!important; + padding-left: 10px!important; +} +.waqi.xxl iframe { + background-color: #f6f9f7; + border: 1px solid white; + min-width: 100px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6); + -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6); + box-shadow: 0 1px 3px rgba(0,0,0,0.6); + margin-top: 10px; + margin-bottom: 10px; + margin-right: 10px; +} + +.publictransport .remarks +{ + font-style: italic; +} diff --git a/docs/blocks/domoticzblocks.rst b/docs/blocks/domoticzblocks.rst index 3c093171..81953af7 100644 --- a/docs/blocks/domoticzblocks.rst +++ b/docs/blocks/domoticzblocks.rst @@ -35,6 +35,8 @@ You can also use custom names for the block identfier. In that case you have to } +.. _grouped_devices: + Grouped devices --------------- To use grouped devices in a column you must make it known in your CONFIG.js as follows:: @@ -54,6 +56,11 @@ Now you can add all 3 light blocks to a column with the following code:: 'lights' ] +All the blocks within such a group can be styled in custom.css all at once:: + + [data-id='lights'] .title { + color: yellow + } Scenes and Groups ----------------- @@ -233,6 +240,17 @@ Block parameters * - switchMode - | Click behavior RGBxx devices | 'color': Open the colorpicker popup window instead of device switch on/off + * - backgroundimage + - url or Domoticz text device id containing the url of the background image. See :ref:`blockbackground` + * - backgroundsize + - | Size of the background image. See :ref:`blockbackground` + | ``'80%'``: Scale the image to 80% of the block size + | ``'cover'``: Scale the image so that the image completely covers the block + | ``'contain'``: Scale the background image so that the image is contained within the block + * - backgroundopacity + - | Sets the opacity of the background image. See :ref:`blockbackground` + | ``1`` (=default): Opacity of 100% + | ``20%``: Opacity of 20% There are several additional parameters for Graphs. See :ref:`dom_graphs` @@ -691,6 +709,35 @@ All parameter names are case sensitive. For more fancy computations you can create your custom getStatus function in custom.js +.. _blockbackground : + +Block background image +---------------------- + +.. image :: img/blockbackground.jpg + +Via the ``backgroundimage`` parameter the url of a background image can be defined. +Instead of an url you can also fill in a Domoticz text device id. +This Domoticz text device should then contain the url pointing to the image to be used as background for the block. + +The size can be adjusted via the ``backgroundsize`` parameter, and the opacity can be set via the ``backgroundopacity`` parameter. + +Example:: + + blocks['curtains'] = { + idx: 179, + // backgroundimage: './img/curtains.png' + backgroundimage: 182, + backgroundsize: '50%', + backgroundopacity: 0.3, + } + +In the example above Domoticz device 182 is used to obtain the url of the background image. + +Example how to set the content of a Domoticz text device:: + + http://domoticz:8080/json.htm?type=command¶m=udevice&idx=182&nvalue=0&svalue=https://www.schoolplaten.com/afbeelding-huis-dl28257.jpg + .. _domoticzStyling: diff --git a/docs/blocks/frames.rst b/docs/blocks/frames.rst index aea84e0b..56c40721 100644 --- a/docs/blocks/frames.rst +++ b/docs/blocks/frames.rst @@ -109,7 +109,7 @@ For instance, the buienradar widget has a frame width of 256 pixels, and an aspe width:12, scaletofit: 256, aspectratio: 1, -} + } .. image :: img/framescale.jpg diff --git a/docs/blocks/graphs.rst b/docs/blocks/graphs.rst index a9bb8b50..ed705a0d 100644 --- a/docs/blocks/graphs.rst +++ b/docs/blocks/graphs.rst @@ -419,7 +419,9 @@ A ``custom`` object start with the name of the button. The button should contain * ``range``. This is the name of the range as requested from Domoticz, and can be ``'day'``, ``'today'``, ``'month'`` or ``'year'``. The range ``'today'`` filters the data to today, independent of the setting in Domoticz, and sets the graph x-axis to the full day. * ``filter`` (optional). This limits the amount of data to the period as defined by this parameter. Examples: ``'2 hours'``, ``'4 days'``, ``'3 months'`` + Special filters exist. Value ``'todaytomorrow'`` will filter the graph data of today and tomorrow. This can be used for instance for showing one day ahead dynamic energy prices. + * ``data``. This is an object that defines the values to use for the graph. * ``buttonIcon`` (optional). The Fontawesome icon to use for the button. Example ``'fas fa-bus'`` diff --git a/docs/blocks/img/blockbackground.jpg b/docs/blocks/img/blockbackground.jpg new file mode 100644 index 00000000..87bd10cc Binary files /dev/null and b/docs/blocks/img/blockbackground.jpg differ diff --git a/docs/blocks/specials/img/group.jpg b/docs/blocks/specials/img/group.jpg new file mode 100644 index 00000000..9fa255cd Binary files /dev/null and b/docs/blocks/specials/img/group.jpg differ diff --git a/docs/blocks/specials/img/waqi-citycode.jpg b/docs/blocks/specials/img/waqi-citycode.jpg new file mode 100644 index 00000000..a5a10d21 Binary files /dev/null and b/docs/blocks/specials/img/waqi-citycode.jpg differ diff --git a/docs/blocks/specials/img/waqi-large.jpg b/docs/blocks/specials/img/waqi-large.jpg new file mode 100644 index 00000000..dd748fde Binary files /dev/null and b/docs/blocks/specials/img/waqi-large.jpg differ diff --git a/docs/blocks/specials/img/waqi-wordpress.jpg b/docs/blocks/specials/img/waqi-wordpress.jpg new file mode 100644 index 00000000..60391db0 Binary files /dev/null and b/docs/blocks/specials/img/waqi-wordpress.jpg differ diff --git a/docs/blocks/specials/img/waqi.jpg b/docs/blocks/specials/img/waqi.jpg new file mode 100644 index 00000000..0bdb6bf3 Binary files /dev/null and b/docs/blocks/specials/img/waqi.jpg differ diff --git a/docs/blocks/specials/img/weather-rows.jpg b/docs/blocks/specials/img/weather-rows.jpg new file mode 100644 index 00000000..56c3d419 Binary files /dev/null and b/docs/blocks/specials/img/weather-rows.jpg differ diff --git a/docs/blocks/specials/publictransport.rst b/docs/blocks/specials/publictransport.rst index 684bddfc..9cb508ed 100644 --- a/docs/blocks/specials/publictransport.rst +++ b/docs/blocks/specials/publictransport.rst @@ -9,6 +9,7 @@ Dashticz currently supports the following types of public transport info: * Train info Netherlands ('treinen') * Bus/tram/boat info Netherlands ('ovapi') + * openbaar vervoer Netherlands ('drgl') * irail (Belgium) * delijn (Belgium) @@ -53,6 +54,7 @@ Parameters - | Public transport info provider to use. Choose from | ``'treinen'`` Netherlands: trains | ``'ovapi'`` Netherlands: bus, tram, boat + | ``'drgl'`` Netherlands dienstregeling | ``'irailbe'`` Belgium: trains | ``'delijnbe'`` Belgium: bus, tram, boat * - direction @@ -203,6 +205,35 @@ De lijn The station code consists of 6 digits. Search for your station code in the search box on https://delijn.be +.. _drgl : + +drgl +~~~~ + +Find your station code via https://drgl.nl + +Search for a bus or train station name in the search box. + +The browser url will show the station code. + +Busstation codes are numeric. Train station codes are textual. + +Examples: + +* https://drgl.nl/stop/NL:S:asd, This is a trainstation with code ``'asd'`` which is Amsterdam CS +* https://drgl.nl/stop/NL:S:57005010, This is a busstation with code ``'57005010'`` which is Amsterdam CS busstation + +Sometimes you first have to click on a specific line, and then on the busstop or train station you need, to get the right station code. + +Block example:: + + blocks['drgl'] = { + type: 'publictransport', + title: 'Utrecht bus centrumzijde', + provider: 'drgl', + station: '30009500' + } + .. _predefpubtrans : Predefined public transport blocks diff --git a/docs/blocks/specials/tvguide.rst b/docs/blocks/specials/tvguide.rst index 71b3ad4a..07f31638 100644 --- a/docs/blocks/specials/tvguide.rst +++ b/docs/blocks/specials/tvguide.rst @@ -72,7 +72,7 @@ The parameter ``channels`` contains an array of the selected channel IDs. Find "13", "NDR Fernsehen" "15", "RTBF La 1" "16", "RTBF La 2" - "17", "TV 5" + "17", "TV5MONDE" "18", "National Geographic" "19", "Eurosport 1" "21", "Cartoon Network" @@ -82,23 +82,21 @@ The parameter ``channels`` contains an array of the selected channel IDs. Find "28", "Sat 1" "29", "Discovery Channel" "31", "RTL 5" - "32", "TRT int." + "32", "TRT World" "34", "Veronica" "36", "SBS 6" "37", "NET 5" "38", "ARTE" "39", "Film1 Family" - "40", "AT 5" + "40", "AT5" "46", "RTL 7" "50", "3Sat" "58", "PRO 7" - "59", "2BE" - "60", "VT4" - "64", "NPO Zapp Xtra NPO Best" - "65", "Animal Planet OUD" - "70", "NPO Cultura" - "83", "3voor12" + "60", "Play4" + "70", "NPO 2 extra" + "73", "Mezzo" "86", "BBC World" + "87", "TV E" "89", "Nickelodeon" "90", "BVN" "91", "Comedy Central" @@ -109,8 +107,6 @@ The parameter ``channels`` contains an array of the selected channel IDs. Find "102", "RTV Rijnmond" "103", "NH" "104", "BBC Entertainment" - "105", "Private Spice" - "107", "Film 1 Sundance" "108", "RTV Noord" "109", "Omrop Fryslân" "110", "RTV Drenthe" @@ -122,30 +118,19 @@ The parameter ``channels`` contains an array of the selected channel IDs. Find "116", "Omroep Zeeland" "148", "ESPN" "301", "BBC 4" - "304", "AMC" - "305", "Discovery World" "306", "Discovery Science" - "308", "3voor12 Central" - "309", "3voor12 On Stage" - "310", "3voor12 Portal" "311", "Disney XD" "312", "Nick Jr." - "313", "Boomerang" + "313", "Cartoonito" "315", "CBS Reality" - "317", "Comedy Family" - "401", "Playboy TV" - "403", "Goed TV" - "404", "FOXlife" "406", "Ons" - "407", "OUTTV" + "407", "OUTtv" "408", "RTL Lounge" "409", "Rtl crime" - "410", "101 TV" + "410", "NPO 1 extra" "411", "Film1 Action" - "412", "Film1 Premiere +1" "413", "HISTORY" - "414", "Investigiation discovery" - "415", "Travel Channel" + "414", "Investigiation Discovery" "416", "Nat Geo Wild" "417", "Extreme Sports Channel" "419", "Ziggo Sport Golf" @@ -154,16 +139,14 @@ The parameter ``channels`` contains an array of the selected channel IDs. Find "423", "Al Jazeera Engels" "424", "Disney Channel" "427", "MTV Brand new" - "428", "Brava NL" "429", "Oranje TV" "430", "Film1 Drama" "434", "Dusk" - "435", "24 Kitchen" + "435", "24Kitchen" "436", "Eurosport 2" - "437", "Comedy Central Extra" "438", "TLC" "439", "Animal Planet" - "440", "Fox" + "440", "STAR Channel" "441", "VRT Ketnet" "460", "SBS 9" "461", "Pebble TV" @@ -171,12 +154,22 @@ The parameter ``channels`` contains an array of the selected channel IDs. Find "464", "BBC First" "465", "RTL Z" "466", "Ziggo Sport" - "467", "Spike" "468", "ESPN 2" "469", "ESPN 3" "470", "ESPN 4" - "471", "KPN presenteert " + "471", "Beleef KPN " "472", "Crime + Investigation" - "473", "Viceland" + "474", "Ziggo Sport Voetbal " + "475", "INPLUS" "476", "TV 538" + "482", "Stingray Classica" + "483", "E! Entertainment" + "485", "RTL Telekids" + "486", "Love Nature" + "487", "CNBC" + "490", "Ziggo Sport Tennis" + "491", "Ziggo Sport Docu" + "494", "NPO Politiek" "495", "Filmbox.nl" + "496", "Paramount Network" + "497", "HGTV" diff --git a/docs/blocks/specials/waqi.rst b/docs/blocks/specials/waqi.rst new file mode 100644 index 00000000..32756657 --- /dev/null +++ b/docs/blocks/specials/waqi.rst @@ -0,0 +1,72 @@ +.. _waqi : + +World Air Quality Index +####################### + +This block will show the World Air Quality Index widgets. + +See: https://aqicn.org/ + +A WAQI block can be configured as follows:: + + //example for Amsterdam, large + blocks['My WAQI']= { + type: 'waqi', + layout: 'large', + city: 5771 + }; + +.. image :: img/waqi-large.jpg + +Parameters +---------- + +.. list-table:: + :header-rows: 1 + :widths: 5, 30 + :class: tight-table + + * - Parameter + - Description + * - type + - ``'waqi'`` To select a WAQI block. + * - width + - Set the width (1 to 12) + * - layout + - | choose from 'xsmall','small','large','xlarge','xxl' + | ``'small'``: Use small layout + * - city + - WAQI city code. See below + +Usage +----- + +City code +~~~~~~~~~ + +To find the right city code browse to https://aqicn.org/ + +There find your city. + +Then scroll to the bottom and click on 'Wordpress' within the Air Quality Widget section. + +.. image :: img/waqi-wordpress.jpg + +Then within the widget code look for the city number: + +.. image :: img/waqi-citycode.jpg + +Layout +~~~~~~ + +The following layout options are supported: + +* xsmall +* small +* large +* xlarge +* xxl + +Below an example of all the layout options: + +.. image :: img/waqi.jpg diff --git a/docs/blocks/specials/weather.rst b/docs/blocks/specials/weather.rst index ac086524..f239d836 100644 --- a/docs/blocks/specials/weather.rst +++ b/docs/blocks/specials/weather.rst @@ -78,6 +78,9 @@ Parameters | ``4``: Combination of 2,3,0,1 * - count - ``5``: Number of forecast items to show (default=3). Only for daily and hourly forecast. + * - rows + - | ``1``: (=default) Display all forecast elements (hours for layout:0, days for layout:1 ) on one row + | ``2``: Display the weather forecast elements on two rows * - interval - | Use every n-th forecast item. Only useful for owm3, because owm3 provides hourly forcast info | ``1``. Use every forecast item (=default) @@ -210,11 +213,11 @@ Icons Via the block parameter icons you can choose one of the predefined icon sets: - * 'line' (=default) - * 'linestatic' - * 'fill' - * 'static' - * 'meteo' +* 'line' (=default) +* 'linestatic' +* 'fill' +* 'static' +* 'meteo' By setting the block parameter ``monochrome`` to true the icons will be displayed as monochrome. @@ -222,7 +225,26 @@ This will give the following icons sets to choose from: .. image :: img/weather_icons.jpg +.. _weatherrows : +Multiple rows +~~~~~~~~~~~~~ + +By setting the ``rows`` parameters you can determine how many rows will be used for the weather forecast elements. + +Example:: + + blocks['weatherfill'] = { + type: 'weather', + city: 'Amsterdam', + apikey: 'secret', + width: 12, + layout: 1, + count: 8, + rows: 2, + } + +.. image :: img/weather-rows.jpg styling ~~~~~~~ @@ -264,16 +286,16 @@ Via https://openweathermap.org/ you can request a new API key and subscribe to w At this moment (August 2023) two types of accounts can be created: - * Free account - * Onecall API 3.0 +* Free account +* Onecall API 3.0 For the differences see https://openweathermap.org/price. Main differences: - * Onecall API requires you to provide your credit card info. - * Onecall API provides 8 day weather forecast, free API only a 5 day forecast - * Onecall API provides hourly forecast info, while the free API only provides 3-hourly forecast info +* Onecall API requires you to provide your credit card info. +* Onecall API provides 8 day weather forecast, free API only a 5 day forecast +* Onecall API provides hourly forecast info, while the free API only provides 3-hourly forecast info In the past it was possible to request a OWM 2.5 account as well. diff --git a/docs/customjs/customjs.rst b/docs/customjs/customjs.rst index c4e77c6e..3e513472 100644 --- a/docs/customjs/customjs.rst +++ b/docs/customjs/customjs.rst @@ -280,3 +280,22 @@ One special functionality is the device field ``deviceStatus``. You can set this You could set the value of deviceStatus based on the current device value or based on the value of another device. Happy hacking :) + + +.. _beforefirstrenderhook: + +Before first render hook +------------------------- + +Before the first render this hook will be called. Domoticz communication has started. All devices are known. +This gives the opportunity to update the Dashticz configuration based on information from Domoticz. + +Example:: + + function beforeFirstRenderHook() { + var myDevice = Domoticz.getAllDevices('My Device'); + blocks['mydevice'] = { + title: 'New device idx', + idx: myDevice.idx, + } + } diff --git a/docs/gettingstarted/basicdashboard.rst b/docs/gettingstarted/basicdashboard.rst index e338208f..dd579225 100644 --- a/docs/gettingstarted/basicdashboard.rst +++ b/docs/gettingstarted/basicdashboard.rst @@ -166,7 +166,7 @@ Domoticz authorization ----------------------- Easy method -~~~~~~~~~~~~ +-------------- The Easy Method is only recommended in case Dashticz is not exposed to the public internet. @@ -190,10 +190,10 @@ Example of Domoticz settings: .. image :: apiprotection2.jpg -.. _oauth2:: +.. _oauth2 : Advanced method -~~~~~~~~~~~~~~~~ +------------------ Since Domoticz 2023.2 authorization via OAuth2 is supported. @@ -213,10 +213,10 @@ In Domoticz - Setup - More Options - Application, create a new application. Exam In Dashticz CONFIG.js: * Remove CONFIG['user_name'] and CONFIG['pass_word'] - * Add the following:: + * Add the following - CONFIG['client_id'] = 'Dashticz'; - CONFIG['client_secret'] = 'DashticzPassword'; + CONFIG['client_id'] = 'Dashticz'; + CONFIG['client_secret'] = 'DashticzPassword'; If you have configured Domoticz and Dashticz as described above, then when you open Dashticz the Domoticz authentication window will be shown, where you can fill in a Domoticz username and password. After verifying the user credentials a token will be generated which will be used by Dashticz to get data from Domoticz. diff --git a/docs/img/dashticz.jpg b/docs/img/dashticz.jpg new file mode 100644 index 00000000..02706b7c Binary files /dev/null and b/docs/img/dashticz.jpg differ diff --git a/docs/index.rst b/docs/index.rst index 9204d002..7bd60013 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,7 +11,7 @@ For Dashticz's **beta** version documentation go to: https://dashticz.readthedoc For Dashticz's **master** version documentation go to: https://dashticz.readthedocs.io/en/master/ -.. image:: https://camo.githubusercontent.com/d1e6ad3242567a419eb8c6174aca095ec5e1112e/687474703a2f2f692e696d6775722e636f6d2f39444263704e642e6a7067 +.. image :: img/dashticz.jpg .. toctree:: :maxdepth: 2 diff --git a/docs/releasenotes/releasenotes.rst b/docs/releasenotes/releasenotes.rst index 4dfa84fe..2122cdc1 100644 --- a/docs/releasenotes/releasenotes.rst +++ b/docs/releasenotes/releasenotes.rst @@ -8,6 +8,39 @@ For Dashticz's **master** version Release Notes go to: https://dashticz.readthed Recent changes --------------- +V3.13 master (14-7-2024) +--------------------------- + +Same as v3.12.1 beta + +V3.12.1 beta (14-7-2024) +--------------------------- + +Enhancements +~~~~~~~~~~~~ + +* Use device name instead of device idx (undocumented) +* custom.js: New hook which will be called before first Dashticz render: ``beforeFirstRenderHook()``. See :ref:`beforefirstrenderhook` +* Styling: Add correct data-id to a Dashticz block consisting of multiple blocks. See :ref:`grouped_devices` +* World Air Quality Index: Support for the WAQI widgets have been added. See :ref:`waqi` +* publictransport: ``'drgl'`` as new provider, which will give bus and train departures in the Netherlands. See :ref:`drgl` +* Weather: Add support by display the weather forecast elements on multiple rows by setting the ``rows`` block parameter. See :ref:`weatherrows` +* Domoticz device block: Background image can be added. See :ref:`blockbackground` + +Fixes +~~~~~~ + +* P1 block: Fix unit of first value (Nett Energy) +* Graph: Fix graph for switches (for Domoticz 2024.1 and higher) +* Calendar: Fix for showing a calendar block more than once +* Dial: Prevent error when device is not defined +* Dial: Fix updown dial (bug introduced by recent change) + +V3.12.0 beta (26-1-2024) +--------------------------- + +Beta version, derived from v3.12 master + V3.12 Master (26-1-2024) --------------------------- @@ -775,7 +808,7 @@ You only have to do this once: Next updates can be installed with a normal 'git Enhancements ~~~~~~~~~~~~ -* Calendar: New block parameter ``emptytext`` to define the text to show where there are no calendar appointments. Only works for the new calendar block. See :ref:`newcalendar` +* Calendar: New block parameter ``emptytext`` to define the text to show where there are no calendar appointments. Only works for the new calendar block. See :ref:'newcalendar' * Custom graph: aggregate parameter can be an array to specify different aggregation methods per data element. See :ref:`groupBy` * Graph: New parameters ``axisRight`` to show the first Y axis on the right (default is ``false``), and ``axisAlternating`` to show Y axes alternating left/right (default: ``true``). * Support for device (sub)type Managed Counter @@ -853,7 +886,7 @@ Enhancements Fixes ~~~~~~ -* Calendar: Add 'method:0' to your calendar block definition in case you experience issues with recurring events. Only works for the new calendar block. See :ref:`newcalendar` +* Calendar: Add 'method:0' to your calendar block definition in case you experience issues with recurring events. Only works for the new calendar block. See :ref:'newcalendar' * Fix for X10 security motion device. 3.6.7 Beta (4-11-2020) @@ -893,7 +926,7 @@ Enhancements * Button, special blocks: Initiate the ``url`` parameter as POST request by setting ``newwindow: 4`` * Add support for Domoticz x10 security sensor -* Dial: Combine data from several devices. See :ref:`genericdial` +* Dial: Combine data from several devices. See :ref:'genericdial' 3.6.4 Beta (6-10-2020) ---------------------- @@ -915,7 +948,7 @@ Enhancements ~~~~~~~~~~~~ * Set config setting ``security_panel_lock`` to ``2`` to activate security panel lock in 'Armed Home' mode as well. -* Dial type now enabled for most devices. See :ref:`genericdial` +* Dial type now enabled for most devices. See :ref:'genericdial' Fixes ~~~~~ @@ -1098,7 +1131,7 @@ Fixes ----------------------- Enhancements - * New calendar layout. See :ref:`newcalendar` + * New calendar layout. See :ref:'newcalendar' Fixes * Group/scene status refresh @@ -1272,7 +1305,7 @@ Fixes ------------------ Enhancements - * Show calendar with table formatting by setting blockparameter ``calFormat:1``. See :ref:`calTable` + * Show calendar with table formatting by setting blockparameter ``calFormat:1``. See :ref:'calTable' * Session Time Out option Fixes diff --git a/docs/releasenotes/upgrading/upgrading.rst b/docs/releasenotes/upgrading/upgrading.rst index ae808322..a1f06eaa 100644 --- a/docs/releasenotes/upgrading/upgrading.rst +++ b/docs/releasenotes/upgrading/upgrading.rst @@ -3,11 +3,12 @@ Upgrade instructions .. toctree:: :maxdepth: 2 - + + v3.10.1 v389 v376 v373 v349 v341 v320 - \ No newline at end of file + diff --git a/docs/releasenotes/upgrading/v373.rst b/docs/releasenotes/upgrading/v373.rst index 278c8157..a7b8f1e5 100644 --- a/docs/releasenotes/upgrading/v373.rst +++ b/docs/releasenotes/upgrading/v373.rst @@ -38,7 +38,7 @@ Removal of 'old' calendar block Until now Dashticz supported the 'old' and the 'new' calendar block. The 'old' calendar block has been removed. -See :ref:`newcalendar` +See :ref:'newcalendar' To be able to recognize a calendar block you have to add ``icalurl`` parameter to the block definition. diff --git a/js/blocks.js b/js/blocks.js index 6ee062f4..22b0b21b 100755 --- a/js/blocks.js +++ b/js/blocks.js @@ -91,6 +91,7 @@ function addBlock2Column(columndiv, c, b) { newBlock.blocks.forEach(function (aBlock) { addBlock2Column(myblockselector, '', aBlock); }); + $(myblockselector).attr('data-id', newBlock.key); return; } if (Array.isArray(newBlock)) { @@ -1197,7 +1198,7 @@ function getSmartMeterBlock(block) { var idx = device.idx; block.width = block.width || 4; if (device['SubType'] === 'Energy') { - var usage = device.NettUsage + ' ' + settings['units'].names.watt; + var usage = parseFloat(device.NettUsage || '0'); var data = device['Data'].split(';'); var blockValues = [ @@ -1207,7 +1208,7 @@ function getSmartMeterBlock(block) { subidx: 1, title: language.energy.energy_usage, value: usage, - unit: '', + unit: settings['units'].names.watt, }, { icon: 'fas fa-plug', diff --git a/js/components/calendar.js b/js/components/calendar.js index 1e7121b9..30cf79b9 100644 --- a/js/components/calendar.js +++ b/js/components/calendar.js @@ -14,7 +14,8 @@ var DT_calendar = { }, emptytext: 'Geen afspraken.', method: 1, - eventClasses: {} + eventClasses: {}, + refresh:600 }, run: function (me) { if (me.block.type === 'calendar') { @@ -28,7 +29,7 @@ var DT_calendar = { .attr('data-toggle', 'modal') .attr('data-target', '#agenda-modal_' + me.key); } - prepareCalendar(me, me.key); +// prepareCalendar(me, me.key); } else { infoMessage( 'Domoticz error!', @@ -39,7 +40,7 @@ var DT_calendar = { } }, refresh: function (me) { - prepareCalendar(me, me.key); + prepareCalendar(me, me.mountPoint); }, }; Dashticz.register(DT_calendar); diff --git a/js/components/dial.js b/js/components/dial.js index 4fc3999d..ed880b3b 100644 --- a/js/components/dial.js +++ b/js/components/dial.js @@ -38,7 +38,7 @@ var DT_dial = (function () { passive: false, }); - DT_dial.settings = Domoticz.getAllDevices()['_settings']; + DT_dial.settings = Domoticz.getAllDevices('_settings'); }, defaultCfg: { @@ -93,22 +93,19 @@ var DT_dial = (function () { var idx; me.devices = []; - if (typeof me.idx === 'number' || parseInt(me.idx)) - me.devices.push(me.idx); - if (typeof me.idx === 'string' && me.idx[0] === 's') { - idx = parseInt(me.idx.slice(1)); - if (idx) me.devices.push(me.idx); - } + var idx = DT_function.getDomoticzIdx(me.idx); + if (idx) + me.devices.push(idx); if (me.block.values) me.block.values.forEach(function (el) { if (typeof el === 'object' && el.idx) { // if (!$.inArray(el.idx, me.devices)) - var idx = parseInt(el.idx); - if (me.devices.indexOf(idx) === -1) me.devices.push(idx); + var idx = DT_function.getDomoticzIdx(el.idx); + if (idx && me.devices.indexOf(idx) === -1) me.devices.push(idx); } }); if (me.block.temp) { - idx = parseInt(me.block.temp); + idx = DT_function.getDomoticzIdx(me.block.temp); if (idx && me.devices.indexOf(idx) === -1) me.devices.push(idx); } me.devices.forEach(function (el) { @@ -125,7 +122,7 @@ var DT_dial = (function () { }); }); if (me.devices.length) { - me.device = Domoticz.getAllDevices()[me.devices[0]]; + me.device = Domoticz.getAllDevices(me.devices[0]); if (!me.device) { console.log('Device not found: ', me.idx); // me.$mountPoint.find('.dial').html('Device not found: '+me.idx); @@ -219,7 +216,7 @@ var DT_dial = (function () { me.splitdial = choose(choose(me.splitdial, me.block.splitdial), me.min < 0); me.shownumbers =choose(me.shownumbers, me.block.shownumbers); - me.unitvalue = choose(me.block.unit, me.device.vunit, me.unitvalue); + me.unitvalue = choose(me.block.unit, me.device && me.device.vunit, me.unitvalue); me.max=choose(me.block.max, me.device && me.device.max, me.max); me.min=choose(me.block.min, me.device && me.device.min, me.min); @@ -351,14 +348,14 @@ var DT_dial = (function () { } if (me.block.backgroundimage) { - if ( Domoticz.getAllDevices()[me.block.backgroundimage]) { + if ( Domoticz.getAllDevices(me.block.backgroundimage)) { Dashticz.subscribeDevice(me, me.block.backgroundimage, true, function (device) { setBackgroundImage(me, device.Data); }); } else { - setBackgroundImage(me, me.block.backgroundImage); + setBackgroundImage(me, me.block.backgroundimage); } } @@ -717,7 +714,7 @@ var DT_dial = (function () { var idx = me.setpointDevice || me.idx; var maxdim = me.maxdim; if (me.setpointDevice && ('onoff'!==src)) { - var d = Domoticz.getAllDevices()[idx]; + var d = Domoticz.getAllDevices(idx); switch (true) { case isDefined(d.Level): setpointType = 'dim'; @@ -754,7 +751,7 @@ var DT_dial = (function () { $.extend(block, me); if (me.setpointDevice) { block.idx = me.setpointDevice; //Force that the correct setpoint device is used. - block.device = Domoticz.getAllDevices()[me.setpointDevice]; + block.device = Domoticz.getAllDevices(me.setpointDevice); } switchThermostat(block, me.value); } @@ -907,7 +904,7 @@ var DT_dial = (function () { } else { /* Combining Toon Thermostat with Toon Temp device */ if (isDefined(me.block.temp)) { - me.value = Domoticz.getAllDevices()[me.block.temp].Temp; + me.value = Domoticz.getAllDevices(me.block.temp).Temp; me.isSetpoint = true; me.setpoint = me.device.SetPoint; me.info.push({ @@ -1085,7 +1082,7 @@ var DT_dial = (function () { if (typeof el == 'object' && el.idx) { idx = el.idx; } - var device = Domoticz.getAllDevices()[idx]; + var device = Domoticz.getAllDevices(idx); if (!device) { console.error('Device not existing: ', idx); Debug.log( @@ -1455,7 +1452,7 @@ var DT_dial = (function () { value = me.setpoint; } if (isDefined(me.block.temp)) { - me.temp = Domoticz.getAllDevices()[me.block.temp].Temp; + me.temp = Domoticz.getAllDevices(me.block.temp).Temp; me.info.push({ icon: 'fas fa-calendar-alt', data: me.setpoint, diff --git a/js/components/domoticzblock.js b/js/components/domoticzblock.js index 3fa76165..d0236a32 100644 --- a/js/components/domoticzblock.js +++ b/js/components/domoticzblock.js @@ -1,4 +1,4 @@ -/* global Dashticz settings deviceUpdateHandler Domoticz*/ +/* global Dashticz settings deviceUpdateHandler Domoticz DT_function*/ //# sourceURL=js/components/domoticzblock.js var DT_domoticzblock = (function () { return { @@ -11,7 +11,7 @@ var DT_domoticzblock = (function () { width: 4, batteryThreshold: settings.batteryThreshold, icon: 'default', - longpress: block&&block.idx&&(block.idx[0]==='s') + longpress: block&&DT_function.idxIsScene(block.idx), } }, run: function (me) { @@ -37,6 +37,13 @@ var DT_domoticzblock = (function () { me.subidx = subidx; } } + else { //Use device name + var idx = DT_function.getDomoticzIdx(block.idx); + if(idx) { + block.idx = idx; + me.deviceIdx = idx; + } + } } me.entry = me.mountPoint.slice(1); @@ -46,18 +53,32 @@ var DT_domoticzblock = (function () { me.$mountPoint.find('.block_' + block.key)[0].addEventListener('long-press', function (e) { e.preventDefault(); console.log('long press'); - if (me.deviceIdx[0]==='s') + if (DT_function.idxIsScene(me.deviceIdx)) Domoticz.request('getscenedevices', false, { idx: me.deviceIdx.substring(1) }) .then(function (res) { console.log(res); var devices = res.result.map(function (device) { return device.DevRealIdx }); - console.log(devices); DT_function.clickHandler(me, { popup: devices }) }) }) } + me.backgroundselector='.block_' + block.key; + if (me.block.backgroundimage) { + if ( Domoticz.getAllDevices(me.block.backgroundimage)) { + Dashticz.subscribeDevice(me, me.block.backgroundimage, true, function (device) { + me.backgroundImage = device.Data; + setBackgroundImage(me, device.Data); + }); + + } + else { + me.backgroundImage = me.block.backgroundimage; + setBackgroundImage(me, me.backgroundImage); + } + } + }, refresh: function (me) { fixBlock(me); @@ -65,6 +86,22 @@ var DT_domoticzblock = (function () { }, }; + function setBackgroundImage(me, url) { + //switch: .switch-face + //'normal' ? dial: .dial-display + //updown: blinds + var $face = me.$mountPoint.find(me.backgroundselector); + var opacity = me.block.backgroundopacity? '; opacity: ' + me.block.backgroundopacity: ''; + var bg = '
'; +// $face.css( {'background-image': "url(" + url + ")"}) + $face.prepend(bg); + if(me.block.backgroundsize && me.block.backgroundsize!=='cover') { +// $face.css('background-size',me.block.backgroundsize) + $face.find('.background').css('background-size',me.block.backgroundsize) + } + + } + function fixBlock(me) { //This function is needed to make it work with previous block definition //refactoring needed in the future @@ -85,6 +122,7 @@ var DT_domoticzblock = (function () { Dashticz.subscribeDevice(me, me.deviceIdx, true, function (device) { me.block.device = device; deviceUpdateHandler(me.block); + setBackgroundImage(me, me.backgroundImage); }); } })(); diff --git a/js/components/graph.js b/js/components/graph.js index d6065195..61adc306 100644 --- a/js/components/graph.js +++ b/js/components/graph.js @@ -41,9 +41,9 @@ function Initialize(me) { me.block.devices = me.block.devices || [parseInt(me.key.split('_')[1])]; $.each(me.block.devices, function (i, idx) { var device = {}; - $.extend(device, Domoticz.getAllDevices()[idx]); //Make a copy of the current device data + $.extend(device, Domoticz.getAllDevices(idx)); //Make a copy of the current device data if (device.idx) { - device.idx = parseInt(device.idx); +// device.idx = parseInt(device.idx); getDeviceDefaults(me, device); me.graphDevices.push(device); } else { @@ -523,10 +523,11 @@ Status: "Off" User: "OpenTherm" idx: "11209721" */ + var maxDimLevel = data.result && data.result[0].MaxDimLevel; var result = data.result.map(function (sample) { return { d: sample.Date, - l: sample.Level, + l: getIconStatusClass(sample.Status)==='off'? 0 : sample.Level || maxDimLevel || 1, }; }); return { result: result }; diff --git a/js/components/publictransport.js b/js/components/publictransport.js index b798d7a3..81112da1 100644 --- a/js/components/publictransport.js +++ b/js/components/publictransport.js @@ -57,7 +57,8 @@ } function getData(me) { - return $.getJSON(me.providerCfg.dataURL).then(function (data) { + var getter = me.providerCfg.URL ? $.get(me.providerCfg.URL):$.getJSON(me.providerCfg.dataURL); + return getter.then(function (data) { me.data = data; return me }) @@ -118,6 +119,12 @@ transformer: transformOvapi, tpl: 'pubtrans_ov', renderer: renderTpl + }, + drgl: { + URL: _CORS_PATH + 'https://drgl.nl/stop/NL:S:' + block.station + (isNumeric(block.station)?'':'/traindeparturespanel' ), + transformer: transformDRGL, + tpl: 'pubtrans_ov', + renderer: renderTpl, } } var provider = block.provider.toLowerCase(); @@ -223,6 +230,45 @@ return result; } + function transformDRGL(me, data) { + var block = me.block; + var result = { + departures: [] + }; + //console.log(data); + $(data).find('.list-group-item').each(function() { + var $this = $(this); + var timeinfoStr = $this.find('.ott-departure-time').html(); + var timeinfo=['n.a.']; + if(typeof timeinfoStr==='string') + timeinfo=timeinfoStr.split(' '); + else + return; + var linenumber = $this.find('.ott-linecode').html(); + var trainplatform = $this.find('.ott-trainplatform').html(); + var res = { + time: timeinfo[0], + delay: timeinfo.length==2?timeinfo[1]: undefined, + line: linenumber, + destination: (linenumber?linenumber+' ':'') + $this.find('.ott-destination').html(), + transportType: $this.find('.ott-productcategory').html(), + platform: trainplatform? 'spoor '+trainplatform: $this.find('.ott-platform').html(), + remarks: [] + } + $this.find('.notice').each(function() { + res.remarks.push($(this).html()) + }) + result.departures.push(res); + }); +/* var result = { + departures: block.tpc ? transformOvApiTpc(me, data) : transformOvApiStation(me, data) + }; + result.departures.sort(function (l, r) { + return l.fulltime - r.fulltime + }) + */ + return result; + } function transformIrailbe(me, data) { diff --git a/js/components/template.js b/js/components/template.js index d0371887..6d622b46 100644 --- a/js/components/template.js +++ b/js/components/template.js @@ -1,8 +1,8 @@ /* global Dashticz */ //# sourceURL=js/components/template.js -var DT_template = (function () { - - return { +(function (Dashticz) { + "use strict"; + var DT_template = { name: 'template', canHandle: function (block) { return block && false; @@ -14,7 +14,7 @@ var DT_template = (function () { }, run: function (me) { } -} -})(); + } + Dashticz.register(DT_template); +})(Dashticz); -Dashticz.register(DT_simpleblock); diff --git a/js/components/waqi.js b/js/components/waqi.js new file mode 100644 index 00000000..ed97c5e7 --- /dev/null +++ b/js/components/waqi.js @@ -0,0 +1,100 @@ +/* global Dashticz */ +//# sourceURL=js/components/waqi.js +(function (Dashticz) { + "use strict"; + var DT_waqi = { + name: 'waqi', + canHandle: function (block) { + return block && false; + }, + defaultCfg: function (block) { + var layout = choose(block.layout, 'large'); + var zoomfactors = { + xsmall: [120, 1.2], + small: [170, 0.9], + large: [170, 1.3], + xlarge: [180, 1.66], + xxl: [480, 1], + } + return { + width: 12, + layout: layout, //xsmall, small, large, xlarge, xxl + city: 5771, //Amsterdam + refresh: 15*60, + scaletofit: zoomfactors[layout][0] || 1, + aspectratio: zoomfactors[layout][1] || 0.5, + }; + }, + run: function (me) { + var hasIcon = me.$mountPoint.find('.col-icon').length; + var html = ''; + var height = me.block.height ? ';height:' + me.block.height + 'px' : ''; + var isXXL = me.block.layout==='xxl'; + me.iframeid = me.mountPoint+'_iframe'; + html += + ''; + // ''; + me.$mountPoint.find('.dt_state').html(html); + + var $iframe = me.$mountPoint.find('iframe'); + var $dtstate = me.$mountPoint.find('.dt_state'); + var width = parseInt(me.$mountPoint.find('div').innerWidth()) - (isXXL ? 20:0); +// var width = parseInt($dtstate.innerWidth()) - (isXXL ? 20:0); + var scaling = me.block.scaletofit ? width/me.block.scaletofit : 1; + var iframeWidth = width/scaling; // - (isXXL?20:0); + var dtstatecss={}; + var iframecss={} + var scalingStr = 'scale(' + scaling + ')'; + iframecss={'-webkit-transform': scalingStr, transform: scalingStr, width: iframeWidth, maxWidth: iframeWidth, 'transform-origin': 'top left'}; + if(hasIcon) { + dtstatecss.marginRight='0px'; + dtstatecss.marginLeft='5px'; + } + if(me.block.aspectratio) { + dtstatecss.height=iframeWidth * me.block.aspectratio * scaling; + iframecss.height=iframeWidth * me.block.aspectratio - (isXXL?40:0); + } + + if(me.block.layout==='xxl') { +// iframecss.width='100%'; + + me.$mountPoint.find('.dt_block').addClass('xxl'); + $dtstate.css(dtstatecss); + $iframe.css(iframecss); + } + else { + + $dtstate.css(dtstatecss); + $iframe.css(iframecss); + } + }, + /* + defaultContent: function (me) { + var scrolling = + me.block.scrollbars === false || + navigator.userAgent.match(/(iPod|iPhone|iPad)/) + ? ' scrolling="no"' + : ''; + var html = ''; + var height = me.block.height ? ';height:' + me.block.height + 'px' : ''; + me.iframeid = me.mountPoint+'_iframe'; + html += + ''; + // ''; + + return html; + }, + */ + refresh: function(me) { + var iframe = ''; + var doc = document.getElementById(me.iframeid).contentWindow.document; + doc.open(); + doc.write(iframe); + doc.close(); + } + } + Dashticz.register(DT_waqi); +})(Dashticz); + diff --git a/js/components/weather.js b/js/components/weather.js index caf07388..515f07dc 100644 --- a/js/components/weather.js +++ b/js/components/weather.js @@ -82,6 +82,7 @@ var DT_weather = (function () { icons: settings.static_weathericons ? 'static' : 'line', iconExt: 'svg', // provider: 'owm' + rows: 1 }; }, run: function (me) { @@ -112,9 +113,23 @@ var DT_weather = (function () { if (me.block.scale !== 1) me.$block.css('width', w); var fontSize = w / 10; if (me.block.layout === 0 || me.block.layout === 1) { - fontSize = fontSize / me.block.count; + fontSize = fontSize / Math.ceil(me.block.count/me.block.rows); } me.$block.css('font-size', fontSize + 'px'); + if(me.block.rows>1) { + /* + display: grid; + grid-template-rows: repeat(2, max-content); + grid-auto-flow: column; + gap: 0.5rem; + */ + me.$block.css({ + display: 'grid', + 'grid-template-rows': 'repeat('+me.block.rows+', max-content)', + 'grid-auto-flow': 'column', + gap: '0.5rem' + }) + } me.runPromise .then(function () { return refreshProvider(me); @@ -873,3 +888,23 @@ var DT_weather = (function () { })(); Dashticz.register(DT_weather); + + +/* +display: grid; + grid-template-rows: repeat(2, max-content); + grid-auto-flow: column; + gap: 0.5rem; + */ + +/*or: +parent: + +font-size: 4.8px; + flex-wrap: wrap; + gap: 0.5rem; +} + +child: + width:25%; +*/ \ No newline at end of file diff --git a/js/dashticz.js b/js/dashticz.js index be2e22b6..9eb16439 100644 --- a/js/dashticz.js +++ b/js/dashticz.js @@ -37,7 +37,8 @@ var Dashticz = (function () { 'weather', 'simpleblock', 'map', - 'group' + 'group', + 'waqi', ]; var components = []; var mountedBlocks = {}; diff --git a/js/domoticz-api.js b/js/domoticz-api.js index 30c4cb94..e720616c 100644 --- a/js/domoticz-api.js +++ b/js/domoticz-api.js @@ -764,8 +764,10 @@ var Domoticz = (function () { return deviceObservable._values; } - function getAllDevices() { - return deviceObservable._values; + function getAllDevices(idx) { + if(!idx) + return deviceObservable._values; + return deviceObservable._values[DT_function.getDomoticzIdx(idx)]; } function requestSecurityStatus() { @@ -859,7 +861,8 @@ var Domoticz = (function () { cfg.domoticz_refresh * 1000 ); } - return deviceObservable.subscribe(idx, getCurrent, callback); + var realidx = DT_function.getDomoticzIdx(idx); + return deviceObservable.subscribe(realidx, getCurrent, callback); } function setDevice(idx, value) { diff --git a/js/dt_function.js b/js/dt_function.js index 1ed00ea6..a7c142b6 100644 --- a/js/dt_function.js +++ b/js/dt_function.js @@ -348,6 +348,33 @@ var DT_function = (function () { }); } + function idxIsScene(idx) { + if(typeof idx!=='string') return false; + if ('s'===idx[0] && isNumeric(idx.substring(1))) return idx; + var realidx = getIndexFromName(idx); + if (realidx && 's'===realidx[0] && isNumeric(realidx.substring(1))) return realidx; + } + + /* returns the id that can be used in the subscribe*/ + function getDomoticzIdx(idx) { + if(typeof idx==='number') return idx; +// if(idxIsScene(idx)) return idx; + return getIndexFromName(idx); + } + + function getIndexFromName(idx) { + var devices=Domoticz.getAllDevices(); + if(devices[idx]) return idx; + var id = Object.keys(devices).find(function(key) { + return idx === devices[key].Name; + }) + if(id) { + var device = devices[id] + if (device.Type==='Group' || device.Type==='Scene') return 's'+device.idx; + return device.idx; + } + } + return { clickHandler: clickHandler, promptPassword: promptPassword, @@ -359,7 +386,9 @@ var DT_function = (function () { checkForceRefresh: checkForceRefresh, createModalDialog: createModalDialog, onRemove: onRemove, - cached: cached + cached: cached, + idxIsScene: idxIsScene, + getDomoticzIdx: getDomoticzIdx }; })(); diff --git a/js/loader.js b/js/loader.js index 436eec69..13be1ff8 100644 --- a/js/loader.js +++ b/js/loader.js @@ -1,6 +1,6 @@ /*global loadFiles dashtype */ -var _DASHTICZ_VERSION = 108; +var _DASHTICZ_VERSION = 121; var head = document.getElementsByTagName('head')[0], script = document.createElement('script'); diff --git a/js/main.js b/js/main.js index 8ec99caf..47d4c417 100644 --- a/js/main.js +++ b/js/main.js @@ -188,18 +188,6 @@ function loadCustomJS() { } function configureDashticz() { - if (typeof screens === 'undefined' || objectlength(screens) === 0) { - screens = {}; - screens[1] = {}; - screens[1]['background'] = settings['background_image']; - screens[1]['columns'] = []; - if (objectlength(columns) === 0) defaultcolumns = true; - if (defaultcolumns === false) { - for (var c in columns) { - if (c !== 'bar') screens[1]['columns'].push(c); - } - } - } $( ' {{#if this.platform}} - spoor {{this.platform}} + {{this.platform}} {{/if}} diff --git a/version.txt b/version.txt index eeb1a034..41d1c3f6 100644 --- a/version.txt +++ b/version.txt @@ -1,10 +1,8 @@ { -"version": "3.12", +"version": "3.13", "branch": "master", -"last_changes": "Master version, roll-up of all 3.11.x changes", +"last_changes": "Master version derived from 3.12.1-beta", "changelog" : { - "3.11.2": "Domoticz 2024.2, Google Maps, Dial improvements", - "3.11.1": "Changes in authentication", - "3.11": "Master version" + "3.12.1": "WAQI (Air Quality), drgl (train info), block and dial background images" } }