Skip to content

Commit

Permalink
CUX2804 und HM-Sen-li-o hinzugefügt
Browse files Browse the repository at this point in the history
CUX2804 und HM-Sen-li-o hinzugefügt
  • Loading branch information
christian1180 committed Sep 17, 2024
1 parent 33fa8f3 commit a5f8567
Show file tree
Hide file tree
Showing 4 changed files with 265 additions and 3 deletions.
200 changes: 200 additions & 0 deletions components/CUX2804.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<?php

/*
mit folgendem können die Schaltflächen beschriftet werden
"label":"Text kurz,Text lang"
ist der Text leer wird die Schaltfläche nicht angezeigt. (hier kurz)
"label":",Text lang"
*/


function CUX2804($component) {
$modalId = mt_rand();
if ($component['parent_device_interface'] == 'CUxD' && $component['visible'] == 'true' && isset($component['PRESS_SHORT'])) {
if (!isset($component['color'])) $component['color'] = '#595959';
// ShowTime - Uhrzeit der letzten Änderung anzeigen
if(isset($component['showtime']))
{
if($component['showtime'] == "true") { $ShowTime = '<span class="info" data-id="' . $component['ise_id'] . 't" data-component="showtime" data-datapoint="showtime"></span>&nbsp;&nbsp;' ; }
else { $ShowTime = ''; }
}
else { $ShowTime = ''; }
if(isset($component['label']))
{
$Label = explode(",",$component['label']);
if($Label[0] <> "") { $LabelKurz = '<span class="set btn-text" data-set-id="' . $component['PRESS_SHORT'] . '" data-set-value="1">'.$Label[0].'</span>'; }
else { $LabelKurz = ''; }
if($Label[1] <> "") { $LabelLang = '<span class="set btn-text" data-set-id="' . $component['PRESS_LONG'] . '" data-set-value="1">'.$Label[1].'</span>'; }
else { $LabelLang = ''; }
}
else
{
$LabelKurz = '<span class="set btn-text" data-set-id="' . $component['PRESS_SHORT'] . '" data-set-value="1">Kurz</span>';
$LabelLang = '<span class="set btn-text" data-set-id="' . $component['PRESS_LONG'] . '" data-set-value="1">Lang</span>';
}

return '<div class="hh" style=\'border-left-color: '.$component['color'].'; border-left-style: solid;\'>'
. '<div class="pull-left"><img src="icon/' . $component["icon"] . '" class="icon">' . $component['name'] . '</div>'
. '<div class="pull-right">'
. $ShowTime
. $LabelKurz
. $LabelLang
. '</div>'
. '<div class="clearfix"></div>'
. '</div>';
}

if ($component['parent_device_interface'] == 'CUxD' && $component['visible'] == 'true' && isset($component['STATE'])) {

global $export;
$obj = $export;
$key = array_search(substr($component['address'], 0, -1)."2", array_column($obj['channels'], 'address'));
foreach($obj['channels'][$key]['datapoints'] as $datapoint)
{ $status_component[$datapoint['type']] = $datapoint['ise_id']; }


if (!isset($component['color'])) $component['color'] = '#595959';
// ShowTime - Uhrzeit der letzten Änderung anzeigen
if(isset($component['showtime']))
{
if($component['showtime'] == "true") { $ShowTime = '<span class="info" data-id="' . $component['ise_id'] . 't" data-component="showtime" data-datapoint="showtime"></span>&nbsp;&nbsp;' ; }
else { $ShowTime = ''; }
}
else { $ShowTime = ''; }
return '<div class="hh" style=\'border-left-color: '.$component['color'].'; border-left-style: solid;\'>'
. '<div data-toggle="collapse" data-target="#' . $modalId . '">'
. '<div class="pull-left"><img src="icon/' . $component["icon"] . '" class="icon">' . $component['name'] . '</div>'
. '</div>'
. '<div class="pull-right">'
. $ShowTime
. '<span class="info set" data-id="' . $component['STATE'] . '" data-component="' . $component['component'] . '" data-datapoint="STATE" data-set-id="' . $component['STATE'] . '" data-set-value=""></span>'
. '</div>'
. '<div class="clearfix"></div>'
. '<div class="hh2 collapse" id="' . $modalId . '">
<div class="row text-center">'
. '<span class="info" data-id="' . $status_component['CURRENT'] . '" data-component="' . $component['component'] . '" data-datapoint="CURRENT"></span>'
. '<span class="info" data-id="' . $status_component['POWER'] . '" data-component="' . $component['component'] . '" data-datapoint="POWER"></span>'
. '<span class="info" data-id="' . $status_component['ENERGY_COUNTER'] . '" data-component="' . $component['component'] . '" data-datapoint="ENERGY_COUNTER"></span>'
. '</div>'
. '</div>'
. '</div>';
}

if ($component['parent_device_interface'] == 'CUxD' && $component['visible'] == 'true' && isset($component['LEVEL']) && isset($component['STOP'])) {
$modalId = mt_rand();

if (!isset($component['color'])) $component['color'] = '#595959';
// ShowTime - Uhrzeit der letzten Änderung anzeigen
if(isset($component['showtime']))
{
if($component['showtime'] == "true") { $ShowTime = '<span class="info" data-id="' . $component['ise_id'] . 't" data-component="showtime" data-datapoint="showtime"></span>&nbsp;&nbsp;' ; }
else { $ShowTime = ''; }
}
else { $ShowTime = ''; }
return '<div class="hh" style=\'border-left-color: '.$component['color'].'; border-left-style: solid;\'>'
. '<div data-toggle="collapse" data-target="#' . $modalId . '">'
. '<div class="pull-left"><img src="icon/' . $component["icon"] . '" class="icon">' . $component['name'] . '</div>'
. '<div class="pull-right">'
. $ShowTime
. '<span class="info" data-id="' . $component['LEVEL'] . '" data-component="' . $component['component'] . '" data-datapoint="BLIND_LEVEL"></span>'
. '</div>'
. '<div class="clearfix"></div>'
. '</div>'
. '<div class="hh2 collapse" id="' . $modalId . '">'
. '<div class="row text-center">'
. '<div class="btn-group">'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="1.0">'
. '<img src="icon/fts_window_2w.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.8">'
. '<img src="icon/fts_shutter_20.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.6">'
. '<img src="icon/fts_shutter_40.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.4">'
. '<img src="icon/fts_shutter_60.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.2">'
. '<img src="icon/fts_shutter_80.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.0">'
. '<img src="icon/fts_shutter_100.png" />'
. '</button>'
. '</div>'
. '</div>'
. '</div>'
. '</div>';
}

if ($component['parent_device_interface'] == 'CUxD' && $component['visible'] == 'true' && isset($component['LEVEL']) && isset($component['OLD_LEVEL'])) {
$modalId = mt_rand();

if (!isset($component['color'])) $component['color'] = '#595959';
// ShowTime - Uhrzeit der letzten Änderung anzeigen
if(isset($component['showtime']))
{
if($component['showtime'] == "true") { $ShowTime = '<span class="info" data-id="' . $component['ise_id'] . 't" data-component="showtime" data-datapoint="showtime"></span>&nbsp;&nbsp;' ; }
else { $ShowTime = ''; }
}
else { $ShowTime = ''; }
return '<div class="hh" style=\'border-left-color: '.$component['color'].'; border-left-style: solid;\'>'
. '<div data-toggle="collapse" data-target="#' . $modalId . '">'
. '<div class="pull-left"><img src="icon/' . $component["icon"] . '" class="icon">' . $component['name'] . '</div>'
. '<div class="pull-right">'
. $ShowTime
. '<span class="info" data-id="' . $component['LEVEL'] . '" data-component="' . $component['component'] . '" data-datapoint="DIMMER_LEVEL"></span>'
. '</div>'
. '<div class="clearfix"></div>'
. '</div>'
. '<div class="hh2 collapse" id="' . $modalId . '">'
. '<div class="row text-center">'
. '<div class="btn-group">'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="1.0">'
. '<img src="icon/light_light_dim_100.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.8">'
. '<img src="icon/light_light_dim_80.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.6">'
. '<img src="icon/light_light_dim_60.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.4">'
. '<img src="icon/light_light_dim_40.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.2">'
. '<img src="icon/light_light_dim_20.png" />'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.0">'
. '<img src="icon/light_light_dim_00.png" />'
. '</button>'
. '</div>'
. '</div>'
. '<div class="row text-center top15">'
. '<div class="row text-center">'
. '<div class="form-inline">'
. '<div class="input-group">'
. '<input type="number" name="' . $component['LEVEL'] . '" min="0" max="100" class="form-control" placeholder="Zahl eingeben">'
. '<span class="input-group-btn">'
. '<button class="btn btn-primary set" data-datapoint="4" data-set-id="' . $component['LEVEL'] . '" data-set-value="">OK</button>'
. '</span>'
. '</div>'
. '<div class="btn-group">'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="1.0">'
. 'An'
. '</button>'
. '<button type="button" class="btn btn-primary set" data-set-id="' . $component['LEVEL'] . '" data-set-value="0.0">'
. 'Aus'
. '</button>'
. '</div>'
. '</div>'
. '</div>'
. '</div>'
. '</div>'
. '</div>';
}
}
22 changes: 22 additions & 0 deletions components/HM-Sen-LI-O.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
function HM_Sen_LI_O($component) {
if ($component['parent_device_interface'] == 'BidCos-RF' && $component['visible'] == 'true' && isset($component['LUX'])) {

global $export;
$obj = $export;
$key = array_search(substr($component['address'], 0, -1)."0", array_column($obj['channels'], 'address'));
foreach($obj['channels'][$key]['datapoints'] as $datapoint)
{ $status_component[$datapoint['type']] = $datapoint['ise_id']; }


if (!isset($component['color'])) $component['color'] = '#595959';
return '<div class="hh" style=\'border-left-color: '.$component['color'].'; border-left-style: solid;\'>'
. '<div class="pull-left"><img src="icon/' . $component["icon"] . '" class="icon">' . $component['name'] . '</div>'
. '<div class="pull-right">'
. '<span class="info" data-id="' . $status_component['LOWBAT'] . '" data-component="' . $component['component'] . '" data-datapoint="LOWBAT"></span>'
. '<span class="info" data-id="' . $component['LUX'] . '" data-component="' . $component['component'] . '" data-datapoint="LUX"></span>'
. '</div>'
. '<div class="clearfix"></div>'
. '</div>';
}
}
12 changes: 10 additions & 2 deletions config/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,15 @@
{
"name": "CUX2801",
"icon": "it_net.png"
},
},
{
"name": "CUX2803",
"icon": "it_internet.png"
},
{
"name": "CUX2804",
"icon": "message_socket_on_off.png"
},
{
"name": "CUX4000",
"icon": "message_socket_on_off.png"
Expand Down Expand Up @@ -828,7 +832,11 @@
"icon": "secur_breakage_glass.png"
}
],
"Wetter": [
"Wetter": [
{
"name": "HM-Sen-LI-O",
"icon": "weather_sun.png"
},
{
"name": "HmIP-SLO",
"icon": "weather_sun.png"
Expand Down
34 changes: 33 additions & 1 deletion js/script.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
}
break;
case 'HmIP-SLO':
switch (datapoint) {
switch (datapoint) {
case 'CURRENT_ILLUMINATION':
$('[data-id="' + ise_id + '"]').html((Math.round(value * 10) / 10) + ' Lux');
break;
Expand All @@ -389,6 +389,20 @@
default:
$('[data-id="' + ise_id + '"]').html(value);
}
break;
case 'HM-Sen-LI-O':
switch (datapoint) {
case 'LUX':
$('[data-id="' + ise_id + '"]').html((Math.round(value * 10) / 10) + ' Lux');
break;
case 'LOWBAT':
if (value === 'true') {
$('[data-id="' + ise_id + '"]').html('<img src="icon/measure_battery_25.png" />');
}
break;
default:
$('[data-id="' + ise_id + '"]').html(value);
}
break;
case 'HmIP-SPI':
case 'HmIPW-SPI':
Expand Down Expand Up @@ -2351,7 +2365,25 @@
$('[data-id="' + ise_id + '"]').html(value);
break;
case 'CUX2801':
case 'CUX2804':
switch (datapoint) {
case 'CURRENT':
$('[data-id="' + ise_id + '"]').html((Math.round(value * 10) / 10) + ' mA');
break;
case 'ENERGY_COUNTER':
if (value < 1000) {
$('[data-id="' + ise_id + '"]').html('Gesamt: ' + (Math.round(value * 10) / 10) + ' Wh');
}
else {
$('[data-id="' + ise_id + '"]').html('Gesamt: ' + (Math.round(value * 10) / 10000).toFixed(2) + ' kWh');
}
break;
case 'FREQUENCY':
$('[data-id="' + ise_id + '"]').html((Math.round(value * 10) / 10) + ' Hz');
break;
case 'POWER':
$('[data-id="' + ise_id + '"]').html((Math.round(value * 10) / 10) + ' W');
break;
case 'BLIND_LEVEL':
value = (Math.round(value * 1000) / 10);

Expand Down

0 comments on commit a5f8567

Please sign in to comment.