Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
domotikad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
domotika
domotikad
Commits
0cc2a281
Commit
0cc2a281
authored
Feb 12, 2014
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now all action commands supports both "command " and "command:" syntax
parent
04749d31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
43 deletions
+106
-43
clima.php
Web/htdocs/gui/left/clima.php
+21
-0
clima.php
Web/htdocs/gui/pages/clima.php
+20
-20
domotika.py
domotika/domotika.py
+65
-23
No files found.
Web/htdocs/gui/left/clima.php
0 → 100644
View file @
0cc2a281
<?
@
include_once
(
"../includes/common.php"
);
?>
<div
class=
"left-drawer"
>
<div
id=
"websectionlist"
class=
"panel drawer-container scrollable"
>
<a
href=
"
<?=
$BASEGUIPATH
.
"/cameras"
?>
"
data-guisubsection=
''
class=
"btn btn-block btn-default"
>
Telecamere Home
</a>
<?
$v
=
DB
::
query
(
"SELECT id,button_name,position FROM mediasources WHERE websection='camera' AND active=1 ORDER BY position,id"
);
$links
=
array
();
foreach
(
$v
as
$cam
)
{
$links
[
$cam
[
'button_name'
]]
=
$cam
[
'id'
];
}
ksort
(
$links
,
SORT_NATURAL
|
SORT_FLAG_CASE
);
foreach
(
$links
as
$k
=>
$v
)
{
?>
<a
href=
"
<?=
$BASEGUIPATH
.
"/cameras/"
.
$v
?>
"
data-guisubsection=
'
<?=
$v
?>
'
class=
"btn btn-block btn-default"
>
<?=
$k
?>
</a>
<?
}
?>
</div>
</div>
Web/htdocs/gui/pages/clima.php
View file @
0cc2a281
<?
@
include_once
(
"../includes/common.php"
);
?>
<div
class=
"
row
insider"
>
<div
class=
"insider"
>
<?
$DEFPANELS
=
array
();
$DEFPANELS
[]
=
array
(
'panel_title'
=>
'clima'
,
'panel_type'
=>
'clima'
,
'panel_sections'
=>
''
,
'panel_websections'
=>
'home'
,
'panel_cols'
=>
6
,
'panel_height'
=>
'100%'
)
+
$PANELDEFAULTS
;
//$DEFPANELS[]=array('panel_title'=>'Uscite Home','panel_sections'=>'relay','panel_websections'=>'home','panel_height'=>'100%')+$PANELDEFAULTS;
//$DEFPANELS[]=array('panel_title'=>'Ingressi Home','panel_sections'=>'input','panel_websections'=>'window','panel_height'=>'100%')+$PANELDEFAULTS;
$paneldimensions
=
array
(
'dimensions'
=>
array
(
4
=>
'50%'
));
$SHOW_EMPTY_PANELS
=
FALSE
;
$panels
=
DB
::
query
(
"SELECT * FROM user_gui_panels WHERE user='
$_DOMOTIKA[username]
' AND page='clima' ORDER by panel_position,id"
);
if
(
!
$panels
or
count
(
$panels
)
<
1
)
{
$panels
=
$DEFPANELS
;
/*
foreach($panels as $p) {
$q="INSERT INTO user_gui_panels
(user,page,panel_title,panel_type,panel_cols,panel_height,panel_visible,panel_position,panel_sections,panel_websections,panel_selector,panel_content)
VALUES
('".$_DOMOTIKA['username']."','clima','".$p['panel_title']."','".$p['panel_type']."',
'".$p['panel_cols']."','".$p['panel_height']."','".$p['panel_visible']."','".$p['panel_position']."',
'".$p['panel_sections']."','".$p['panel_websections']."','".$p['panel_selector']."','".$p['panel_content']."')";
//DB::query($q);
}
*/
if
(
$GUISUBSECTION
==
""
)
{
$panels
=
array
();
$panels
[]
=
array
(
'panel_title'
=>
$tr
->
Get
(
'clima'
)
.
" - "
.
$tr
->
Get
(
"Actions"
),
'panel_sections'
=>
'actions'
,
'panel_websections'
=>
'clima'
,
'panel_cols'
=>
4
,
'panel_height'
=>
'100%'
)
+
$PANELDEFAULTS
;
$panels
[]
=
array
(
'panel_title'
=>
$tr
->
Get
(
'clima'
)
.
" - "
.
$tr
->
Get
(
"Outputs"
),
'panel_sections'
=>
'output'
,
'panel_websections'
=>
'clima'
,
'panel_cols'
=>
4
,
'panel_height'
=>
'100%'
)
+
$PANELDEFAULTS
;
$panels
[]
=
array
(
'panel_title'
=>
$tr
->
Get
(
'clima'
)
.
" - "
.
$tr
->
Get
(
"Inputs"
),
'panel_sections'
=>
'input'
,
'panel_websections'
=>
'clima'
,
'panel_cols'
=>
4
,
'panel_height'
=>
'100%'
)
+
$PANELDEFAULTS
+
$paneldimensions
;
$panels
[]
=
array
(
'panel_title'
=>
$tr
->
Get
(
'clima'
)
.
" - "
.
$tr
->
Get
(
"Analogs"
),
'panel_sections'
=>
'analog'
,
'panel_websections'
=>
'clima'
,
'panel_cols'
=>
4
,
'panel_height'
=>
'100%'
)
+
$PANELDEFAULTS
+
$paneldimensions
;
}
else
{
}
include
(
$FSPATH
.
"/panels/include.php"
);
?>
</div>
<!--
row
-->
</div>
<!--
insider
-->
domotika/domotika.py
View file @
0cc2a281
...
...
@@ -945,19 +945,20 @@ class domotikaService(service.Service):
self
.
_sendNotify
(
nsrc
,
ue
.
username
,
msg
,
expire
)
events
.
postEvent
(
events
.
ActionEvent
(
command
))
if
command
.
startswith
(
"SYSTEM "
):
if
command
.
startswith
(
"SYSTEM "
)
or
command
.
startswith
(
"SYSTEM:"
)
:
log
.
debug
(
command
)
command
=
command
[
7
:]
subprocess
.
Popen
(
command
.
replace
(
"
SYSTEM "
,
""
)
.
replace
(
"
\r\n
"
,
" "
),
command
.
replace
(
"
\r\n
"
,
" "
),
shell
=
True
,
preexec_fn
=
os
.
setsid
)
elif
command
.
startswith
(
"NETSTATUS "
):
try
:
nst
=
command
.
split
()[
1
]
excep
t
:
elif
command
.
startswith
(
"NETSTATUS "
)
or
command
.
startswith
(
"NETSTATUS:"
)
:
command
=
command
[
10
:]
nst
=
command
.
split
()[
0
]
if
not
ns
t
:
nst
=
"DEFAULT"
dmdb
.
updateNetStatus
(
nst
)
.
addCallback
(
self
.
sendNetStatus
,
True
)
elif
command
.
startswith
(
"EMAIL "
):
mname
=
" "
.
join
(
command
.
split
()[
1
:])
elif
command
.
startswith
(
"EMAIL "
)
or
command
.
startswith
(
"EMAIL:"
)
:
mname
=
command
[
6
:]
email
.
sendEmailByName
(
mname
)
elif
command
.
startswith
(
"NOTIFY "
)
or
command
.
startswith
(
"NOTIFY:"
):
...
...
@@ -1005,10 +1006,14 @@ class domotikaService(service.Service):
if
len
(
fc
)
>
1
:
dmdb
.
updateStatusRealtime
(
fc
[
0
],
fc
[
1
])
elif
command
.
startswith
(
"CRON "
):
elif
command
.
startswith
(
"CRON "
)
or
command
.
startswith
(
"CRON:"
)
:
try
:
cact
=
str
(
command
.
split
()[
1
])
.
lower
()
tid
=
int
(
command
.
split
()[
2
])
if
':'
in
command
:
fc
=
command
[
5
:]
.
split
(
':'
)
else
:
fc
=
command
[
5
:]
.
split
()
cact
=
str
(
fc
[
0
])
.
lower
()
tid
=
int
(
fc
[
1
])
if
cact
in
[
'enable'
,
'disable'
,
'change'
]:
sqlstring
=
"update timers set active="
if
cact
==
'change'
:
...
...
@@ -1021,17 +1026,54 @@ class domotikaService(service.Service):
dmdb
.
runOperation
(
sqlstring
)
except
:
pass
elif
command
.
startswith
(
"PLUGIN "
):
pname
=
command
.
replace
(
"PLUGIN "
,
""
)
.
split
(
":"
)[
0
]
preq
=
command
.
replace
(
"PLUGIN "
,
""
)
.
split
(
":"
)[
1
:]
elif
command
.
startswith
(
"CRONDOMAIN "
)
or
command
.
startswith
(
"CRONDOMAIN:"
):
try
:
if
':'
in
command
:
fc
=
command
[
11
:]
.
split
(
':'
)
else
:
fc
=
command
[
11
:]
.
split
()
cact
=
str
(
fc
[
0
])
.
lower
()
tid
=
str
(
fc
[
1
])
if
cact
in
[
'enable'
,
'disable'
,
'change'
]:
sqlstring
=
"update timers set active="
if
cact
==
'change'
:
sqlstring
+=
"IF(active=1, 0, 1)"
elif
cact
==
'disable'
:
sqlstring
+=
"0"
elif
cact
==
'enable'
:
sqlstring
+=
"1"
sqlstring
+=
" where DMDOMAIN('"
+
tid
+
"', timer_name)=1"
dmdb
.
runOperation
(
sqlstring
)
except
:
pass
elif
command
.
startswith
(
"PLUGIN "
)
or
command
.
startswith
(
"PLUGIN:"
):
if
':'
in
command
:
pc
=
command
[
7
:]
.
split
(
':'
)
sp
=
":"
else
:
pc
=
command
[
7
:]
.
split
(
' '
)
sp
=
" "
pname
=
pc
[
0
]
preq
=
""
if
len
(
pc
)
>
1
:
preq
=
sp
.
join
(
pc
[
1
:])
self
.
plugins
.
push_request
(
pname
,
preq
)
elif
command
.
startswith
(
"PHONECALL "
):
command
=
command
.
replace
(
"PHONECALL "
,
""
)
callfrom
=
command
.
split
()[
0
]
callto
=
command
.
split
()[
1
]
self
.
astmanager
.
startCall
(
callfrom
,
extensionto
=
callto
)
elif
command
.
startswith
(
"PHONESAY "
):
command
=
command
.
replace
(
"PHONESAY "
,
""
)
elif
command
.
startswith
(
"PHONECALL "
)
or
command
.
startswith
(
"PHONECALL:"
):
if
':'
in
command
:
command
=
command
[
10
:]
.
split
(
':'
)
else
:
command
=
command
[
10
:]
.
split
()
if
len
(
command
)
>
1
:
callfrom
=
command
[
0
]
callto
=
command
[
1
]
self
.
astmanager
.
startCall
(
callfrom
,
extensionto
=
callto
)
elif
command
.
startswith
(
"PHONESAY "
)
or
command
.
startswith
(
"PHONESAY:"
):
command
=
command
[
9
:]
ptext
=
command
.
split
(
"] "
)[
0
][
1
:]
popts
=
command
.
split
(
"] "
)[
1
]
.
split
()[
0
]
pretry
=
1
...
...
@@ -1058,8 +1100,8 @@ class domotikaService(service.Service):
self
.
astmanager
.
phoneSay
(
ptext
,
pnumbers
,
retry
=
int
(
pretry
),
interval
=
int
(
pinterval
),
replay
=
int
(
preplay
),
engine
=
str
(
engine
))
elif
command
.
startswith
(
"PHONEPLAY "
):
command
=
command
.
replace
(
"PHONEPLAY "
,
""
)
elif
command
.
startswith
(
"PHONEPLAY "
)
or
command
.
startswith
(
"PHONEPLAY:"
)
:
command
=
command
[
10
:]
pfile
=
command
.
split
()[
0
]
popts
=
command
.
split
()[
1
]
pretry
=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment