Skip to content

Commit

Permalink
http device type
Browse files Browse the repository at this point in the history
  • Loading branch information
benderl committed Dec 16, 2020
1 parent fa08865 commit 913d4aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion runs/mqttsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def on_message(client, userdata, msg):
client.publish("openWB/config/get/SmartHome/Devices/"+str(devicenumb)+"/device_name", msg.payload.decode("utf-8"), qos=0, retain=True)
if (( "openWB/config/set/SmartHome/Device" in msg.topic) and ("device_type" in msg.topic)):
devicenumb=re.sub(r'\D', '', msg.topic)
validDeviceTypes = ['shelly','tasmota','acthor','elwa','idm','stiebel','pyt'] # 'pyt' is deprecated and will be removed!
validDeviceTypes = ['shelly','tasmota','acthor','elwa','idm','stiebel','http','pyt'] # 'pyt' is deprecated and will be removed!
if ( 1 <= int(devicenumb) <= numberOfSupportedDevices and len(str(msg.payload.decode("utf-8"))) > 2):
try:
# just check vor payload in list, deviceTypeIndex is not used
Expand Down
21 changes: 14 additions & 7 deletions web/settings/smarthomeconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,27 @@ function getCookie(cname) {
</div>
</div>
</div>
<hr class="border-secondary">
<div class="form-row mb-1 device<?php echo $devicenum; ?>-option device<?php echo $devicenum; ?>-option-shelly device<?php echo $devicenum; ?>-option-tasmota device<?php echo $devicenum; ?>-option-acthor device<?php echo $devicenum; ?>-option-elwa device<?php echo $devicenum; ?>-option-idm device<?php echo $devicenum; ?>-option-stiebel device<?php echo $devicenum; ?>-option-pyt hide">
<label for="device_ipDevices<?php echo $devicenum; ?>" class="col-md-4 col-form-label">IP Adresse</label>
<div class="col">
<input id="device_ipDevices<?php echo $devicenum; ?>" name="device_ip" class="form-control" type="text" required="required" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" data-default="192.168.1.1" value="192.168.1.1" inputmode="text" data-topicprefix="openWB/config/get/SmartHome/" data-topicsubgroup="Devices/<?php echo $devicenum; ?>/">
<div class="device<?php echo $devicenum; ?>-option device<?php echo $devicenum; ?>-option-shelly device<?php echo $devicenum; ?>-option-tasmota device<?php echo $devicenum; ?>-option-acthor device<?php echo $devicenum; ?>-option-elwa device<?php echo $devicenum; ?>-option-idm device<?php echo $devicenum; ?>-option-stiebel device<?php echo $devicenum; ?>-option-pyt hide">
<hr class="border-secondary">
<div class="form-row mb-1">
<label for="device_ipDevices<?php echo $devicenum; ?>" class="col-md-4 col-form-label">IP Adresse</label>
<div class="col">
<input id="device_ipDevices<?php echo $devicenum; ?>" name="device_ip" class="form-control" type="text" required="required" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" data-default="192.168.1.1" value="192.168.1.1" inputmode="text" data-topicprefix="openWB/config/get/SmartHome/" data-topicsubgroup="Devices/<?php echo $devicenum; ?>/">
</div>
</div>
</div>
<div class="device<?php echo $devicenum; ?>-option device<?php echo $devicenum; ?>-option-http hide">
<hr class="border-secondary">
<div class="form-group">
<div class="form-row mb-1">
<label for="device_leistungurlDevices<?php echo $devicenum; ?>" class="col-md-4 col-form-label">Leistungs-URL</label>
<div class="col">
<input id="device_leistungurlDevices<?php echo $devicenum; ?>" name="device_leistungurl" class="form-control" type="text" required="required" data-default="" value="" data-topicprefix="openWB/config/get/SmartHome/" data-topicsubgroup="Devices/<?php echo $devicenum; ?>/">
<span class="form-text small">Die hier angegebene URL wird aufgerufen, um die aktuelle Leistung des Geräts zu erhalten.</span>
<span class="form-text small">
Die hier angegebene URL wird aufgerufen, um die aktuelle Leistung des Geräts zu erhalten.<br>
In der URL kann ein Parameter angegeben werden, der den aktuellen Überschuss an das Gerät übermittelt. Hierzu ist folgender Platzhalter in der URL zu verwenden (inklusive der spitzen Klammern):<br>
<span class="text-info">&lt;openwb-ueberschuss&gt;</span>
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -625,7 +632,7 @@ function visibility_device_canSwitchDevices<?php echo $devicenum; ?>( data ){
function visibility_device_nameDevices<?php echo $devicenum; ?>( data ){
// console.log("device_nameDevices: data: "+data);
if( typeof data =='undefined' ){
data = $('input[name=device_nameDevices<?php echo $devicenum; ?>]').val();
data = $('#device_nameDevices<?php echo $devicenum; ?>').val();
}
// console.log("device_nameDevices: data: "+data);
if ( data != "Name" ) {
Expand Down

0 comments on commit 913d4aa

Please sign in to comment.