From: Vincent Date: Tue, 11 Feb 2020 09:17:42 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fe78c03e434d91c55d4453898aa057e75cf21e3b;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9a8d881..0f2686b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - @@ -253,6 +270,13 @@ + + + + + + + @@ -795,14 +819,8 @@ - - - - 1573630565923 - 1574066196695 @@ -1140,7 +1158,14 @@ - @@ -1187,17 +1212,21 @@ + + + + - + - + @@ -1211,17 +1240,17 @@ - + - - + + - + diff --git a/config/tv.php b/config/tv.php index 7463034..db1c602 100644 --- a/config/tv.php +++ b/config/tv.php @@ -1,21 +1,21 @@ igbget('dvbchannels'); -if (!$mapdvb) { - $mapdvb = array(); - $m3u = getUrlContent('http://192.168.13.60:9981/playlist/channels', 30); - $lines = explode("\n", $m3u); - $name = ''; - foreach ($lines as $line) { - $line = trim($line); - if (strpos($line, '#EXTINF:') === 0) { - $e = explode(',', $line); - $name = array_pop($e); - } else if (strpos($line, 'http') === 0) { - $mapdvb[$name] = $line; - } - } - connectRedis()->igbsetex('dvbchannels', 3600, $mapdvb); -} +//$mapdvb = connectRedis()->igbget('dvbchannels'); +//if (!$mapdvb) { +// $mapdvb = array(); +// $m3u = getUrlContent('http://192.168.13.60:9981/playlist/channels', 30); +// $lines = explode("\n", $m3u); +// $name = ''; +// foreach ($lines as $line) { +// $line = trim($line); +// if (strpos($line, '#EXTINF:') === 0) { +// $e = explode(',', $line); +// $name = array_pop($e); +// } else if (strpos($line, 'http') === 0) { +// $mapdvb[$name] = $line; +// } +// } +// connectRedis()->igbsetex('dvbchannels', 3600, $mapdvb); +//} $tv = array( 'Replay' => array('freebox' => 'replay'), diff --git a/scripts/cron/cron.php b/scripts/cron/cron.php index ff1437c..44ee273 100644 --- a/scripts/cron/cron.php +++ b/scripts/cron/cron.php @@ -29,6 +29,7 @@ function cronOneLoop($cronmin) cronHarmony($cronmin); cronInterface($cronmin); if ($cronmin % 15 == 0) { + cronXPlane($cronmin); cronPodcasts($cronmin); } cronEcoMode($cronmin); @@ -40,6 +41,13 @@ function cronOneLoop($cronmin) cronHeartbeat($cronmin); } +function cronXPlanet($cronmin){ + $path=ROOT.'/tools/xplanet/'; + $suncurve=$path.'xplanet-suncurve'; + + `$path`; +} + function cronGuest($cronmin) { setState('guest', hasGuest() ? '1' : '0'); diff --git a/scripts/lib/domoticz.php b/scripts/lib/domoticz.php index 4266b3c..c3ec15e 100644 --- a/scripts/lib/domoticz.php +++ b/scripts/lib/domoticz.php @@ -6,7 +6,7 @@ function runDomoticzCommand($params) unset($params['delay']); - $ip = '192.168.13.68'; + $ip = '192.168.13.60'; return httpRequest('http://' . $ip . ':8084/json.htm', 'GET', $params); } diff --git a/scripts/lib/redis.php b/scripts/lib/redis.php index f145544..9a42c94 100644 --- a/scripts/lib/redis.php +++ b/scripts/lib/redis.php @@ -8,7 +8,7 @@ class StringSetIb protected function filterArguments(Array $arguments) { - $arguments[1] = igbinary_serialize($arguments[1]); + $arguments[1] = serialize($arguments[1]); return $arguments; } } @@ -19,7 +19,7 @@ class StringSetexIb protected function filterArguments(Array $arguments) { - $arguments[2] = igbinary_serialize($arguments[2]); + $arguments[2] = serialize($arguments[2]); return $arguments; } } @@ -30,7 +30,7 @@ class StringGetIb public function parseResponse($data) { - return @igbinary_unserialize($data); + return @unserialize($data); } } diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 79ced19..e991769 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -456,6 +456,7 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/planetarium/off'], ['type' => 'ifttt', 'event' => 'coffee_off'], ['type' => 'scene', 'scene' => 'home/hueoff'], + ['type' => 'scene', 'scene' => 'salon/off', 'delay' => 2], //['type' => 'ifttt', 'event' => 'oven_off'], ], 'home/welcome' => [ diff --git a/servers/startdaemon b/servers/startdaemon index a234bed..3b74ad6 100644 --- a/servers/startdaemon +++ b/servers/startdaemon @@ -1,2 +1,2 @@ #!/bin/sh -/sbin/start-stop-daemon --start --quiet --user pi --chuid pi --name home-$1 --make-pidfile --pidfile /run/home-$1.pid --background --startas /bin/bash -- -c "exec /var/www/home/servers/_startdaemon.php $1" \ No newline at end of file +/sbin/start-stop-daemon --start --quiet --user pi --chuid pi --name home-$1 --make-pidfile --pidfile /var/run/home-$1.pid --background --startas /bin/bash -- -c "exec /var/www/home/servers/_startdaemon.php $1" \ No newline at end of file diff --git a/servers/stopdaemon b/servers/stopdaemon index afdfb44..ee79be9 100644 --- a/servers/stopdaemon +++ b/servers/stopdaemon @@ -1,3 +1,3 @@ #!/bin/sh -/sbin/start-stop-daemon --stop --pidfile /run/home-$1.pid --retry 10 +/sbin/start-stop-daemon --stop --pidfile /var/run/home-$1.pid --retry 10 pkill -f $1.php \ No newline at end of file diff --git a/tools/pop/pop.py b/tools/pop/pop.py index c91ebcf..88a2b29 100644 --- a/tools/pop/pop.py +++ b/tools/pop/pop.py @@ -1,7 +1,7 @@ -#!/usr/bin/python +#!/usr/bin/python3 from bluepy import btle -from urllib2 import urlopen +from urllib import request import sys device = sys.argv[1] @@ -18,11 +18,12 @@ class MyDelegate(btle.DefaultDelegate): btle.DefaultDelegate.__init__(self) def handleNotification(self, cHandle, data): - cmd = map[ord(data[0])] + print(data[0]) + cmd = map[data[0]] print("Notification was received %s" % cmd) req = "https://" + room + ".home.tortuga.enhydra.fr/scripts/pop.php?button=" + device + "&action=" + cmd try: - urlopen(req) + request.urlopen(req) except: print('request timeout') @@ -41,12 +42,11 @@ while True: p.setDelegate(MyDelegate()) # Setup to turn notifications on, e.g. - #svc = p.getServiceByUUID("0000fe61-0000-1000-8000-00805f9b34fb") - #ch = svc.getCharacteristics()[0] + svc = p.getServiceByUUID("0000fe61-0000-1000-8000-00805f9b34fb") + ch = svc.getCharacteristics()[0] # Main loop -------- - - #p.writeCharacteristic(ch.valHandle+1, "\x02\x00") + p.writeCharacteristic(ch.valHandle+1, b'\x02\x00') while True: try: diff --git a/tools/pop/startpopdaemon b/tools/pop/startpopdaemon index 88d43a3..aafdab7 100644 --- a/tools/pop/startpopdaemon +++ b/tools/pop/startpopdaemon @@ -1,2 +1,2 @@ #!/bin/sh -/sbin/start-stop-daemon --start --quiet --user root --chuid root --name pop-$1 --make-pidfile --pidfile /run/pop-$1.pid --background --startas /bin/bash -- -c "exec /var/www/home/tools/pop/pop.py $1 >> /var/log/pop/$1.log" \ No newline at end of file +/sbin/start-stop-daemon --start --quiet --user root --chuid root --name pop-$1 --make-pidfile --pidfile /var/run/pop-$1.pid --background --startas /bin/bash -- -c "exec /var/www/home/tools/pop/pop.py $1 >> /var/log/pop/$1.log" \ No newline at end of file diff --git a/tools/pop/stoppopdaemon b/tools/pop/stoppopdaemon index 7354667..880a1b1 100644 --- a/tools/pop/stoppopdaemon +++ b/tools/pop/stoppopdaemon @@ -1,2 +1,2 @@ #!/bin/sh -/sbin/start-stop-daemon --stop --pidfile /run/pop-$1.pid --retry 10 \ No newline at end of file +/sbin/start-stop-daemon --stop --pidfile /var/run/pop-$1.pid --retry 10 \ No newline at end of file diff --git a/tools/xplanet/config b/tools/xplanet/config new file mode 100644 index 0000000..259442b --- /dev/null +++ b/tools/xplanet/config @@ -0,0 +1,5 @@ +[earth] +"Earth" +grid=no +map=/var/www/home/tools/xplanet/earth.png +night_map=/var/www/home/tools/xplanet/earth_lights_4800.tif diff --git a/tools/xplanet/earth_lights_4800.tif b/tools/xplanet/earth_lights_4800.tif new file mode 100644 index 0000000..e442930 Binary files /dev/null and b/tools/xplanet/earth_lights_4800.tif differ diff --git a/tools/xplanet/world.topo.bathy.200401.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200401.3x5400x2700.png new file mode 100644 index 0000000..1f1f382 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200401.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200402.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200402.3x5400x2700.png new file mode 100644 index 0000000..1aa5799 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200402.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200403.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200403.3x5400x2700.png new file mode 100644 index 0000000..472bd5a Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200403.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200404.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200404.3x5400x2700.png new file mode 100644 index 0000000..16dd34c Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200404.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200405.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200405.3x5400x2700.png new file mode 100644 index 0000000..5e6d260 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200405.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200406.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200406.3x5400x2700.png new file mode 100644 index 0000000..c502a85 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200406.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200407.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200407.3x5400x2700.png new file mode 100644 index 0000000..9f33405 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200407.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200408.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200408.3x5400x2700.png new file mode 100644 index 0000000..4bc350f Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200408.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200409.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200409.3x5400x2700.png new file mode 100644 index 0000000..b3948b3 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200409.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200410.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200410.3x5400x2700.png new file mode 100644 index 0000000..f4f3093 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200410.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200411.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200411.3x5400x2700.png new file mode 100644 index 0000000..dda4ed9 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200411.3x5400x2700.png differ diff --git a/tools/xplanet/world.topo.bathy.200412.3x5400x2700.png b/tools/xplanet/world.topo.bathy.200412.3x5400x2700.png new file mode 100644 index 0000000..346ab22 Binary files /dev/null and b/tools/xplanet/world.topo.bathy.200412.3x5400x2700.png differ diff --git a/tools/xplanet/xplanet-suncurve b/tools/xplanet/xplanet-suncurve new file mode 100644 index 0000000..2661e43 --- /dev/null +++ b/tools/xplanet/xplanet-suncurve @@ -0,0 +1,4 @@ +#!/bin/sh +month=$(date +%m) +ln -sf "/var/www/home/tools/xplanet/world.topo.bathy.2004$month.3x5400x2700.png" "/var/www/home/tools/xplanet/earth.png" +xplanet -config /var/www/home/tools/xplanet/config -longitude 2.3343236 -geometry 1600x1200 -projection rectangular -num_times 1 -output /var/www/home/images/suncurve.png \ No newline at end of file