HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

User stellen ihre Haussteuerung vor

Moderator: Co-Administratoren

ElmarStein
Beiträge: 3
Registriert: 14.08.2021, 13:54
System: CCU

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von ElmarStein » 14.08.2021, 13:58

Hi,

ich verwende bereits die TP-Link HS110, würden mit dem Script auch die KP115 funktionieren?

Mit freundlichen Grüßen

Elmar

omicronCZ
Beiträge: 221
Registriert: 31.07.2011, 17:37
System: CCU
Wohnort: Czech Rep.
Hat sich bedankt: 85 Mal
Danksagung erhalten: 14 Mal

HM-Anbindung für TP-Link-WLAN-Steckdosen Tapo P100

Beitrag von omicronCZ » 15.08.2021, 18:43

I want to ask, is there any plan to modify this great script for TPlink sockets Tapo P100?

The HS1.. sockets are unfortunately no longer available as standard.

Thank you very much.

samuellazea
Beiträge: 72
Registriert: 09.10.2018, 08:49
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von samuellazea » 21.08.2021, 12:12

@HM42

Hi, first I want to say thank you for your work and it's much appreciated. I wanted to ask if there is any possibility that you could add some functionality for the KP115 also. I have the KP115 and it does not work to switch them. I can test and give you more info but I am not a developer myself and don't know to implement this. Would appreciate it much. Here it's the output what I have

Code: Alles auswählen

Script:    'tplsh.tcl', Version: 5.3, 2020-05-04
Copyright: Thomas Marquard / Lubomir Stroetmann, softScheck GmbH (...2020)


MESSAGE SENT:
{"system":{"get_sysinfo":{}}}

MESSAGE RECEIVED:
{"system":{"get_sysinfo":{"sw_ver":"1.0.16 Build 210205 Rel.163735","hw_ver":"1.0","model":"KP115(EU)","deviceId":"xxxx","oemId":"xxxx","hwId":"xxxx","rssi":-46,"latitude_i":0,"longitude_i":0,"alias":"Prusa","status":"new","obd_src":"tplink","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"00:31:92:xx:xx:xx","updating":0,"led_off":0,"relay_state":0,"on_time":0,"icon_hash":"","dev_name":"Smart Wi-Fi Plug Mini","active_mode":"none","next_action":{"type":-1},"ntc_state":0,"err_code":0}}}

EXTRACTED DEVICE VALUES:
sw_ver= 1.0.16 Build 210205 Rel.163735
hw_ver= 1.0
model= KP115(EU)
alias= Prusa
on_off= 
hue= 
saturation= 
brightness= 
color_temp= 
relay_state= 0

ERROR: Missing or wrong command `on` !


USAGE: tclsh /usr/local/etc/config/addons/tplsh/tplsh.tcl <hostname or ip-address> <command> <bulb_para>

COMMAND (plug sockets): [info|on|off|toggle|readdata]
COMMAND (bulbs):        [info|dim|hue|on|off|sat|toggle|setdata <bulb_para>]
BULB_PARA:              [o:<0|1>,h:<0...360>,s:<0...100>,d:<0...100>,c:<0|2500...9000>]

# tclsh /usr/local/etc/config/addons/tplsh/tplsh.tcl 192.168.200.32 on
Thank you again for all you do.

Kind regards,
Sami

samuellazea
Beiträge: 72
Registriert: 09.10.2018, 08:49
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von samuellazea » 21.08.2021, 12:37

Digging a bit deeper it seems all the functionality you have in place just need to add the device in the list. Here you can see all the values from the KP115
Screenshot 2021-08-21 133345.png
This are the values that are read from the device.

Here are the only 2 things I changed in your script.

Code: Alles auswählen

..................
if {$modelShort == "HS100" || $modelShort == "HS110"|| $modelShort == "KP115"} { 

 

  if {($relay_state != 0) && ($relay_state != 1)} {

		set msg "ERROR: Bad value `$relay_state` for `relay_state` read from device !"

		handleErrorMessage $msg

		puts ""

		puts $msg

		puts ""

		exit

  }	



	set relay_state_new -1
..................
if {$command == "readdata"} {

	if {[catch {set sourceChnName $::env(CUXD_CHANNEL)}]} { 

		set msg "ERROR: No channel specified in environment variable `CUXD_CHANNEL` (script not called from CUxD) !"

		handleErrorMessage $msg

		puts ""

		puts $msg

		puts ""

		exit

	}



	if {$modelShort == "KP115"} { 

		# readdata for HS110, HW version 1 ...

		eval [extractFromJsonString $answer current "%.2f"]

		eval [extractFromJsonString $answer voltage "%.2f"]

		eval [extractFromJsonString $answer power "%.2f"]

		eval [extractFromJsonString $answer total "%.3f"]

		# readdata for HS110, HW version 2 ...

		eval [extractFromJsonString $answer current_ma "%f"]

		eval [extractFromJsonString $answer voltage_mv "%f"]

		eval [extractFromJsonString $answer power_mw "%f"]

		eval [extractFromJsonString $answer total_wh "%f"]
This proves that your code works with this model also. In case you want me to do some further testing just let me know and I will do it for you.
Thanks again and really nice work

samuellazea
Beiträge: 72
Registriert: 09.10.2018, 08:49
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von samuellazea » 21.08.2021, 13:30

mskrause hat geschrieben:
09.05.2020, 14:56
BJ67 hat geschrieben:
09.05.2020, 14:19
Aber perfekt wäre beides :-)
sollte eigentlich sein:
hier ein schneller, eben gemachter Test mit HS110 und KASA-geschaltet:

Kasa.JPG

kasa2.JPG

alles da, Status UND Verbrauchswerte, Zeitstempel ist zu sehen, Werte leicht geändert, Energie dauert zwangsläufig etwas ;)

Gruß Marco
@mskrause

How did you do to display the consumption in here instead of the system variables? Thanks lots in advance

mskrause
Beiträge: 167
Registriert: 13.10.2018, 20:02
System: Alternative CCU (auf Basis OCCU)
Hat sich bedankt: 13 Mal
Danksagung erhalten: 19 Mal

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von mskrause » 26.08.2021, 16:46

samuellazea hat geschrieben:
21.08.2021, 13:30

@mskrause

How did you do to display the consumption in here instead of the system variables? Thanks lots in advance
durch die Kanalzuordnung SYSTEMVARIABLE+GERÄT
kanal.PNG
kanal.PNG (22.94 KiB) 2137 mal betrachtet
Gruß Marco

samuellazea
Beiträge: 72
Registriert: 09.10.2018, 08:49
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von samuellazea » 26.08.2021, 18:09

mskrause hat geschrieben:
26.08.2021, 16:46
samuellazea hat geschrieben:
21.08.2021, 13:30

@mskrause

How did you do to display the consumption in here instead of the system variables? Thanks lots in advance
durch die Kanalzuordnung SYSTEMVARIABLE+GERÄT

kanal.PNG

Gruß Marco
This is so cool. Thanks lots for it. Much appreciated

hmg1980
Beiträge: 6
Registriert: 07.11.2020, 21:21
System: CCU

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von hmg1980 » 29.08.2021, 13:13

Hallo Zusammen,

ich habe eine CCU3 und einige HS110 in Betrieb - funktioniert alles Tadellos ...
habe nun mein System etwas erweitert ... es gab keine HS110 zu kaufen und es waren zuhause alle aufgebraucht somit mehrere KP115 bestellt ...

habe diese auch eingebunden - funktioniert (schalttechnisch) alles einwandfrei ... dann habe ich wie in den vorherigen Postings das "tplsh.tcl" file angepasst ... das KP115 in der Geräteliste erweitert ... (vorher schon mal das KP105) ...

Zeile323:
"if {$modelShort == "HS100" || $modelShort == "HS110" || $modelShort == "KP105" || $modelShort == "KP115"} { "

Schalten einwandfrei ...
----------------------------------

dann habe ich in Zeile 592: "if {$modelShort == "KP115"} { "
das "HS110" in das "KP115" geändert ...

einwanfreie funktion ...

---

Leider läuft seitdem das Leistungsmessen bei den HS110 nicht mehr ... (jetzt hinterher logischerweise nicht mehr) ...

Welche Zeilen muss ich kopieren bzw. wie das skript umschreiben , das die HS110 "readdata" und die KP115 "Readdata" - also beide funktionieren?

Habe zwar versucht mehrere Teile des scripts zu kopieren ... dann einmal KP115 und einmals HS110 ... leider ohne Erfolg ...
Vl. liegt es irgendwo an den Klammern? oder zuwenig/zuviel kopiert?!? oder braucht es irgendwo ein "else"

Kann mir bitte jemand helfen, welche bzw. wieviele Zeilen ich kopien muss und wo/wie einfügen?
oder mir ein funktionierendes script hier hochladen oder per mail schicken?

bin am verzweifeln ...

Danke für Eure Hilfe und Bemühungen im Voraus !!! , LG Marco

mskrause
Beiträge: 167
Registriert: 13.10.2018, 20:02
System: Alternative CCU (auf Basis OCCU)
Hat sich bedankt: 13 Mal
Danksagung erhalten: 19 Mal

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von mskrause » 31.08.2021, 13:29

hmg1980 hat geschrieben:
29.08.2021, 13:13
Kann mir bitte jemand helfen, welche bzw. wieviele Zeilen ich kopien muss und wo/wie einfügen?
oder mir ein funktionierendes script hier hochladen oder per mail schicken?
ungetestet, hab keine KP115...

schon versucht, die Zeile 592 so zu erweitern wie Zeile 323?
tpl.PNG
Gruß Marco

hmg1980
Beiträge: 6
Registriert: 07.11.2020, 21:21
System: CCU

Re: HM-Anbindung für TP-Link-WLAN-Steckdosen HS1xx und -Leuchtmittel LB1xx (V5.3)

Beitrag von hmg1980 » 10.09.2021, 11:32

Hi,

ja habe ich versucht - leider ohne erfolg :-(

Danke trotzdem ...

Hat noch jemand eine Idee? ... eine 2te Schleife - 1x mit HS110 und 1x mit KP115 ... aber komme mit den geschwungenen Klammern nicht zurecht ... vl. braucht es ein IF?

DANKE für Wure Hilfe

LG Marco

Antworten

Zurück zu „Projektvorstellungen“