Skip to content

Commit

Permalink
fix-rpc-client
Browse files Browse the repository at this point in the history
  • Loading branch information
torchiaf committed Feb 2, 2025
1 parent 7ba24d3 commit 437cd59
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion controller/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ toolchain go1.23.4
require (
github.com/fatih/structs v1.1.0
github.com/itchyny/gojq v0.12.17
github.com/torchiaf/Sensors/rpc_client v0.0.0-20250202022913-2a42e8d8bd20
gopkg.in/yaml.v2 v2.4.0
k8s.io/client-go v0.32.0
)
Expand All @@ -23,7 +24,6 @@ require (
github.com/kr/text v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/torchiaf/Sensors/rpc_client v0.0.0-20250202005215-c296b8b6cb2b
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/text v0.19.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions controller/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/torchiaf/Sensors/rpc_client v0.0.0-20250202005215-c296b8b6cb2b h1:Gov23VN7l20GFoGg6CCmHbI/90mcUjiZKMizWjRbxTI=
github.com/torchiaf/Sensors/rpc_client v0.0.0-20250202005215-c296b8b6cb2b/go.mod h1:/wPjrnUN+OPaRpEyoe4YHUTSfXNBVsXGBTLowDX96AM=
github.com/torchiaf/Sensors/rpc_client v0.0.0-20250202022913-2a42e8d8bd20 h1:Ym/PM/TlNRyxyCyJp4u0AIB6zk+oPhrRtgm026niDIc=
github.com/torchiaf/Sensors/rpc_client v0.0.0-20250202022913-2a42e8d8bd20/go.mod h1:/wPjrnUN+OPaRpEyoe4YHUTSfXNBVsXGBTLowDX96AM=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
2 changes: 1 addition & 1 deletion controller/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
log.Printf(" [%s] [%s] Got %+v", module.Name, "dht11", res)

if module.Name == "raspberrypi-1" {
res1, err := client.Read(
res1, err := client.Write(
module.RoutingKey,
"tm1637",
[]string{
Expand Down
10 changes: 6 additions & 4 deletions modules/raspberrypi5/devices/tm1637/app/main.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import sys
import tm1637
from time import sleep
from config import print, clk, dio

tm = tm1637.TM1637(clk=clk, dio=dio)

try:
arg = sys.argv[1]
print('Received: {}'.format(arg))
print('Received: {}'.format(sys.argv))

action = sys.argv[1]
fn = getattr(tm, sys.argv[2])
arg = sys.argv[3]

t = int(arg)
tm.temperature(t) # show temperature 't*C'
fn(t) # show temperature 't*C'
except Exception as error:
print(error)
pass
Expand Down
1 change: 0 additions & 1 deletion rpc_client/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ func isDevEnv() bool {
}

func initConfig() models.Config {

modules := utils.ParseYamlFile[[]models.Module]("/sensors/modules.yaml")
modulesMap := utils.Map(modules, func(m models.Module) string { return m.Name })

Expand Down

0 comments on commit 437cd59

Please sign in to comment.