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

Add Camera device #104

Merged
merged 3 commits into from
Feb 28, 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
6 changes: 5 additions & 1 deletion modules/domoticz.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def getDomain(device):
devs = devs.replace(" ", "")
devs = devs.replace("/", "")
devs = devs.replace("+", "")
if device["UsedByCamera"] == True:
devs = 'Camera'

return devs

Expand Down Expand Up @@ -181,7 +183,7 @@ def getAog(device, user_id=None):
hide = desc.get('hide', False)
if hide:
domain = domain + '_Hidden'

aog.customData['idx'] = device.get('idx')
aog.customData['domain'] = domain
aog.customData['protected'] = device.get('Protected')
Expand Down Expand Up @@ -344,6 +346,8 @@ def getAog(device, user_id=None):
if domain == 'Doorbell':
aog.type = 'action.devices.types.DOORBELL'
aog.traits.append('action.devices.traits.ObjectDetection')
if device.get('CameraIdx'):
aog.customData['cameraIdx'] = device.get('CameraIdx')
aog.traits.append('action.devices.traits.CameraStream')
aog.attributes = {
'cameraStreamSupportedProtocols': [
Expand Down
4 changes: 2 additions & 2 deletions templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ <h5 id="title_other">Other devices <small>(not supported devices)</small><i clas
{% if (v['customData']['domain'] not in (
'Group','Scene','Thermostat', 'Setpoint','Temp', 'TempHumidity', 'TempHumidityBaro','SmokeDetector', 'Security',
'VenetianBlindsEU', 'OnOff', 'Dimmer', 'VenetianBlindsUS', 'Doorbell', 'DoorLock', 'DoorLockInverted', 'Selector', 'DoorContact', 'BlindsPercentage',
'MotionSensor', 'PushOnButton', 'PushOffButton', 'ColorSwitch', 'Contact') and 'Hidden' not in v['customData']['domain'] ) %}
'MotionSensor', 'PushOnButton', 'PushOffButton', 'ColorSwitch', 'Contact', 'Camera') and 'Hidden' not in v['customData']['domain'] ) %}
<div class="icon">
<i class="material-symbols-outlined" id="icon_{{ v['customData']['idx'] }}">unknown_2</i>
<small id="data_{{ v['customData']['idx'] }}">Not available</small>
Expand Down Expand Up @@ -906,7 +906,7 @@ <h5 id="title_other">Other devices <small>(not supported devices)</small><i clas
$("#title_security > i").toggleClass('bi bi-chevron-compact-up')
{% elif (v['customData']['domain'] not in (
'SmokeDetector', 'Security', 'VenetianBlindsEU', 'OnOff', 'VenetianBlindsUS', 'Doorbell', 'DoorLock', 'DoorLockInverted', 'DoorContact', 'BlindsStop', 'BlindsPercentage',
'MotionSensor', 'PushOnButton', 'PushOffButton', 'Contact') and 'Hidden' not in v['customData']['domain']) %}
'MotionSensor', 'PushOnButton', 'PushOffButton', 'Contact', 'Camera') and 'Hidden' not in v['customData']['domain']) %}
updateOthers_block.push("{{ v['customData']['idx'] }}")
$('#title_other').show()
{% else %}
Expand Down
9 changes: 4 additions & 5 deletions templates/devices.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ <h5 class="card-title">Description <span>| {{ v['name']['name'] }}</span></h5>
<label for="inputText" class="col-sm-3 col-form-label">Device Type</label>
<div class="col-sm-6">
<select id="devicetype" name="devicetype" class="form-select"
{% if (v['customData']['domain'] in ['Security', 'Scene', 'Group', 'SmokeDetector', 'MotionSensor', 'Doorbell', 'Camera']) %}
{% if (v['customData']['domain'] in ['Security', 'Scene', 'Group', 'SmokeDetector', 'MotionSensor']) %}
disabled
{% endif %}>
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'default' %}selected {% endif %} value="default">Set default type</option>
Expand All @@ -156,8 +156,6 @@ <h5 class="card-title">Description <span>| {{ v['name']['name'] }}</span></h5>
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'sensor' %}selected {% endif %} value="sensor">Sensor</option>
{% elif v['customData']['domain'] == 'SmokeDetector' %}
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'smoke_detector' %}selected {% endif %} value="smoke_detector">Smoke Detector</option>
{% elif v['customData']['domain'] == 'Camera' %}
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'camera' %}selected {% endif %} value="camera">Camera</option>
{% elif v['customData']['domain'] == 'Group' %}
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'switch' %}selected {% endif %} value="switch">Switch</option>
{% elif v['customData']['domain'] in ['Thermostat', 'Setpoint'] %}
Expand All @@ -168,7 +166,8 @@ <h5 class="card-title">Description <span>| {{ v['name']['name'] }}</span></h5>
{% elif v['customData']['domain'] in ['Temp', 'TempHumidity', 'TempHumidityBaro'] %}
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'sensor' %}selected {% endif %} value="sensor">Sensor</option>
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'thermostat' %}selected {% endif %} value="thermostat">Thermostat</option>
{% elif v['customData']['domain'] == 'Doorbell' %}
{% elif v['customData']['domain'] in ['Doorbell', 'Camera'] %}
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'camera' %}selected {% endif %} value="camera">Camera</option>
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'doorbell' %}selected {% endif %} value="doorbell">Doorbell</option>
{% elif v['customData']['domain'] in ['DoorLock', 'DoorLockInverted'] %}
<option {% if v['type'].replace('action.devices.types.', '').lower() == 'door' %}selected {% endif %} value="door">Door</option>
Expand Down Expand Up @@ -259,7 +258,7 @@ <h5 class="card-title">Description <span>| {{ v['name']['name'] }}</span></h5>
</div>
</div>
{% endif %}
{% if (v['customData']['domain'] in ['Doorbell', 'Camera'] and 'camurl' in v['customData']) %}
{% if (v['customData']['domain'] in ['Doorbell', 'Camera']) %}
<div class="row mb-3">
<label for="inputText" class="col-sm-3 col-form-label">Camera Url</label>
<div class="col-sm-10">
Expand Down
Loading