commit
853e422084
|
|
@ -33,6 +33,8 @@ Just one config is used to configure Domoboard. A example can be found the appli
|
|||
- setpoint
|
||||
- pushon
|
||||
- pushoff
|
||||
- group
|
||||
- scene
|
||||
- camera
|
||||
- weather
|
||||
- news
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@
|
|||
Slaapkamer lightstrip = 12, rgb
|
||||
Open Garage door = 456, pushon
|
||||
Close Garage door = 567, pushoff
|
||||
Scene Home = 4, scene
|
||||
Group kitchen lights = 5, group
|
||||
[[power_usage]]
|
||||
Totaal slaapkamer lamp = 12
|
||||
Totaal playstation = 71
|
||||
|
|
|
|||
|
|
@ -116,28 +116,29 @@ def writeToConfig(idx, page, component, description, extra):
|
|||
|
||||
def checkDomoticzStatus(config):
|
||||
domoticzDevices = []
|
||||
domoticzScenes = []
|
||||
try:
|
||||
result = json.loads(queryDomoticz("?type=devices&filter=all"))
|
||||
resultScene = json.loads(queryDomoticz("?type=scenes&filter=all"))
|
||||
except:
|
||||
print "Domoticz is not reachable."
|
||||
sys.exit()
|
||||
sys.exit("Domoticz is not reachable.")
|
||||
for device in result["result"]:
|
||||
domoticzDevices.append(device["idx"])
|
||||
configuredDevicesInDomoticz(config, domoticzDevices)
|
||||
for device in resultScene["result"]:
|
||||
domoticzScenes.append(device["idx"])
|
||||
configuredDevicesInDomoticz(config, domoticzDevices, domoticzScenes)
|
||||
|
||||
def configuredDevicesInDomoticz(config, domoticzDevices):
|
||||
def configuredDevicesInDomoticz(config, domoticzDevices, domoticzScenes):
|
||||
for k, v in config.iteritems():
|
||||
if isinstance(v, dict):
|
||||
configuredDevicesInDomoticz(v, domoticzDevices)
|
||||
configuredDevicesInDomoticz(v, domoticzDevices, domoticzScenes)
|
||||
else:
|
||||
if isinstance(v, int):
|
||||
if v not in domoticzDevices:
|
||||
print "Device with " + v + " is not available in Domoticz"
|
||||
sys.exit()
|
||||
if v not in domoticzDevices and v not in domoticzScenes:
|
||||
sys.exit("Device and/or scene with IDX {} is not available in Domoticz".format(v))
|
||||
elif isinstance(v, list):
|
||||
if (v[0].isdigit()) and (v[0] not in domoticzDevices):
|
||||
print "Device with " + v[0] + " is not available in Domoticz"
|
||||
sys.exit()
|
||||
if (v[0].isdigit()) and (v[0] not in domoticzDevices and v[0] not in domoticzScenes):
|
||||
sys.exit("Device and/or scene with IDX {} is not available in Domoticz".format(v[0]))
|
||||
|
||||
def getPluginDict():
|
||||
global indexes
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@ function changePush(idx, action) {
|
|||
}
|
||||
}
|
||||
|
||||
function changeScene(idx, action) {
|
||||
if (action == 'on') {
|
||||
requestAPI(flask_server + "/api?type=command¶m=switchscene&idx=" + idx + "&switchcmd=On" );
|
||||
} else {
|
||||
requestAPI(flask_server + "/api?type=command¶m=switchscene&idx=" + idx + "&switchcmd=Off" );
|
||||
}
|
||||
}
|
||||
|
||||
function refreshSwitches(updateSwitches, block) {
|
||||
$.each(updateSwitches, function (i, switchID) {
|
||||
|
|
|
|||
|
|
@ -23,14 +23,20 @@
|
|||
{% elif "dimmer" in v[1] %}
|
||||
<input id="dimmer_{{v[0]}}_block_{{count}}" data-slider-id='dimmer_{{v[0]}}' type="text" test={{ v[1] }} data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="14" />
|
||||
{% elif "pushon" in v[1] %}
|
||||
<button id="push_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle">On</button>
|
||||
<button id="push_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle"> <li class="fa fa-power-off" aria-hidden="true"></i> </button>
|
||||
{% elif "pushoff" in v[1] %}
|
||||
<button id="push_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle">Off</button>
|
||||
<button id="push_{{v[0]}}_block_{{count}}" class="btn btn-danger btn-circle"> <li class="fa fa-power-off" aria-hidden="true"></i> </button>
|
||||
{% elif "group" in v[1] %}
|
||||
<div><div style="float: left"><button id="groupon_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle"> <li class="fa fa-power-off" aria-hidden="true"></i> </button></div><div style="padding-left: 20px; float: left"><button id="groupoff_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle btn-danger"> <li class="fa fa-power-off" aria-hidden="true"></i> </button></div></div>
|
||||
{% elif "scene" in v[1] %}
|
||||
<button id="scene_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle"> <li class="fa fa-power-off" aria-hidden="true"></i> </button>
|
||||
{% elif "setpoint" in v[1] %}
|
||||
<div>
|
||||
<div style="float: left; margin-right: 5px"><h1 id="setpoint_{{v[0]}}_block_{{count}}" style="font-size: 16px;"></h1></div>
|
||||
<div style=""><i onclick="changeUp({{ v[0] }}, {{count}})" class="fa fa-arrow-up" style="font-size: 13px; cursor: pointer;" aria-hidden="true"></i></div>
|
||||
<div style=""><i onclick="changeDown({{ v[0] }}, {{count}})" class="fa fa-arrow-down" style="font-size: 13px; cursor: pointer;" aria-hidden="true"></i></div>
|
||||
<div style="float: left">
|
||||
<div style=""><i onclick="changeUp({{ v[0] }}, {{count}})" class="fa fa-arrow-up" style="font-size: 13px; cursor: pointer;" aria-hidden="true"></i></div>
|
||||
<div style=""><i onclick="changeDown({{ v[0] }}, {{count}})" class="fa fa-arrow-down" style="font-size: 13px; cursor: pointer;" aria-hidden="true"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
{% elif "rgb" in v[1] %}
|
||||
<input id="dimmer_{{v[0]}}_block_{{count}}" data-slider-id='dimmer_{{v[0]}}' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="14" />
|
||||
|
|
@ -105,6 +111,19 @@ $(document).ready(function() {
|
|||
e.preventDefault();
|
||||
changePush({{v[0]}}, 'off');
|
||||
});
|
||||
{% elif (v[1] == "group") or (v[1] == "scene") %}
|
||||
$('button[id="groupon_{{v[0]}}_block_{{count}}"]').click(function(e) {
|
||||
e.preventDefault();
|
||||
changeScene({{v[0]}}, 'on');
|
||||
});
|
||||
$('button[id="groupoff_{{v[0]}}_block_{{count}}"]').click(function(e) {
|
||||
e.preventDefault();
|
||||
changeScene({{v[0]}}, 'off');
|
||||
});
|
||||
$('button[id="scene_{{v[0]}}_block_{{count}}"]').click(function(e) {
|
||||
e.preventDefault();
|
||||
changeScene({{v[0]}}, 'on');
|
||||
});
|
||||
{% elif (v[1] == "setpoint") %}
|
||||
updateSetpoints_block_{{count}}.push("{{v[0]}}");
|
||||
{% elif (v[1] == "dimmer" or v[1] == "rgb") %}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>TV-Gids </h2>
|
||||
<ul class="nav navbar-right panel_toolbox">
|
||||
<li><a class="close-link"><i class="fa fa-close"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div id="tvgids" style="height: 450px;">
|
||||
<iframe frameborder=0 style="overflow: hidden; position: relative; height: 100%; width: 100%;" src='https://www.tvgids24.nl/gadget'/></iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue