Dashticz - Show your dashboard and how-to's!

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by poudenes »

robgeerts wrote:
poudenes wrote:My own creation to implement "NS Vertrektijden" Have created a .PHP on my VPS and created a API Account at NS (Free, and you can do 50.000 request a day) Maybe when people wants it it can be build into Dashticz and Rob creates a nice block editable script for it?

Screenshot_20170505-113135.png
If you can create a public url (with apikey as parameter), I can create a block for this..
i can't make a public url with api key in it. api key is password as well to access the server

I use this code to get the information from NS and put it in a file so i can access it (my coding is not the best... but at least it work for me now) :lol:

Code: Select all

<?php
$url = "http://webservices.ns.nl/ns-api-avt?station=asdz";
$username = "REGISTERED EMAIL";
$password = "API PASSWORD";
$file = "vertrek3.xml";

$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
file_put_contents($file,$output);
$tabel=simplexml_load_file('vertrek3.xml');
                ?>
?station=asdz (asdz is the shortname of Amsterdam Zuid) asd=Amsterdam Centraal, ass Amsterdam Sloterdijk etc.

So username, password, station are variable that can be add by user when the registered a API account at NS.NL

here there XML what you get from NS:

Code: Select all

<ActueleVertrekTijden>
<VertrekkendeTrein>
<RitNummer>1636</RitNummer>
<VertrekTijd>2017-05-05T12:17:00+0200</VertrekTijd>
<VertrekVertraging>PT9M</VertrekVertraging>
<VertrekVertragingTekst>+9 min</VertrekVertragingTekst>
<EindBestemming>Schiphol Airport</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">3</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>1836</RitNummer>
<VertrekTijd>2017-05-05T12:19:00+0200</VertrekTijd>
<VertrekVertraging>PT6M</VertrekVertraging>
<VertrekVertragingTekst>+6 min</VertrekVertragingTekst>
<EindBestemming>Den Haag Centraal</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Schiphol Airport, Leiden C.</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">4</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>5743</RitNummer>
<VertrekTijd>2017-05-05T12:19:00+0200</VertrekTijd>
<EindBestemming>Hilversum</EindBestemming>
<TreinSoort>Sprinter</TreinSoort>
<RouteTekst>Duivendrecht, Weesp, Naarden-B</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>3136</RitNummer>
<VertrekTijd>2017-05-05T12:23:00+0200</VertrekTijd>
<EindBestemming>Schiphol Airport</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">3</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>3543</RitNummer>
<VertrekTijd>2017-05-05T12:26:00+0200</VertrekTijd>
<EindBestemming>Heerlen/Venlo</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Bijlmer ArenA, Utrecht C, Eindhoven</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>2432</RitNummer>
<VertrekTijd>2017-05-05T12:26:00+0200</VertrekTijd>
<VertrekVertraging>PT2M</VertrekVertraging>
<VertrekVertragingTekst>+2 min</VertrekVertragingTekst>
<EindBestemming>Lelystad Centrum</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Almere C., Almere Buiten</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">1</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>4336</RitNummer>
<VertrekTijd>2017-05-05T12:29:00+0200</VertrekTijd>
<EindBestemming>Hoofddorp</EindBestemming>
<TreinSoort>Sprinter</TreinSoort>
<RouteTekst>Schiphol Airport</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">3</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>4343</RitNummer>
<VertrekTijd>2017-05-05T12:33:00+0200</VertrekTijd>
<EindBestemming>Almere Oostvaarders</EindBestemming>
<TreinSoort>Sprinter</TreinSoort>
<RouteTekst>Duivendrecht, Weesp, Almere C.</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>2449</RitNummer>
<VertrekTijd>2017-05-05T12:35:00+0200</VertrekTijd>
<EindBestemming>Rotterdam Centraal</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Schiphol Airport, Leiden C., Den Haag L v NOI</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">4</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>3538</RitNummer>
<VertrekTijd>2017-05-05T12:35:00+0200</VertrekTijd>
<EindBestemming>Schiphol Airport</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">3</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>3145</RitNummer>
<VertrekTijd>2017-05-05T12:39:00+0200</VertrekTijd>
<EindBestemming>Nijmegen</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Bijlmer ArenA, Utrecht C, Driebergen-Zeist</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>5736</RitNummer>
<VertrekTijd>2017-05-05T12:42:00+0200</VertrekTijd>
<EindBestemming>Hoofddorp</EindBestemming>
<TreinSoort>Sprinter</TreinSoort>
<RouteTekst>Schiphol Airport</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">4</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>1843</RitNummer>
<VertrekTijd>2017-05-05T12:42:00+0200</VertrekTijd>
<VertrekVertraging>PT2M</VertrekVertraging>
<VertrekVertragingTekst>+2 min</VertrekVertragingTekst>
<EindBestemming>Leeuwarden</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Almere C., Lelystad C., Zwolle</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">1</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>1645</RitNummer>
<VertrekTijd>2017-05-05T12:45:00+0200</VertrekTijd>
<EindBestemming>Enschede</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Hilversum, Amersfoort, Apeldoorn</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>11638</RitNummer>
<VertrekTijd>2017-05-05T12:47:00+0200</VertrekTijd>
<EindBestemming>Schiphol Airport</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">3</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>738</RitNummer>
<VertrekTijd>2017-05-05T12:49:00+0200</VertrekTijd>
<VertrekVertraging>PT5M</VertrekVertraging>
<VertrekVertragingTekst>+5 min</VertrekVertragingTekst>
<EindBestemming>Den Haag Centraal</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Schiphol Airport, Leiden C.</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">4</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>5745</RitNummer>
<VertrekTijd>2017-05-05T12:49:00+0200</VertrekTijd>
<EindBestemming>Hilversum</EindBestemming>
<TreinSoort>Sprinter</TreinSoort>
<RouteTekst>Duivendrecht, Weesp, Naarden-B</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>3138</RitNummer>
<VertrekTijd>2017-05-05T12:53:00+0200</VertrekTijd>
<EindBestemming>Schiphol Airport</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">3</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>3545</RitNummer>
<VertrekTijd>2017-05-05T12:56:00+0200</VertrekTijd>
<EindBestemming>Heerlen/Venlo</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Bijlmer ArenA, Utrecht C, Eindhoven</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>2434</RitNummer>
<VertrekTijd>2017-05-05T12:56:00+0200</VertrekTijd>
<EindBestemming>Lelystad Centrum</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Almere C., Almere Buiten</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">1</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>4338</RitNummer>
<VertrekTijd>2017-05-05T12:59:00+0200</VertrekTijd>
<EindBestemming>Hoofddorp</EindBestemming>
<TreinSoort>Sprinter</TreinSoort>
<RouteTekst>Schiphol Airport</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">3</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>4345</RitNummer>
<VertrekTijd>2017-05-05T13:03:00+0200</VertrekTijd>
<EindBestemming>Almere Oostvaarders</EindBestemming>
<TreinSoort>Sprinter</TreinSoort>
<RouteTekst>Duivendrecht, Weesp, Almere C.</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>2451</RitNummer>
<VertrekTijd>2017-05-05T13:05:00+0200</VertrekTijd>
<EindBestemming>Rotterdam Centraal</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Schiphol Airport, Leiden C., Den Haag L v NOI</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">4</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>3540</RitNummer>
<VertrekTijd>2017-05-05T13:05:00+0200</VertrekTijd>
<EindBestemming>Schiphol Airport</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">3</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>3147</RitNummer>
<VertrekTijd>2017-05-05T13:09:00+0200</VertrekTijd>
<EindBestemming>Nijmegen</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Bijlmer ArenA, Utrecht C, Driebergen-Zeist</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>745</RitNummer>
<VertrekTijd>2017-05-05T13:12:00+0200</VertrekTijd>
<EindBestemming>Groningen</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Almere C., Lelystad C., Zwolle</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">1</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>5738</RitNummer>
<VertrekTijd>2017-05-05T13:12:00+0200</VertrekTijd>
<EindBestemming>Hoofddorp</EindBestemming>
<TreinSoort>Sprinter</TreinSoort>
<RouteTekst>Schiphol Airport</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">4</VertrekSpoor>
</VertrekkendeTrein>
<VertrekkendeTrein>
<RitNummer>11647</RitNummer>
<VertrekTijd>2017-05-05T13:15:00+0200</VertrekTijd>
<EindBestemming>Amersfoort Schothorst</EindBestemming>
<TreinSoort>Intercity</TreinSoort>
<RouteTekst>Hilversum, Amersfoort</RouteTekst>
<Vervoerder>NS</Vervoerder>
<VertrekSpoor wijziging="false">2</VertrekSpoor>
</VertrekkendeTrein>
</ActueleVertrekTijden>
Last edited by poudenes on Friday 05 May 2017 12:17, edited 1 time in total.
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by robgeerts »

I know but everybody must use his own key ;)
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by poudenes »

robgeerts wrote:I know but everybody must use his own key ;)
:D Tried everything to do a request on URL base:

http://USERNAME-EMAIL:API-KEY@webservic ... ation=asdz

that isn't work...
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by robgeerts »

No, I mean a public link tou your script, like:

www.poudenes.com/ns/?key=API_KEY ;)
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by poudenes »

robgeerts wrote:No, I mean a public link tou your script, like:

http://www.poudenes.com/ns/?key=API_KEY ;)
Ohhh now i get it. you mean a public key where people can give their own API keys and on my vps it will create a xml file.
Otherwise PM me :)
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by robgeerts »

Yes, thats what I mean ;)
User avatar
HansieNL
Posts: 957
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by HansieNL »

@poudenes Maybe it's possible to use my Feature Request on the train page... https://www.domoticz.com/forum/viewtopi ... 24#p132951
Blah blah blah
User avatar
mAiden88
Posts: 56
Joined: Friday 14 October 2016 22:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7286
Location: Almelo
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by mAiden88 »

Css Fail.. :D
Image

Need some tweaking before i post my Dash, but this fail i want to share. haha.
Anyone can build a fast processor. The trick is to build a fast system.
User avatar
htilburgs
Posts: 464
Joined: Tuesday 03 November 2015 11:01
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by htilburgs »

Nice attempt....;-)
If you like the + and - button from the thermostaat less visible, then you can use this code (I've used this for the Roller Shutter), if they use the same framesettings (.input-groupBtn.input-chevron .btn-number)

Code: Select all

/* Transparent Background for arrow Blinds - Big Screen */
.input-groupBtn.input-chevron .btn-number {
    padding: 5px 10px 5px 10px;
    background-color: transparent;
}

/* Transparent Background for arrow Blinds - Small Screen */
@media only screen and (max-width: 1400px) {
	.input-groupBtn.input-chevron .btn-number {
		padding: 7px 10px 7px 10px;
		background-color: transparent;
	}
}
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
lukev
Posts: 66
Joined: Friday 21 October 2016 10:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by lukev »

Here are my two pages, all credits for the code go to the original programmers ;-)

Image
Image


Next thing to do, is get streaming video from my webcams. In domoticz it works, just as in my previous dashboard. But still not in this one :o
Last edited by lukev on Friday 05 May 2017 20:12, edited 1 time in total.
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by mvveelen »

lukev wrote:Here are my two pages, all credits for the code go to the original programmers ;-)

-cut-

Next thing to do, is get streaming video from my webcams. In domoticz it works, just is in my previous dashboard. But still not in this one :o
I see you have the charging / % charged in your dashboard. How exactly did you get this (I know the topic, but there are a lot of pages to read....), AND doesn't it drain your iPhone when you repeatedly poll the status or whereabouts of the iPhone?
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
lukev
Posts: 66
Joined: Friday 21 October 2016 10:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by lukev »

mvveelen wrote:
I see you have the charging / % charged in your dashboard. How exactly did you get this (I know the topic, but there are a lot of pages to read....), AND doesn't it drain your iPhone when you repeatedly poll the status or whereabouts of the iPhone?
This is my working LUA-script. You have to make 3 dummy devices, 2 text and 1 percentage: "iPhone Battery PERSON1", "Postion PERSON1" and "PowerState PERSON1".
I poll every 10 minutes, it seems to drain the battery a little faster, but nothing spectacular.

Code: Select all

-- Script to check the location of multiple iPhones every X minutes,
-- test if they are "home" and represent this using virtual switches

commandArray = {}
-- polling interval in minutes (1-59), setting this too low may drain the phones' batteries
interval = 10
local m = os.date('%M')
if (m % interval == 0) then

  json = (loadfile "/volume1/@appstore/domoticz/var/scripts/lua/JSON.lua")()

  -- Array of users to be checked
  users = {
            PERSON1 = {username = "itunes username" ; password = "itunes password" ; devicename = "itunes devicename"};
            PERSON2 = {username = "itunes username" ; password = "itunes password" ; devicename = "itunes devicename"}
            }
          
 -- The latitude and longitude of your house (use Google Maps or similar to find this)
  homelongitude = xxxxx
  homelatitude = xxxxxxx
  -- Radius (in km) which will be used to determine if a device is at home
  radius = 0.3

  function address(longitude, latitude)
    command = "curl -s https://maps.googleapis.com/maps/api/geocode/json?latlng=" .. latitude .. "," .. longitude .. "&sensor=false"
    local handle = io.popen(command)
    local result = handle:read("*a")
    handle:close()
    output = json:decode(result)
    return output.results[1].formatted_address
  end

  for user,credentials in pairs(users) do
    getlocation = "curl -s -X POST -L -u '" .. credentials.username .. ":" .. credentials.password .. "' -H 'Content-Type: application/json; charset=utf-8' -H 'X-Apple-Find-Api-Ver: 2.0' -H 'X-Apple-Authscheme: UserIdGuest' -H 'X-Apple-Realm-Support: 1.0' -H 'User-agent: Find iPhone/1.3 MeKit (iPad: iPhone OS/4.2.1)' -H 'X-Client-Name: iPad' -H 'X-Client-UUID: d98c8ae0db3311e687b92890643032df' -H 'Accept-Language: en-us' -H 'Connection: keep-alive' https://fmipmobile.icloud.com/fmipservice/device/" .. credentials.username .."/initClient"
    local handle = io.popen(getlocation)
    local result = handle:read("*a")
    handle:close()

    output = json:decode(result)
    for key,value in pairs(output.content) do
      if value.name == credentials.devicename then
        lon = value.location.longitude
        lat = value.location.latitude
        bat = value.batteryLevel * 100 / 1
        powerstateval = value.batteryStatus
        table.insert(commandArray,{['UpdateDevice'] = otherdevices_idx['iPhone Battery ' .. user] .. '|0|' .. bat})
        table.insert(commandArray,{['UpdateDevice'] = otherdevices_idx['PowerState ' .. user] .. '|0|' .. powerstateval})
        distance = math.sqrt(((lon - homelongitude) * 111.320 * math.cos(math.rad(lat)))^2 + ((lat - homelatitude) * 110.547)^2)  -- approximation
        position = address(lon,lat)
        position_text = string.gsub(position, ', Netherlands', '') .. ' (' .. (math.floor(distance*10+0.5)/10) .. ' km)'
        print(position)
        prev_distance_str = string.match(otherdevices['Position ' .. user], '%(.*%)') or '(1000 km)'
      prev_distance = tonumber(string.sub(prev_distance_str, 2,-5))
        -- update text device, but only if postion has changed more than defined in "radius" to reduce log size
        if math.abs(prev_distance - distance) > radius then 
          table.insert(commandArray,{['UpdateDevice'] = otherdevices_idx['Position ' .. user] .. '|0|' .. position_text})
          end
        print('iPhone ' .. user .. ': ' .. math.floor(distance*100+0.5)/100 .. ' km from home, ' .. bat .. '% battery remaining. PowerState: '.. powerstateval ..' ')
        if distance < radius  then
          if otherdevices['iPhone ' .. user] == 'Off' then
            commandArray['iPhone ' .. user] = 'On'
           -- table.insert(commandArray, {['SendNotification'] = 'Presence update#' .. user .. ' came home'})
          end
        else
          if otherdevices['iPhone ' .. user] == 'On' then
            commandArray['iPhone ' .. user] = 'Off'
           -- table.insert(commandArray, {['SendNotification'] = 'Presence update#' .. user .. ' left home'})
          end
        end
      end
    end
  end

end

return commandArray
I have disabled the notification, don't need it:

Code: Select all

-- table.insert(commandArray, {['SendNotification'] = 'Presence update#' .. user .. ' came home'})
           -- table.insert(commandArray, {['SendNotification'] = 'Presence update#' .. user .. ' left home'})
Don't forget to point out the correct location of json.lua! I use a synology, so this url isn't working on a rpi!

Code: Select all

  json = (loadfile "/volume1/@appstore/domoticz/var/scripts/lua/JSON.lua")()
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by poudenes »

HansieNL wrote:@poudenes Maybe it's possible to use my Feature Request on the train page... https://www.domoticz.com/forum/viewtopi ... 24#p132951
If someone can change the PHP created file to a full Javascript / json, maybe Rob can implement it full into Dashticz.
Only thing that will be variables are the #username $password and $afk ($afk to select your train station where you want to departure times)

Its also possible to request "verstoringen en werkzaamheden" but thats for future request :)
I can't write Javascript / json:(
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
blacksn0w
Posts: 99
Joined: Friday 10 March 2017 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by blacksn0w »

Finally managed to integrate the API of our local public transport provider into dashticz. So at the morning i dont have to look at the smartphone to get the current situation (updates every 15 seconds).
Image
Migration done, hello Home Assistant.
Blueone
Posts: 130
Joined: Friday 29 November 2013 11:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by Blueone »

Put the tablet to the wall this weekend :D . I'm using a zenpad 8.0 with a xvida qi charger and some adjusted xvida mounts. Working quite good actually :). It is using magnets and I can remove it very easily.
IMG_1866 - Copy.JPG
IMG_1866 - Copy.JPG (95.5 KiB) Viewed 6299 times
IMG_1865 - Copy.JPG
IMG_1865 - Copy.JPG (149.7 KiB) Viewed 6299 times
IMG_1867 - Copy.JPG
IMG_1867 - Copy.JPG (74.2 KiB) Viewed 6299 times
Last edited by Blueone on Sunday 07 May 2017 17:30, edited 1 time in total.
blacksn0w
Posts: 99
Joined: Friday 10 March 2017 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by blacksn0w »

Blueone wrote:Put the tabled to the wall this weekend :D . I'm using a zenpad 8.0 with a xvida qi charger and some adjusted xvida mounts. Working quite good actually :). It is using magnets and I can remove it very easily.
Great work! Do you have some links for the parts you've used?
Migration done, hello Home Assistant.
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by poudenes »

Blueone wrote:Put the tablet to the wall this weekend :D . I'm using a zenpad 8.0 with a xvida qi charger and some adjusted xvida mounts. Working quite good actually :). It is using magnets and I can remove it very easily.

IMG_1866 - Copy.JPG
IMG_1865 - Copy.JPG
IMG_1867 - Copy.JPG
Wow... how does it charge?
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by robgeerts »

Blueone wrote:I... with a xvida qi charger
mkscity
Posts: 6
Joined: Monday 24 April 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by mkscity »

blacksn0w wrote:Finally managed to integrate the API of our local public transport provider into dashticz. So at the morning i dont have to look at the smartphone to get the current situation (updates every 15 seconds).
Image
which script you used for your "Müll" tab?
blacksn0w
Posts: 99
Joined: Friday 10 March 2017 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: Show your Dashticz v2.0 and how-to's!

Post by blacksn0w »

mkscity wrote:
blacksn0w wrote:Finally managed to integrate the API of our local public transport provider into dashticz. So at the morning i dont have to look at the smartphone to get the current situation (updates every 15 seconds).
Image
which script you used for your "Müll" tab?
My garbage company offers the possibility to create a custom calender (.ics) for my street.
I've downloaded the file and copied it into my custom folder, then i used the calendar plugin from dashticz.
Just have a short look here, at the bottom there are the areas which are using the same system:
http://www.muellmax.de/mm/
Migration done, hello Home Assistant.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest