forked from evcc-io/evcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Tapo meter and config template (evcc-io#3287)
- Loading branch information
Showing
10 changed files
with
150 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package meter | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/evcc-io/evcc/api" | ||
"github.com/evcc-io/evcc/meter/tapo" | ||
"github.com/evcc-io/evcc/util" | ||
) | ||
|
||
// TP-Link Tapo meter implementation | ||
func init() { | ||
registry.Add("tapo", NewTapoFromConfig) | ||
} | ||
|
||
// NewTapoFromConfig creates a tapo meter from generic config | ||
func NewTapoFromConfig(other map[string]interface{}) (api.Meter, error) { | ||
cc := struct { | ||
URI string | ||
User string | ||
Password string | ||
}{} | ||
|
||
if err := util.DecodeOther(other, &cc); err != nil { | ||
return nil, err | ||
} | ||
|
||
if cc.URI == "" { | ||
return nil, errors.New("missing uri") | ||
} | ||
|
||
return tapo.NewConnection(cc.URI, cc.User, cc.Password) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
template: tapo | ||
products: | ||
- brand: TP-Link | ||
description: | ||
generic: Tapo P-Series Smart Plug | ||
group: switchsockets | ||
params: | ||
- name: usage | ||
choice: ["pv"] | ||
- name: host | ||
- name: user | ||
required: true | ||
- name: password | ||
required: true | ||
mask: true | ||
render: | | ||
type: tapo | ||
uri: http://{{ .host }} | ||
user: {{ .user }} | ||
password: {{ .password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
product: | ||
brand: TP-Link | ||
description: Tapo P-Series Smart Plug | ||
group: Schaltbare Steckdosen | ||
render: | ||
- usage: pv | ||
default: | | ||
type: template | ||
template: tapo | ||
usage: pv | ||
host: 192.0.2.2 # IP-Adresse oder Hostname | ||
user: # Benutzerkonto (bspw. E-Mail Adresse, User Id, etc.) | ||
password: # Passwort des Benutzerkontos (bei führenden Nullen bitte in einfache Hochkommata setzen) |
Oops, something went wrong.