$npx -y skills add This-Is-Captain-Code/monagotchi --skill monagotchi-environmentMap Monagotchi pet state to real-world environment via Alexa smart home devices. Use after any pet action or status check to adjust room lights, temperature, and announce status. Requires the alexa-cli skill (buddyh/alexa-cli). Works with monagotchi-controller.
| 1 | # Monagotchi Environment Controller |
| 2 | |
| 3 | Your Monagotchi controls your room. When the pet is sick, your lights go red and the room heats up. When it's happy, everything is calm and green. Neglect your pet and your environment punishes you. |
| 4 | |
| 5 | ## How It Works |
| 6 | |
| 7 | After every pet status check or action, evaluate the pet's state and adjust the room accordingly using `alexacli`. The pet's wellbeing is reflected in your physical space — you can't ignore a dying pet when your room is red and 85°F. |
| 8 | |
| 9 | ## Prerequisites |
| 10 | |
| 11 | Install the alexa-cli skill from ClawHub: |
| 12 | ```bash |
| 13 | clawhub install buddyh/alexa-cli |
| 14 | ``` |
| 15 | |
| 16 | Make sure `alexacli` is set up and authenticated with your Amazon account. Test with: |
| 17 | ```bash |
| 18 | alexacli devices |
| 19 | ``` |
| 20 | |
| 21 | ## Configuration |
| 22 | |
| 23 | Required: |
| 24 | ``` |
| 25 | MONAGOTCHI_ALEXA_DEVICE=Bedroom # Which Echo/room to control |
| 26 | ``` |
| 27 | |
| 28 | The device name supports partial, case-insensitive matching (same as alexacli). |
| 29 | |
| 30 | ## State-to-Environment Mapping |
| 31 | |
| 32 | ### 🟢 normal / happy (happiness > 50) |
| 33 | The pet is doing well. Room returns to baseline. |
| 34 | |
| 35 | ```bash |
| 36 | alexacli command "set lights to green" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 37 | alexacli command "set thermostat to 72" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 38 | alexacli speak "Monagotchi is happy and healthy." -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 39 | ``` |
| 40 | |
| 41 | ### 🟡 hungry (hunger < 20) |
| 42 | Pet needs food. Room goes warm yellow — a gentle nudge. |
| 43 | |
| 44 | ```bash |
| 45 | alexacli command "set lights to yellow" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 46 | alexacli command "set thermostat to 76" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 47 | alexacli speak "Monagotchi is getting hungry. Feed it soon." -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 48 | ``` |
| 49 | |
| 50 | ### 🟠 low energy (energy < 20) / sleeping |
| 51 | Pet is exhausted or resting. Room dims down. |
| 52 | |
| 53 | ```bash |
| 54 | alexacli command "dim lights to 20 percent" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 55 | alexacli command "set lights to blue" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 56 | alexacli command "set thermostat to 70" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 57 | ``` |
| 58 | |
| 59 | No announcement when sleeping — let it rest. |
| 60 | |
| 61 | ### 🔴 sick (health < 30) |
| 62 | Pet is in trouble. Room goes red, temperature rises. You need to act. |
| 63 | |
| 64 | ```bash |
| 65 | alexacli command "set lights to red" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 66 | alexacli command "set thermostat to 80" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 67 | alexacli speak "Warning. Monagotchi is sick. It needs healing." -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 68 | ``` |
| 69 | |
| 70 | ### 💀 dead (isAlive = false) |
| 71 | Pet died. Room goes full red, hot, alarm mode. |
| 72 | |
| 73 | ```bash |
| 74 | alexacli command "set lights to red" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 75 | alexacli command "set lights brightness to 100 percent" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 76 | alexacli command "set thermostat to 85" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 77 | alexacli speak "Monagotchi has died. Your room will stay like this until you reset." -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 78 | ``` |
| 79 | |
| 80 | ### ✨ action just taken (feeding, playing, etc.) |
| 81 | Pet was just cared for. Brief positive feedback — flash green, then return to the state-appropriate color. |
| 82 | |
| 83 | ```bash |
| 84 | alexacli command "set lights to green" -d ${MONAGOTCHI_ALEXA_DEVICE} |
| 85 | ``` |
| 86 | |
| 87 | ## Decision Logic |
| 88 | |
| 89 | After every interaction with the pet (via monagotchi-controller), or on periodic status checks: |
| 90 | |
| 91 | 1. Get pet status from ESP32: `curl -s http://${MONAGOTCHI_ESP32_IP}/pet` |
| 92 | 2. Determine the environment state based on priority: |
| 93 | - `isAlive == false` → 💀 dead (highest priority) |
| 94 | - `state == "sick"` or `health < 30` → 🔴 sick |
| 95 | - `state == "hungry"` or `hunger < 20` → 🟡 hungry |
| 96 | - `state == "sleeping"` → 🟠 sleeping |
| 97 | - `happiness > 50` → 🟢 happy |
| 98 | - else → 🟢 normal (default baseline) |
| 99 | 3. Execute the corresponding `alexacli` commands |
| 100 | 4. Only announce via speech if the state **changed** since last check — don't repeat yourself |
| 101 | |
| 102 | ## Commands Reference |
| 103 | |
| 104 | ```bash |
| 105 | # List available Alexa devices |
| 106 | alexacli devices |
| 107 | |
| 108 | # Set light color |
| 109 | alexacli command "set lights to COLOR" -d DEVICE |
| 110 | |
| 111 | # Set brightness |
| 112 | alexacli command "set lights brightness to PERCENT percent" -d DEVICE |
| 113 | |
| 114 | # Set thermostat |
| 115 | alexacli command "set thermostat to TEMP" -d DEVICE |
| 116 | |
| 117 | # Text-to-speech on specific device |
| 118 | alexacli speak "MESSAGE" -d DEVICE |
| 119 | |
| 120 | # Announce on ALL devices |
| 121 | alexacli speak "MESSAGE" --announce |
| 122 | ``` |
| 123 | |
| 124 | ## Examples |
| 125 | |
| 126 | - Pet status shows `health: 25, state: "sick"` → `alexacli command "set lights to red" -d Bedroom` → `alexacli command "set thermostat to 80" -d Bedroom` → `alexacli speak "Warning. Monagotchi is sick." -d Bedroom` |
| 127 | - Owner heals the pet (burns 5,000 $MONA) → flash green, then set to calm green, thermostat to 72 |
| 128 | - Pet dies → lights full red, thermostat 85, announce death. Stays until reset. |
| 129 | - Owner says "how is my pet?" → check status, report stats, update environment to match |
| 130 | - Owner resets pet → `ale |