{"id":16874981,"url":"https://github.com/dlsniper/phas-workshop","last_synced_at":"2025-03-18T23:52:36.983Z","repository":{"id":141532196,"uuid":"216427729","full_name":"dlsniper/phas-workshop","owner":"dlsniper","description":"Personal Home Automation System - Workshop","archived":false,"fork":false,"pushed_at":"2019-10-21T09:57:33.000Z","size":5760,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T00:51:03.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dlsniper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-20T21:09:06.000Z","updated_at":"2019-10-21T09:57:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"0aa40b08-f40e-49ea-9437-82f06e5e8499","html_url":"https://github.com/dlsniper/phas-workshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlsniper%2Fphas-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlsniper%2Fphas-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlsniper%2Fphas-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlsniper%2Fphas-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dlsniper","download_url":"https://codeload.github.com/dlsniper/phas-workshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244326209,"owners_count":20435122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T15:34:48.698Z","updated_at":"2025-03-18T23:52:36.961Z","avatar_url":"https://github.com/dlsniper.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Personal Home Automation Service\n\n## Installation\n\nYou can use PHAS on Raspberry Pi, but also on your personal computer.\n\nBelow you'll find installation instructions for all supported platforms:\n\n- [Linux - Raspberry Pi and Desktop](#Linux)\n- [Windows](#Windows)\n- [macOS](#macOS)\n\n### Linux\n\nThese instructions apply both to Raspberry Pi and Desktop distributions of Linux (tested under Debian and Ubuntu).\n\nFirst, make sure the system is up to date by using the following commands:\n```shell script\nsudo apt-get update\nsudo apt-get upgrade\n```\n\nThen, install Go 1.13.3 or newer installed from the binary distribution.\nWhile Go 1.11 is still supported, it's better to use a newer version of\nGo and benefit from all the improvements in Go Modules, compilation\nspeed and debugging experience.\n\nFor Raspberry Pi, use the below Go distribution. If you are on a Linux Desktop,\nthen skip to the Linux Desktop instructions below this section.\n\n```shell script\ncd /tmp\nwget https://dl.google.com/go/go1.13.3.linux-armv6l.tar.gz\ntar -zxvf go1.13.3.linux-armv6l.tar.gz\nsudo mv go /usr/local/\nrm go1.13.3.linux-armv6l.tar.gz\n```\n\nFor Linux Desktop, you can skip this if you are on a Raspberry Pi.\n```shell script\ncd /tmp\nwget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz\ntar -zxvf go1.13.3.linux-amd64.tar.gz\nsudo mv go /usr/local/\nrm go1.13.3.linux-amd64.tar.gz\n```\n\nManually add Go's binary files, and your `$GOPATH/bin` binaries to your `$PATH`.\nE.g., place `export PATH=\"${PATH}:/usr/local/go/bin:/home/pi/go/bin\"` at the end of `~/.bash_profile` such as:\n```shell script\n# Include the Go SDK and GOPATH/bin in PATH\nexport PATH=\"${PATH}:/usr/local/go/bin:/home/pi/go/bin\"\n```\n\nIf the file does not exist, then create it.\n\nNow, let's install PHAS:\n\n```shell script\n# clone this repository\ngit clone https://github.com/dlsniper/phas-workshop.git /home/pi/phas\ncd /home/pi/phas\n\n# Copy the required system libraries in the correct paths.\n# You can skip these if you will always use the build commands with the correct CGO environment variables configured, see below.\nsudo cp ./lib/picovoice.h /usr/local/include/\nsudo cp ./lib/pv_porcupine.h /usr/local/include/\n\n# If you are on Linux Desktop, then replace raspberrypi_arm11 with linux\nsudo cp ./lib/raspberrypi_arm11/libpv_porcupine.* /usr/local/lib/\n\n# Enable the vendoring mode for Go Modules so that no additional downloads\n# are needed to compile the application\nexport GOFLAGS=-mod=vendor\n\n# This is the target on which PHAS runs. The following values are useful:\n# windows     - for Windows OS\n# macos       - for macOS\n# raspberrypi - for Raspberry PI 3 Linux OS\n# linux       - for Linux OS\nexport PHAS_OS=raspberrypi\n\n# Build the binary\ngo build -o phas\n```\n\n#### Linux Destkop\n\nYou need to install the following dependencies:\n\n```shell script\napt-get install pkg-config portaudio19-dev\n```\n\n### Windows\n\nFor a Windows user, the compilation will be a bit more tricky.\n\nFirst, you need to have [msys2](https://www.msys2.org/) installed.\n\nAdd `C:\\msys64\\mingw64\\bin` to your Windows `PATH` environment variable\n\nThen, open the `MSYS2 MinGW 64-bit` command prompt and run the following commands:\n\n```shell script\n# Ensure msys2 is updated. You might need to run this command a couple of times\npacman -Syu\n\n# Install build tools dependencies\npacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-pkg-config\n\n# Install the dependency for recording audio from the microphone\npacman -S mingw-w64-x86_64-portaudio\n```\n\n#### Building on Windows\n\nBuilding PHAS on Windows needs to be performed like this:\n\n- set the following environment variables:\n```shell script\nexport CGO_CFLAGS=-I\u003cpath to PHAS root directory\u003e\\lib\nexport CGO_LDFLAGS=-L\u003cpath to PHAS root directory\u003e\\lib\\windows\n```\nAlso, include `C:\\msys64\\mingw64\\bin` in your PATH on Windows.\n\nFor PHAS to work, you need to configure the following environment variable `PHAS_OS=raspberrypi`.\n\n- then run `go build -o phas`\n\n### macOS\n\nFor macOS, you need to run the following commands:\n\n```shell script\nbrew install portaudio pkg-config\n```\n\nDuring the compilation step, you also need to set the following environment variable:\n\n```shell script\nexport DYLD_LIBRARY_PATH=\"${DYLD_LIBRARY_PATH}:\u003cpath to PHAS root directory\u003e/lib/macos\"\n```\n\n## Getting GCP credentials for the voice APIs\n\nBefore we can run the application, we need to get valid GCP credentials\nto make use of the voice APIs.\n\nIf you don't yet have a Google Cloud Platform account yet, then first head over\n[to this link and create one](https://console.cloud.google.com/projectcreate).\n\nThen, read the link here about [obtaining and providing service account credentials manually](https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually).\nSelect ` Service User | API Keys Viewer ` from the ` Role ` and the ` json ` format.\n\nAfter this, go to [APIs \u0026 Services](https://console.cloud.google.com/apis/dashboard)\nand select ` +Enable APIs and Services` button. Here, you'll need to enable\nthe following services:\n- ` Cloud Speech-to-Text API `, ` Cloud Speech-to-Text API Length Standard `\noption should be enough\n- ` Cloud Text-to-Speech API `, ` WaveNet ` option should be enough\n\nFinally, place the downloaded file in a location such as ` /home/pi/phas-gcp-key.json `.\nThen, add the following environment variables to your ` .bash_profile `:\n\n```shell script\n# These are needed to tell PHAS what GCP project to use and what credentials\nexport GCP_PROJECT_ID=\u003cyour GCP project ID\u003e\nexport GOOGLE_APPLICATION_CREDENTIALS=\"/home/pi/phas-gcp-key.json\"\n```\n\nIf you are on Windows, then place the file under `C:\\Users\\\u003cusername\u003e\\phas-gcp-key.json`\nand then set the environment variables accordingly:\n```\nGCP_PROJECT_ID=\u003cyour GCP project ID\u003e\nGOOGLE_APPLICATION_CREDENTIALS=\"/home/pi/phas-gcp-key.json\"\n```\n\n## Running the application\n\nSince we installed all dependencies and everything is up to date,\nlet's run the application. Execute `.\\phas.exe` if you are Windows,\nand `./phas` if you are on all other supported platforms.\n\n## License \n\nThis repository and all code from it is licensed under the [Apache 2 license](License).\n\nThe code under `lib` directory belongs to the [Picovoice](https://picovoice.ai/)\n[Porcupine library](https://github.com/Picovoice/Porcupine), also available\nunder Apache 2 license.\n\nThe code under the `vendor` directory belongs to their original creators and\nis available under their respective license. It is included here to enable the\nsmooth operation of the workshop.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlsniper%2Fphas-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdlsniper%2Fphas-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlsniper%2Fphas-workshop/lists"}