Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #80

Merged
merged 9 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
24.2
24.3
- Fixed DoorLockInverted
- Security Update. DZGA now reads smart-home-key.json file from config folder. Move .json file or upload a new.
- Added new device, Door Lock Inverted.
- Changed check version, get latest updates.
9 changes: 6 additions & 3 deletions modules/trait.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,12 @@ def execute(device, command, params, user_id, challenge):
response['on'] = params['on']

if command == 'action.devices.commands.LockUnlock':

url += 'switchlight&idx=' + idx + '&switchcmd=' + (
'On' if params['lock'] else 'Off')
if domain in ['DoorLockInverted']:
url += 'switchlight&idx=' + idx + '&switchcmd=' + (
'Off' if params['lock'] else 'On')
else:
url += 'switchlight&idx=' + idx + '&switchcmd=' + (
'On' if params['lock'] else 'Off')

response['isLocked'] = params['lock']

Expand Down
15 changes: 12 additions & 3 deletions static/js/smarthome.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,18 @@ function changeRGB(ridx, val) {
requestAPI("/api?type=command&param=setcolbrightnessvalue&idx=" + ridx + "&hex=" + rgbcode_stripped);
}

function changeDimmers(idx, val) {
$('#output_' + idx).html(val);
requestAPI("/api?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set%20Level&level=" + val)
function changeDimmers(idx, val, protect) {
if (protect == 'True'){
$('#dimmerpin_' + idx).modal('show');
}else{
$('#output_' + idx).html(val);
requestAPI("/api?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set%20Level&level=" + val)
}
}
function changeSecDimmers(idx, val) {
var pin = $('#inputDimPin_'+idx).val();
$('#output_' + idx).html(val);
requestAPI("/api?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set%20Level&level=" + val + "&passcode=" + pin)
}

function setSetpoint(idx, protect) {
Expand Down
38 changes: 37 additions & 1 deletion templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,43 @@ <h5 class="card-title">Device log <span>| {{ v['name']['name'] }}</span></h5>
<small id="output_{{ v['customData']['idx'] }}">0</small>
<div class="label">{{ v['name']['name'] }}</div>
</div>
<input id="slider_{{ v['customData']['idx'] }}" type="range" min="0" max="100" step="1" onchange="changeDimmers({{ v['customData']['idx'] }}, this.value)">
<input id="slider_{{ v['customData']['idx'] }}" type="range" min="0" max="100" step="1" onchange="changeDimmers({{ v['customData']['idx'] }}, this.value, '{{ v['customData']['protected'] }}')">
<div class="modal fade" id="onoffpin_{{ v['customData']['idx'] }}" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-sm">
<div class="modal-content">
<div class="modal-body">
<form class="row g-3">
<div class="col-12">
<label for="inputPin_{{ v['customData']['idx'] }}" class="form-label">Enter Pin</label>
<input inputmode="numeric" type="password" class="form-control" id="inputPin_{{ v['customData']['idx'] }}">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Close</button>
<button onclick="toogleSecSwitch({{ v['customData']['idx'] }})" type="button" class="btn btn-primary btn-sm" data-bs-dismiss="modal">Submit</button>
</div>
</div>
</div>
</div><!-- End Vertically centered Modal-->
<div class="modal fade" id="dimmerpin_{{ v['customData']['idx'] }}" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-sm">
<div class="modal-content">
<div class="modal-body">
<form class="row g-3">
<div class="col-12">
<label for="inputDimPin_{{ v['customData']['idx'] }}" class="form-label">Enter Pin</label>
<input inputmode="numeric" type="password" class="form-control" id="inputDimPin_{{ v['customData']['idx'] }}">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Close</button>
<button onclick="changeSecDimmers({{ v['customData']['idx'] }}, slider_{{ v['customData']['idx'] }}.value)" type="button" class="btn btn-primary btn-sm" data-bs-dismiss="modal">Submit</button>
</div>
</div>
</div>
</div><!-- End Vertically centered Modal-->
<div class="card-footer col-sm-12">
<small class="float-start" style="font-size: x-small;" id="lastUpdate_{{ v['customData']['idx'] }}">Not available</small><i class="bi bi-bar-chart-fill float-end" onClick="getLigthLog({{ v['customData']['idx'] }})" data-bs-toggle="modal" data-bs-target="#light-log_{{ v['customData']['idx'] }}" style="font-size: x-small;"></i>
<div class="modal fade" id="light-log_{{ v['customData']['idx'] }}" tabindex="-1">
Expand Down
2 changes: 1 addition & 1 deletion templates/devices.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ <h5 class="card-title">Description <span>| {{ v['name']['name'] }}</span></h5>
</div>
{% endif %}
<div class="row mb-3">
<small class="text-center text-info">Sync devices after saving for the changes to take effect</small>
<small class="text-center text-danger"><strong>Sync devices after saving for the changes to take effect</strong></small>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ <h5 class="card-title">Info <span>| {{ user.username }}</span></h5>
<div class="post-item clearfix">
<h4><a href="https://smarthome-test-suite.withgoogle.com/devices" target="_blank">About </a></h4>
<p>
<b>DZGA-Flask Version: </b><span id="dzga-version">Not available</span><span id="newver"></span>
<b>DZGA-Flask Version: </b><span id="dzga-version">Not available</span><span class="text-warning" id="newver"></span>
</br>
<b>Domoticz Version: </b><span id="dz-version">Not available</span></br>
<b>Domoticz Version: </b><span id="dz-version">Not available</span>
</p>

</div>
Expand All @@ -20,7 +20,7 @@ <h4><a href="https://smarthome-test-suite.withgoogle.com/devices" target="_blank
<p>
{% for x in version %}
{% if x != version[0] %}
{{ x }} </br>
{{ x }}<br />
{% endif %}
{% endfor %}
</p>
Expand Down
2 changes: 1 addition & 1 deletion templates/serveradmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card">
<div class="card-body">
<h5 class="card-title">Server settings <span>| Admin</span></h5>
<p>Actions on Google API key will be disabled if <code>smart-home-key.json</code> file is added.</p>
<p>Actions on Google API key will be <span class="text-info">disabled</span> if smart-home-key.json file is added.</p>

<form class="row g-3" role="form" name="modifyConfigForm" method="post">
<div class="col-md-6">
Expand Down
6 changes: 3 additions & 3 deletions templates/upload.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="card">
<div class="card-body">
<h5 class="card-title">File upload <span>| Admin</span></h5>
<p>Upload your {% if user.admin %}<code>smart-home-key.json</code> file or{% endif %} profile image here. Optimal size is 120x120px. Name your profile image to <code>{{ user.username }}.png</code> or <code>{{ user.username }}.jpg</code>.</p>
<p>Upload your profile image {% if user.admin %}or <span class="text-info">smart-home-key.json</span> file{% endif %} here. Optimal size is 120x120px. Name your profile image to <span class="text-info">{{ user.username }}.png</span> or <span class="text-info">{{ user.username }}.jpg</span>.</p>
<form class="row g-3" action = "{{ url_for('uploader') }}" method = "POST" enctype="multipart/form-data">
<div class="col-sm-12">
<label for="file" class="col-sm-2 col-form-label">File Upload</label>
<label for="file" class="col-sm-2 form-label">File Upload</label>
<input class="form-control" id="file" name="file" type="file" />
</div>
<div class="col-12">
Expand All @@ -20,4 +20,4 @@ <h5 class="card-title">File upload <span>| Admin</span></h5>
</div>
</form>
</div>
</div>
</div>
Loading