commit 74e8ebdadb9979fd0e795767a2f40863e81da39e Author: Zane V Date: Sun May 17 17:44:24 2026 -0400 feat: Initallize diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..bd75788 --- /dev/null +++ b/__init__.py @@ -0,0 +1,52 @@ +import asyncio +import aiohttp +import voluptuous as vol +from homeassistant.core import HomeAssistant +import logging +_LOGGER = logging.getLogger(__name__) + +from .const import DOMAIN + +async def async_setup(hass: HomeAssistant, config: dict): + """Set up the Jibo integration.""" + + async def handle_say_service(call): + message = call.data.get("message") + ip = hass.data[DOMAIN]["jibo_ip"] + url = f"http://{ip}:8089/tts_speak" + payload = { + "prompt": message, + "locale": "en-us", + "voice": "griffin", + "duration_stretch": 1, + "pitch": 3, + "pitchBandwidth": 0.4, + "mode": "text", + "outputMode": "stream", + "timeout": None, + "volume": 0, + "whisper": "FALSE", + "samplerate": 48000, + "postfilter": 0.4, + "framerate": 240, + "unvoicedvoiced": 0.35, + "allPass": 0.76, + "gvMCEP": 0.9, + "cached": "TRUE" + } + + async with aiohttp.ClientSession() as session: + try: + async with session.post(url, json=payload) as response: + if response.status != 200: + _LOGGER.error("Failed to speak: %s", await response.text()) + except aiohttp.ClientError as e: + _LOGGER.error("Error communicating with Jibo: %s", e) + + hass.services.async_register(DOMAIN, "say", handle_say_service) + return True + +async def async_setup_entry(hass, entry): + """Store IP from config flow.""" + hass.data[DOMAIN] = {"jibo_ip": entry.data["jibo_ip"]} + return True \ No newline at end of file diff --git a/brand/icon.png b/brand/icon.png new file mode 100644 index 0000000..30f01d7 Binary files /dev/null and b/brand/icon.png differ diff --git a/brand/logo.png b/brand/logo.png new file mode 100644 index 0000000..30f01d7 Binary files /dev/null and b/brand/logo.png differ diff --git a/config_flow.py b/config_flow.py new file mode 100644 index 0000000..5c0c4de --- /dev/null +++ b/config_flow.py @@ -0,0 +1,17 @@ +import voluptuous as vol +from homeassistant import config_entries + +from .const import DOMAIN + +class JiboConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): + VERSION = 1 + CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL + + async def async_step_user(self, user_input=None): + if user_input is not None: + return self.async_create_entry(title="Jibo", data=user_input) + + data_schema = vol.Schema({ + vol.Required("jibo_ip"): str + }) + return self.async_show_form(step_id="user", data_schema=data_schema) \ No newline at end of file diff --git a/const.py b/const.py new file mode 100644 index 0000000..c148a37 --- /dev/null +++ b/const.py @@ -0,0 +1 @@ +DOMAIN = "jibo" \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..c1d9f52 --- /dev/null +++ b/manifest.json @@ -0,0 +1,10 @@ +{ + "domain": "jibo", + "name": "OpenJibo", + "version": "0.1.0.a", + "documentation": "https://jibohacks.zane.org/homeassistant/int", + "requirements": [], + "dependencies": [], + "codeowners": ["@ZaneThePython"], + "config_flow": true +} \ No newline at end of file diff --git a/services.yaml b/services.yaml new file mode 100644 index 0000000..08024f8 --- /dev/null +++ b/services.yaml @@ -0,0 +1,7 @@ +say: + description: Make Jibo Say Something + fields: + message: + description: Text to speak + example: "Hello Home Assistant" + required: true \ No newline at end of file