Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inventory file #2

Open
langasg opened this issue Apr 20, 2024 · 7 comments
Open

Inventory file #2

langasg opened this issue Apr 20, 2024 · 7 comments

Comments

@langasg
Copy link

langasg commented Apr 20, 2024

Hello
I am trying to install from Ansible but I don't know what the inventory structure should be like, could you give an example.
Thank you so much.

@johnelliott
Copy link
Owner

Hi there, it's been a few years since I interacted with this code, but I just dipped in to the repo.

I used the word "fridges" in ansible/deploy.yml, so I think this will work for your Ansible inventory local to the project directory:

inventory.yml

---
fridges:
  hosts:
    myfridge:

For that file to work, you will need an SSH config set up such that ssh myfridge lets you access the target device you want to deploy the code to.

@langasg
Copy link
Author

langasg commented Apr 23, 2024

Thanks johnelliott

I have managed to run ansible, making some modification to the vars file, so that it finds the armversion params, but I have not been able to compile it. I am trying to compile without using ansible with the command
"root@raspberrypi:~/alpicoold/cmd/alpicoold# /usr/bin/gmake build GOARM=7"

but I get errors:

github.com/johnelliott/alpicoold/cmd/alpicoold

type.noalg.struct { F uintptr; golang.org/x/text/internal/language/compact.cci golang.org/x/text/internal/language.CompactCoreInfo }: dwarf: definition of unknown kind 0
type.[]golang.org/x/text/internal/language/compact.ID: dwarf: definition of unknown kind 0
type.[]golang.org/x/text/internal/language.CompactCoreInfo: dwarf: definition of unknown kind 0
gmake: *** [makefile:35: build-raspi] Error 2

@johnelliott
Copy link
Owner

johnelliott commented Apr 23, 2024

...

I have managed to run ansible, making some modification to the vars file, so that it finds the armversion params, but I have not been able to compile it. I am trying to compile without using ansible with the command "root@raspberrypi:~/alpicoold/cmd/alpicoold# /usr/bin/gmake build GOARM=7"
...

My workflow was to build this on my laptop and load the built binary onto my raspberry pi. Are you trying to do that or build the program on the same device you are running it on?

@langasg
Copy link
Author

langasg commented Apr 23, 2024

I`m trying build program on the same device (Raspberry pi). But tomorrow, i will try to compile on my debian laptop.

@langasg
Copy link
Author

langasg commented Apr 24, 2024

I think I have managed to compile the application. but I see some warnings.

github.com/johnelliott/alpicoold/cmd/alpicoold

github.com/johnelliott/alpicoold/cmd/alpicoold

/usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: /tmp/go-link-567458253/000008.o: en la función mygetgrouplist': /_/os/user/getgrouplist_unix.go:15: aviso: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: /tmp/go-link-567458253/000007.o: en la función mygetgrgid_r':
//os/user/cgo_lookup_unix.go:37: aviso: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: /tmp/go-link-567458253/000007.o: en la función mygetgrnam_r': /_/os/user/cgo_lookup_unix.go:42: aviso: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: /tmp/go-link-567458253/000007.o: en la función mygetpwnam_r':
/
/os/user/cgo_lookup_unix.go:32: aviso: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: /tmp/go-link-567458253/000007.o: en la función mygetpwuid_r': /_/os/user/cgo_lookup_unix.go:27: aviso: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc-cross/arm-linux-gnueabihf/11/../../../../arm-linux-gnueabihf/bin/ld: /tmp/go-link-567458253/000004.o: en la función _cgo_6cc2654a8ed3_C2func_getaddrinfo':
/tmp/go-build/cgo-gcc-prolog:57: aviso: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

root@430-G1:~/alpicoold/cmd/alpicoold# ls -ltr
total 12412
-rw-r--r-- 1 root root 904 abr 24 10:25 status.tmpl
-rw-r--r-- 1 root root 1243 abr 24 10:25 makefile
-rw-r--r-- 1 root root 12873 abr 24 10:25 main.go
-rw-r--r-- 1 root root 1793 abr 24 10:25 http.go
-rw-r--r-- 1 root root 6593 abr 24 10:25 homekit.go
-rw-r--r-- 1 root root 8963 abr 24 10:25 bluetooth.go
-rwxr-xr-x 1 root root 12657380 abr 24 16:03 alpicoold_raspi_arm7

Another question has arisen, in the code I see several fields that I understand should be changed.

alpicoold/bluetooth.go: serviceUUID = "00001234-0000-1000-8000-00805f9b34fb"
alpicoold/bluetooth.go: writeableFridgeUUID = "00001235-0000-1000-8000-00805f9b34fb" // Writable
alpicoold/bluetooth.go: readeableFridgeUUID = "00001236-0000-1000-8000-00805f9b34fb" // Read Notify
alpicoold/bluetooth.go: descriptorUUID = "00002902-0000-1000-8000-00805f9b34fb"
alpicoold/bluetooth.go: dFilter.AddUUIDs(serviceUUID)
alpicoold/bluetooth.go: char, err := dev.GetCharByUUID(writeableFridgeUUID)
alpicoold/bluetooth.go: log.Debugf("Found writable UUID: %v", char.Properties.UUID)
alpicoold/bluetooth.go: notifChar, err := dev.GetCharByUUID(readeableFridgeUUID)
alpicoold/main.go: addrF = flag.String("fridgeaddr", "", "address of remote peripheral (MAC on Linux, UUID on OS X)")^C

Anything else I need to change? before compiling again.

Thank you so much.

@johnelliott
Copy link
Owner

I`m trying build program on the same device (Raspberry pi). But tomorrow, i will try to compile on my debian laptop.

The easiest thing may be to log into the pi, then go to the alpicoold directory and do a go build from there, that would skip the makefile and cross-compilation.

As for changing settings, you can use an env file and don't need to set any app config before building.

@langasg
Copy link
Author

langasg commented May 17, 2024

Thank you so much.
I have managed to compile the alpicoold folder, but now when I run it it seems that it detects my device but does not connect with it.

I also don't know how I can get the uuids and if I have to configure them somewhere.

root@raspberrypi:/alpicoold/cmd# ls
alpicoold fridgestate
root@raspberrypi:/alpicoold/cmd# ls -ltr
total 8
drwxr-xr-x 2 root root 4096 abr 24 00:30 fridgestate
drwxr-xr-x 2 root root 4096 abr 24 00:31 alpicoold
root@raspberrypi:/alpicoold/cmd# cd alpicoold/
root@raspberrypi:/alpicoold/cmd/alpicoold# ls -ltr
total 48
-rw-r--r-- 1 root root 904 abr 21 01:06 status.tmpl
-rw-r--r-- 1 root root 12873 abr 21 01:06 main.go
-rw-r--r-- 1 root root 1793 abr 21 01:06 http.go
-rw-r--r-- 1 root root 6593 abr 21 01:06 homekit.go
-rw-r--r-- 1 root root 8963 abr 21 01:06 bluetooth.go
-rw-r--r-- 1 root root 1327 abr 23 20:02 makefile
root@raspberrypi:/alpicoold/cmd/alpicoold# go build
root@raspberrypi:/alpicoold/cmd/alpicoold# ls -ltr
total 12664
-rw-r--r-- 1 root root 904 abr 21 01:06 status.tmpl
-rw-r--r-- 1 root root 12873 abr 21 01:06 main.go
-rw-r--r-- 1 root root 1793 abr 21 01:06 http.go
-rw-r--r-- 1 root root 6593 abr 21 01:06 homekit.go
-rw-r--r-- 1 root root 8963 abr 21 01:06 bluetooth.go
-rw-r--r-- 1 root root 1327 abr 23 20:02 makefile
-rwxr-xr-x 1 root root 12912279 may 17 11:29 alpicoold
root@raspberrypi:/alpicoold/cmd/alpicoold# ./alpicoold
INFO[0000] Init params compcyclerate=0s daemon timeout=20m0s pollrate=1s
INFO[0000] comp cycle rate 0, cycling is off
TRAC[0000] Main waiting...
TRAC[0000] HKClient start
DEBU[0000] server starting on port 80 client=JSONClient
DEBU[0000] Launching client
INFO[0000] Discovering on hci0 client=BluetoothClient
TRAC[0000] Listening for signals
TRAC[0000] DEBUG 2024/05/17 11:30:37 camera_control.go:194: {"assets":[]}
TRAC[0000] HK client looping now
DEBU[0000] INFO 2024/05/17 11:30:37 ip_transport.go:184: Listening on port 41721
TRAC[0000] Exposing Agent1 at /agent/simple1
TRAC[0000] Added device /org/bluez/hci0/dev_FF_FF_11_1D_14_3A
TRAC[0000] OnDeviceDiscovered: cancel() called
TRAC[0000] Api exit done client=BluetoothClient
TRAC[0000] Calling done on main wait group client=BluetoothClient
ERRO[0000] Client error client=bluetooth err="findDevice: MapToStruct: Field not found: Bonded"
TRAC[0000] HKClient ctx canceled
TRAC[0000] DEBUG 2024/05/17 11:30:37 ip_transport.go:191: server stopped
TRAC[0000] client shutting down client=JSONClient
DEBU[0000] Main context canceled
TRAC[0000] Waiting for wait group...
DEBU[0000] done client=JSONClient
TRAC[0000] Calling done on main wait group client=JSONClient
DEBU[0000] Waiting 28s then exiting
DEBU[0000] shutting down client=JSONClient err="context canceled"
TRAC[0000] DEBUG 2024/05/17 11:30:37 ip_transport.go:169: mdns responder stopped
TRAC[0000] Calling done on main wait group client=HKClient
TRAC[0000] HKClient stopped
TRAC[0000] Wait group done waiting
root@raspberrypi:/alpicoold/cmd/alpicoold#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants