Skip to content

Commit

Permalink
add energy/gas counter
Browse files Browse the repository at this point in the history
  • Loading branch information
mdzio committed Nov 1, 2023
1 parent 9a2a995 commit b0cc797
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
const (
logLevel = logging.InfoLevel
appName = "ccu-jack"
appVersion = "2.7.1"
appVersion = "2.8.0"
appPkg = "github.com/mdzio/ccu-jack"
ldFlags = "-s -w -X main.appVersion=" + appVersion
buildDir = ".."
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/gorilla/handlers v1.5.1
github.com/mdzio/go-hmccu v1.0.4
github.com/mdzio/go-hmccu v1.1.0
github.com/mdzio/go-lib v0.2.0
github.com/mdzio/go-logging v1.0.0
github.com/mdzio/go-mqtt v0.2.1
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/mdzio/go-hmccu v1.0.4 h1:vFyGHl1HFX5qhrzIDeCQEabVoGFBWebtE8cZq6y0Zzc=
github.com/mdzio/go-hmccu v1.0.4/go.mod h1:bxm2kKHubJwQyVQoQuXu856ETjBbJFvYLEKtg4hEors=
github.com/mdzio/go-hmccu v1.1.0 h1:P9zoJep8OxO7K0C24weXIxyOvLnQr27JMSaXZZ3qVz0=
github.com/mdzio/go-hmccu v1.1.0/go.mod h1:zIdyLP553xDTkRch7A+KWLPeUOTkP9cM+RZcsycked0=
github.com/mdzio/go-lib v0.2.0 h1:aBlIhm/FVlL7IyCLksP/BEttkSY5ukmMFow5Z2lG21k=
github.com/mdzio/go-lib v0.2.0/go.mod h1:iT5EGniJ9KN32ynSFImmjSTOxscncRL6h6OagK/G1PY=
github.com/mdzio/go-logging v1.0.0 h1:5ykv9QZfEEn3G8Xt2Kcq7FIXDUpXyvp9PUiqWtLDaP0=
Expand All @@ -30,7 +30,6 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
Expand All @@ -40,7 +39,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -53,12 +51,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
Expand Down
18 changes: 11 additions & 7 deletions rtcfg/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ const (
ChannelDimmer
ChannelTemperature
ChannelPowerMeter
ChannelEnergyCounter
ChannelGasCounter

ChannelMQTTKeySender
ChannelMQTTKeyReceiver
Expand All @@ -271,13 +273,15 @@ const (

var (
channelKindStr = []string{
ChannelKey: "STATIC_KEY",
ChannelSwitch: "STATIC_SWITCH",
ChannelAnalog: "STATIC_ANALOG",
ChannelDoorSensor: "STATIC_DOOR_SENSOR",
ChannelDimmer: "STATIC_DIMMER",
ChannelTemperature: "STATIC_TEMPERATURE",
ChannelPowerMeter: "STATIC_POWER_METER",
ChannelKey: "STATIC_KEY",
ChannelSwitch: "STATIC_SWITCH",
ChannelAnalog: "STATIC_ANALOG",
ChannelDoorSensor: "STATIC_DOOR_SENSOR",
ChannelDimmer: "STATIC_DIMMER",
ChannelTemperature: "STATIC_TEMPERATURE",
ChannelPowerMeter: "STATIC_POWER_METER",
ChannelEnergyCounter: "STATIC_ENERGY_COUNTER",
ChannelGasCounter: "STATIC_GAS_COUNTER",

ChannelMQTTKeySender: "MQTT_KEY_SENDER",
ChannelMQTTKeyReceiver: "MQTT_KEY_RECEIVER",
Expand Down
6 changes: 6 additions & 0 deletions virtdev/virtdev.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ func (vd *VirtualDevices) createDevice(devcfg *rtcfg.Device) error {
case rtcfg.ChannelPowerMeter:
ch := vdevices.NewPowerMeterChannel(dev)
log.Debugf("Created static power meter channel: %s", ch.Description().Address)
case rtcfg.ChannelEnergyCounter:
ch := vdevices.NewEnergyCounterChannel(dev)
log.Debugf("Created static energy counter channel: %s", ch.Description().Address)
case rtcfg.ChannelGasCounter:
ch := vdevices.NewGasCounterChannel(dev)
log.Debugf("Created static gas counter channel: %s", ch.Description().Address)

case rtcfg.ChannelMQTTKeySender:
ch := vd.addMQTTKeySender(dev)
Expand Down
4 changes: 3 additions & 1 deletion wd/webui/virtdev.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function ChannelKindSelect() {
m("option[value=STATIC_DIMMER]", { selected: channel.Kind === "STATIC_DIMMER" }, "Statischer Dimmer"),
m("option[value=STATIC_TEMPERATURE]", { selected: channel.Kind === "STATIC_TEMPERATURE" }, "Statischer Temperatursensor"),
m("option[value=STATIC_POWER_METER]", { selected: channel.Kind === "STATIC_POWER_METER" }, "Statische Energiemessung"),
m("option[value=STATIC_ENERGY_COUNTER]", { selected: channel.Kind === "STATIC_ENERGY_COUNTER" }, "Statischer Energiezähler"),
m("option[value=STATIC_GAS_COUNTER]", { selected: channel.Kind === "STATIC_GAS_COUNTER" }, "Statischer Gaszähler"),
m("option[value=MQTT_KEY_SENDER]", { selected: channel.Kind === "MQTT_KEY_SENDER" }, "MQTT Sendetaster"),
m("option[value=MQTT_KEY_RECEIVER]", { selected: channel.Kind === "MQTT_KEY_RECEIVER" }, "MQTT Empfangstaster"),
m("option[value=MQTT_SWITCH]", { selected: channel.Kind === "MQTT_SWITCH" }, "MQTT Schaltaktor"),
Expand Down Expand Up @@ -52,7 +54,7 @@ function HMTypeSelect() {
["HM-SCI-3-FM", "Schließerkontaktschnittstelle 3-fach, UP"],
["HmIP-STHO", "Temp.- und Luftf.-sensor außen"],
["HmIP-STHD", "Temp.- und Luftf.-sensor innen mit Display"],
["HM-ES-TX-WM", "Energiezähler-Sensor"],
["HM-ES-TX-WM", "Zähler-Sensor"],
]

// mithril component
Expand Down

0 comments on commit b0cc797

Please sign in to comment.