Skip to content

Commit

Permalink
Merge pull request #44 from lokonli/master-306
Browse files Browse the repository at this point in the history
Master 306
  • Loading branch information
lokonli authored Aug 28, 2019
2 parents e9cb2d1 + ddb9f86 commit 5f178c2
Show file tree
Hide file tree
Showing 16 changed files with 263 additions and 67 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Dockerfile for Dashticz
# See http://nelkinda.com/blog/apache-php-in-docker/
FROM php:apache
USER root
#Default value in case no build argument:
ARG tz="Europe/Amsterdam"
RUN printf "[PHP]\ndate.timezone = $tz\n" > /usr/local/etc/php/conf.d/tzone.ini
SHELL ["/bin/bash", "-c"]
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-include Makefile.ini
PORT?=8082
APP?=dtv3-$(PORT)
TZ?="$(shell cat /etc/timezone)"
CHECKDOCKER?=true

.PHONY: help
help:
Expand All @@ -16,10 +18,12 @@ help:
@echo "make master : Switch to the master branch"

testdocker:
ifeq ($(CHECKDOCKER),true)
ifeq (, $(shell which docker))
@echo "Let's install docker first"
wget -qO- https://get.docker.com/ | sh
endif
endif


testgit:
Expand All @@ -43,13 +47,12 @@ endif
.PHONY: start
start: testdocker testgit
@echo "Checking container $(APP)"
#ifeq ($(strip shell sudo docker image -q $(APP)),)
ifeq ($(shell sudo docker ps -q -a -f NAME=$(APP) ),)
@echo "Checking port $(PORT)"

ifeq ($(shell ss -ln src :$(PORT) | grep -Ec -e "\<$(PORT)\>"),0)
sudo docker build -t $(APP) .
sudo docker run --name $(APP) -d -p $(PORT):80 --mount type=bind,source="$(CURDIR)",target=/var/www/html $(APP)
sudo docker build --build-arg tz=$(TZ) -t $(APP) .
sudo docker run --restart unless-stopped -v /etc/localtime:/etc/localtime:ro --name $(APP) -d -p $(PORT):80 --mount type=bind,source="$(CURDIR)",target=/var/www/html $(APP)
@echo
@echo "Dashticz is running at:"
@printf "http://%s:`sudo docker inspect -f '{{ (index (index .NetworkSettings.Ports "80/tcp") 0).HostPort }}' $(APP)`\n" `hostname -I | grep -Po '\b(?:\d{1,3}\.){3}\d{1,3}\b'`
Expand Down
18 changes: 18 additions & 0 deletions css/creative.css
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,24 @@ a.playlist {
top: 0px;
}

.titlegroups h3 {
margin-left: 0px;
}

.titlegroups .co-data {
margin-top: 0px;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);

}

.titlegroups .col-icon {
margin-top: 0;
top: 40%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}

.up,.down {
height: 50%;
Expand Down
10 changes: 9 additions & 1 deletion docs/blocks/buttons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Parameters
- ``'<url>'``: URL of the image to show in the button.
* - url
- ``'<url>'``: URL of the page to open in a popup window on click.
* - framewidth
- ``'<integer>'``: specific width of the popup window on click.
* - frameheight
- ``'<integer>'``: specific height of the popup window on click.
* - forcerefresh
- | Control the caching-prevention mechanism of the images and popup frame for a button.
| ``0`` : Normal caching behavior (=default)
Expand Down Expand Up @@ -153,4 +157,8 @@ Additional examples of button definitions::
buttons.buienradar = {width:12, isimage:true, refreshimage:60000, image: 'http://api.buienradar.nl/image/1.0/RadarMapNL?w=285&h=256', url: 'http://www.weer.nl/verwachting/nederland/son/189656/'}
buttons.radio = {width:12, image: 'img/radio_on.png', title: 'Radio', url: 'http://nederland.fm'}
buttons.nunl = {width:12, icon: 'far fa-newspaper', title: 'Nu.nl', url: 'http://www.nu.nl'}
buttons.webcam = {width:12, isimage:true, refresh:2000, image: 'http://ip_url_to_webcam', url: 'http://ip_url_to_webcam'}
buttons.webcam = {width:12, isimage:true, refresh:2000, image: 'http://ip_url_to_webcam', url: 'http://ip_url_to_webcam', framewidth:500, frameheight:400}

To remove the close button of the button-popup add the following text to custom.css::

.frameclose { display: none; }
49 changes: 41 additions & 8 deletions docs/blocks/domoticzblocks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,20 @@ Example::
Variables
---------

To select a Domoticz variable add 'v' in front of the Domoticz variable ID.
To select a Domoticz variable add 'v' in front of the Domoticz variable ID.

Example::

blocks['v3'] = { //Select variable with Domoticz index 3
title: 'My variable 3'
}

After that you can use ``'v3'`` in your column definitions in ``CONFIG.js`` as usual.

A list of all Domoticz variables can be obtained via::

http://[DomoticzIP:Port]/json.htm?type=command&param=getuservariables


.. _dom_blockparameters:

Expand All @@ -66,7 +72,7 @@ Block parameters
* - title
- ``'<string>'``: Custom title for the block
* - icon
- | Defines alternative icon of the device instead of the default, choose from: https://fontawesome.com/v4.7.0/icons/
- | Defines alternative icon of the device instead of the default, choose from: https://fontawesome.com/icons?d=gallery&m=free
| ``'fas fa-eye'``
* - image
- | If you want to show an image instead of an icon, place image in ``img/`` folder
Expand Down Expand Up @@ -169,12 +175,15 @@ Usage
Block title
~~~~~~~~~~~

A special block type is a block title. A block title only contains a title element.
A special block type is a block title.
You define a block title as follows::

blocks['blocktitle_1'] = { //'blocktitle_1' must be an unique name
type: 'blocktitle', //Set type to 'blocktitle'
title: 'Switches' //The title of the block as shown in the dashboard.
type: 'blocktitle', //Set type to 'blocktitle' (required for block title)
title: 'Switches', //The title of the block as shown in the dashboard.
width: 6, //The width of the block relative to the column width
icon: 'far fa-lightbulb', //If you want to show an icon, choose from: https://fontawesome.com/icons?d=gallery&m=free
image: 'lightbulb.png' //If you want to show an image instead if icon, place image in img/ folder
}
Full example of one block title and two devices::
Expand Down Expand Up @@ -228,7 +237,7 @@ Example of a more extensive block definition::
blocks[1] = {
width: 4, //1 to 12, remove this line if you want to use the default (4)
title : 'Living room', //if you want change the name of switch different then domoticz
icon : 'fa-eye', //if you want an other icon instead of the default, choose from: https://fontawesome.com/v4.7.0/icons/
icon : 'fa-eye', //if you want an other icon instead of the default, choose from: https://fontawesome.com/icons?d=gallery&m=free
image : 'bulb_off.png', //if you want to show an image instead if icon, place image in img/ folder
switch : true, //if you want to switch the title and data
hide_data : true, //if you want to hide the data of this block
Expand All @@ -249,20 +258,30 @@ With the openpopup, openpopupOn and openpopupOff parameter you can configure to

blocks[123]['openpopup'] = {
url: 'http://www.urltocamera.nl/image.jpg', //Open a popup window with this url when the device changes
framewidth:500, //specific width of the frame
frameheight:400, //specific height of the frame
autoclose: 5 //autoclose the popup window after 5 seconds.
}
blocks[123]['openpopupOn'] = {
url: 'http://www.urltocamera.nl/image.jpg', //Open a popup window with this url when the device changes to On
framewidth:500, //specific width of the frame
frameheight:400, //specific height of the frame
autoclose: 5 //autoclose the popup window after 5 seconds.
}
blocks[123]['openpopupOff'] = {
url: 'http://www.urltocamera.nl/image.jpg', //Open a popup window with this url when the device changes to Off
framewidth:500, //specific width of the frame
frameheight:400, //specific height of the frame
autoclose: 5 //autoclose the popup window after 5 seconds.
}

To remove the close button of the block-popup add the following text to custom.css::

.frameclose { display: none; }


.. _Flashonchange:

Flash on change
Expand Down Expand Up @@ -290,6 +309,20 @@ Graphs
If your Domoticz device contains a value (temperature, humidity, power, etc.)
then when you click on the block a popup window will appear showing a graph of the values of the device.

To change the default size of the graph popup windows add the following style blocks to your custom.css::

.graphheight {
height: 400px;
}
.graphwidth {
width: 400px;
}

To remove the close button of the graph popup add the following text to custom.css::

.graphclose { display: none; }

Besides popup graphs it's also possible to show the graph directly on the dashboard itself,
by adding the graph-id to a column definition as follows::

Expand Down
34 changes: 32 additions & 2 deletions docs/blocks/specials/publictransport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Dashticz currently supports the following types of public transport info:

#. Predefined blocks, see :ref:`predefpubtrans`

* ``'traffic'``. Traffic info from Rijkswaterstaat (Netherlands)
* ``'traffic'``. Traffic info from `Rijkswaterstaat Verkeersinfo <https://rijkswaterstaatverkeersinformatie.nl/>`_ (Netherlands)
* ``'train'``. Train status from `Rijden de Treinen <https://www.rijdendetreinen.nl/>`_ (Netherlands)

A public transport block can be configured as follows::
Expand All @@ -27,6 +27,7 @@ A public transport block can be configured as follows::
title:'OV Info',
show_lastupdate:true,
provider: '9292',
show_via: true,
icon: 'train',
results: 5
};
Expand Down Expand Up @@ -66,11 +67,13 @@ Parameters
| ``'irail'`` Belgium
| ``'delijn'`` Belgium
* - destination
- | Set the end destination to filter the direction
- | Set the end destination station name to filter the direction.
| ``'Den Haag De Uithof,Den Haag Loosduinen'``
* - service
- | Set the specific services (Dutch: lijnnummers) to further filter the result
| ``'3,4'`` (comma seperated)
* - show_via
- ``false`` , ``true``. Hide the via-part.
* - icon
- | The font-awesome icon (without ``fas fa-``)
| ``'bus'``, ``'tram'``, ``'train'``, ``'ship'``, ``'subway'``, ...
Expand Down Expand Up @@ -99,6 +102,7 @@ Use this station id as value for the station parameter in the publictransport bl
title:'Trains',
show_lastupdate:true,
provider: 'VVS',
show_via: true,
icon: 'train',
interval: 15,
results: 5
Expand All @@ -119,6 +123,7 @@ Then copy the id, and add to CONFIG.js as follows::
title:'OV Info',
show_lastupdate:true,
provider: '9292',
show_via: true,
icon: 'train',
results: 5
};
Expand All @@ -141,6 +146,31 @@ Then copy the id, and add to CONFIG.js as follows::

As you can see in the previous example specific transport types can be selected.

In the next examples only the filtered results will be shown::

var publictransport = {}
publictransport.schiphol= {
station: 'station-eindhoven',
destination: 'Schiphol Airport,Maastricht',
provider: '9292-train',
show_lastupdate:false,
icon: 'train',
results: 7
};
publictransport.ovinfotram = {
show_via: true,
station: 'den-haag/tramhalte-metrostation-leidschenveen',
title:'Station Leidschenveen',
destination:'Den Haag De Uithof,Den Haag Loosduinen',
service:'3,4',
provider: '9292-tram-bus',
show_lastupdate:true,
icon: 'bus',
width:12,
results: 8
};

.. _predefpubtrans :

Predefined public transport blocks
Expand Down
5 changes: 3 additions & 2 deletions docs/blocks/specials/weather.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ The OWM module makes use of the following CONFIG parameters:
* - owm_api
- ``'<api-key>'`` API-key provided by https://openweathermap.org/
* - owm_city
- | Your city or nearby city to use in OWM
| ``'Utrecht, NL'``
- | Your city or nearby city to use in OWM. You can also fill in the city id here.
| ``'Utrecht'``
| ``'2748075'``
* - owm_name
- | Name to use instead of city name
| ``'Tuinwijk'``
Expand Down
18 changes: 18 additions & 0 deletions docs/customcss/customcss.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ There are a lot of creative users on the Domoticz Forum, that modify the CSS. A
The default styling is defined in the file ``<dashticz>/css/creative.css``. While you can use this file for inspiration, you should not modify it,
since the default styling can be modified in the file ``custom.css``, located in the folder ``<dashticz v3>/custom``

TIP: Comments can be used to explain the code, and may help when you edit the source code at a later date.
A CSS comment starts with /* and ends with */. Comments can also span multiple lines::

/* This is a single-line comment */

This sections has some examples of CSS that can be placed in ``custom.css``, so you can create your own look and feel.

Introduction into CSS
Expand Down Expand Up @@ -344,3 +349,16 @@ Lightbulbs color & Opacity
.fas.fa-lightbulb {
color: rgba(0,255,0,0.4)
}


Miscellaneous
-------------

Remove Swiper Pagination Bullet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

.swiper-pagination-bullet {
display: none !important
}
16 changes: 13 additions & 3 deletions docs/dashticzconfiguration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,17 @@ Usage

.. _dom_CORS_proxy:

CORS proxy
------------
PHP based CORS proxy
--------------------

Text to be added ...
To be able to load resources from other domains, like tvguide data and news updates, we need a CORS proxy (Cross Origin Resouce Sharing). Public CORS proxies exist on the internet, like cors-anywhere.herokuapp.com. These public CORS proxies might be slow or not available at all.

A basic PHP based CORS proxy has been integrated into Dashticz.

For normal use just remove the ``config['default_cors_url']`` from your ``CONFIG.js`` and the internal CORS proxy will be used.

If you prefer to use a different CORS proxy you can define it in ``CONFIG.js`` as usual::

config['default_cors_url'] = 'http://cors-anywhere.herokuapp.com'

In case PHP is not installed it falls back to the defined CORS proxy in ``config['default_cors_url']``. In case ``config['default_cors_url']`` is not set, it will use ``cors-anywhere.herokuapp.com`` by default.
19 changes: 19 additions & 0 deletions docs/releasenotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ Release Notes
=============
A link to the release notes will be posted in the Dashticz support forum. The total overview can be found below.

3.0.6 (28-8-2019)
-----------------
Enhancements
* OpenWeatherMap module: support for using the city id as city name
* Icon/image options for blocktitles

Fixes
* Docker PHP timezone
* News update in standby
* Robustness install script and makefile
* Auto restart docker container after reboot
* Documentation updates (Thanks to HansieNL)
*

3.0.5 (4-8-2019)
------------------
* Update of documentation.
* Improvements in the automatic installation script.

3.0.4 (1-8-2019)
------------------
Main changes:
Expand Down
12 changes: 12 additions & 0 deletions docs/tipsandtricks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,17 @@ Save the file and restart Apache::
Now if you browse to Dashticz you get a prompt to enter your login credentials.


Use of Web Fonts
----------------
Add the following to custom.js::

$('<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Orbitron" />').appendTo('head');

Add the following to custom.css::

.webfont {
font-family : orbitron;
}


Loading

0 comments on commit 5f178c2

Please sign in to comment.