├── responses ├── bedstatus.json ├── Aircon.jpg ├── Kitchen.jpg ├── Weather.jpg ├── bedstatus.jpg ├── GroupPhoto.jpg ├── LivingroomSensor.jpg ├── wherearemyglasses.jpg ├── lightsensor_livingroom.jpg ├── lightsensor_livingroom.json ├── timelapse │ ├── sleepmonitor_2024-06-06_08-30-00.jpg │ ├── sleepmonitor_2024-06-06_09-00-00.jpg │ ├── sleepmonitor_2024-06-06_10-00-00.jpg │ ├── sleepmonitor_2024-06-06_10-30-00.jpg │ ├── sleepmonitor_2024-06-06_11-00-00.jpg │ ├── sleepmonitor_2024-06-06_11-30-00.jpg │ ├── sleepmonitor_2024-06-06_12-30-00.jpg │ └── sleepmonitor_2024-06-06_13-00-00.jpg ├── GroupPhoto.txt ├── Weather.txt ├── Kitchen.txt ├── Aircon.json ├── wherearemyglasses.json ├── LivingroomSensor.json ├── Weather.json ├── GroupPhoto.json └── Kitchen.json ├── __pycache__ ├── sensor.cpython-312.pyc └── __init__.cpython-312.pyc ├── settings.yaml ├── manifest.json ├── __init__.py ├── sensor.py ├── prompts.yaml ├── image2text.py ├── README.md ├── LICENSE └── openai-vision.log /responses/bedstatus.json: -------------------------------------------------------------------------------- 1 | "json\n{\n \"Bed\": \"Unmade\"\n}" -------------------------------------------------------------------------------- /responses/Aircon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/Aircon.jpg -------------------------------------------------------------------------------- /responses/Kitchen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/Kitchen.jpg -------------------------------------------------------------------------------- /responses/Weather.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/Weather.jpg -------------------------------------------------------------------------------- /responses/bedstatus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/bedstatus.jpg -------------------------------------------------------------------------------- /responses/GroupPhoto.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/GroupPhoto.jpg -------------------------------------------------------------------------------- /responses/LivingroomSensor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/LivingroomSensor.jpg -------------------------------------------------------------------------------- /responses/wherearemyglasses.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/wherearemyglasses.jpg -------------------------------------------------------------------------------- /__pycache__/sensor.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/__pycache__/sensor.cpython-312.pyc -------------------------------------------------------------------------------- /__pycache__/__init__.cpython-312.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/__pycache__/__init__.cpython-312.pyc -------------------------------------------------------------------------------- /responses/lightsensor_livingroom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/lightsensor_livingroom.jpg -------------------------------------------------------------------------------- /responses/lightsensor_livingroom.json: -------------------------------------------------------------------------------- 1 | "json\n{\n \"lightsensor_livingroom.dj_lights\": \"on\",\n \"lightsensor_livingroom.ceiling_lights\": \"on\"\n}" -------------------------------------------------------------------------------- /responses/timelapse/sleepmonitor_2024-06-06_08-30-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/timelapse/sleepmonitor_2024-06-06_08-30-00.jpg -------------------------------------------------------------------------------- /responses/timelapse/sleepmonitor_2024-06-06_09-00-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/timelapse/sleepmonitor_2024-06-06_09-00-00.jpg -------------------------------------------------------------------------------- /responses/timelapse/sleepmonitor_2024-06-06_10-00-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/timelapse/sleepmonitor_2024-06-06_10-00-00.jpg -------------------------------------------------------------------------------- /responses/timelapse/sleepmonitor_2024-06-06_10-30-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/timelapse/sleepmonitor_2024-06-06_10-30-00.jpg -------------------------------------------------------------------------------- /responses/timelapse/sleepmonitor_2024-06-06_11-00-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/timelapse/sleepmonitor_2024-06-06_11-00-00.jpg -------------------------------------------------------------------------------- /responses/timelapse/sleepmonitor_2024-06-06_11-30-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/timelapse/sleepmonitor_2024-06-06_11-30-00.jpg -------------------------------------------------------------------------------- /responses/timelapse/sleepmonitor_2024-06-06_12-30-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/timelapse/sleepmonitor_2024-06-06_12-30-00.jpg -------------------------------------------------------------------------------- /responses/timelapse/sleepmonitor_2024-06-06_13-00-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulmacnicol/openai_vision/HEAD/responses/timelapse/sleepmonitor_2024-06-06_13-00-00.jpg -------------------------------------------------------------------------------- /responses/GroupPhoto.txt: -------------------------------------------------------------------------------- 1 | Ah, behold, in their natural habitat we see the rare "Giggly Gazelle," with hair flowing like the rivers of the Serengeti, and the distinguished "Chortling Cheeta," whose laughter echoes through the savannah as they share a moment of unbridled joy. -------------------------------------------------------------------------------- /responses/Weather.txt: -------------------------------------------------------------------------------- 1 | Good afternoon. Currently, the weather is quite clear, with blue skies and abundant sunshine visible throughout the area. Conditions suggest stable and pleasant weather will continue over the next several hours, with no immediate signs of precipitation or significant cloud cover. -------------------------------------------------------------------------------- /responses/Kitchen.txt: -------------------------------------------------------------------------------- 1 | Right, I'll give this kitchen a 6 - it's got potential, but it's not quite there yet, is it? The place looks relatively clean, but what is that, some half-hearted attempt at tidying up? Did someone just decide to stop halfway through? Come on, it needs a proper clean, or get out of my kitchen! -------------------------------------------------------------------------------- /settings.yaml: -------------------------------------------------------------------------------- 1 | settings: 2 | HA_URL: "https://" 3 | RESPONSE_DIR: "/config/custom_components/openai_vision/responses" 4 | MEDIA_DIR: "/config/custom_components/openai_vision/responses" 5 | HASS_TOKEN: "" 6 | OPENAI_API_KEY: "openai-api-key>" 7 | MODEL_CHOICES: 8 | - gpt-4o 9 | - gpt-4-turbo 10 | - gpt-4-1106-vision-preview 11 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "domain": "openai_vision", 3 | "name": "OpenAI Vision", 4 | "version": "1.0.0", 5 | "documentation": "https://github.com/paulmacnicol/openai_vision", 6 | "dependencies": [], 7 | "codeowners": ["@paulmacnicol"], 8 | "requirements": [], 9 | "integration_type": "device", 10 | "iot_class": "cloud_polling", 11 | "config_flow": false, 12 | "homeassistant": "2021.12.0", 13 | "domain_dependencies": ["sensor"], 14 | "platforms": ["sensor"] 15 | } 16 | -------------------------------------------------------------------------------- /responses/Aircon.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": "Off", 3 | "prompt": "In the top left of this picture is an air conditioner. You can tell if it's working because you can see if the flap is open or closed. I want you t respond with one word - 'On' if you can see the flap open (indicating that the Air Conditioner is turner on), or 'Off' if you cant see the flap on the bottom of the A/C unit open, or cant see it at all ", 4 | "image": "https://ravensnest.soundcheckvn.com/local/Aircon.jpg", 5 | "settings": { 6 | "model": "gpt-4o", 7 | "style": null, 8 | "camera_entity": "camera.living_room_camera" 9 | } 10 | } -------------------------------------------------------------------------------- /responses/wherearemyglasses.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": "I see your glasses on the kitchen counter next to the sink. They are to the left of a glass of water.", 3 | "prompt": "Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room.", 4 | "image": "https://ravensnest.soundcheckvn.com/local/wherearemyglasses.jpg", 5 | "settings": { 6 | "model": "gpt-4o", 7 | "style": "Jarvis", 8 | "camera_entity": "camera.kitchen_camera" 9 | } 10 | } -------------------------------------------------------------------------------- /responses/LivingroomSensor.json: -------------------------------------------------------------------------------- 1 | "The image shows a cozy living room with several notable features:\n\n1. **Furniture**: A dark leather sectional sofa with a couple of cushions. There's a round wooden coffee table in front of the sofa, and a wooden TV stand on the right.\n\n2. **Lighting**: There are wall-mounted lights on either side of the room, each illuminating a section of the wall, as well as a central ceiling light.\n\n3. **Window Treatments**: The windows are covered with full-length grey or green curtains.\n\n4. **Accessories and Decor**: \n - There appears to be a telescope near the right side of the room.\n - On the left side, there's what looks like DJ or music equipment (possibly a turntable) atop a stand.\n - Assorted items are scattered on the coffee table and TV stand, including what looks like some electronic devices or remote controls.\n\nThe overall style of the room appears to be modern and comfortable, with a mix of functional and recreational elements." -------------------------------------------------------------------------------- /responses/Weather.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": "Good morning, viewers. Currently, we're observing a bright and sunny morning with scattered clouds and a gentle breeze. As the day progresses, expect the sunny conditions to prevail with a slight increase in cloud cover towards the afternoon, maintaining mild temperatures and a picturesque day ahead. Perfect weather for outdoor activities.", 3 | "prompt": "I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct.", 4 | "image": "https://ravensnest.soundcheckvn.com/local/Weather.jpg", 5 | "settings": { 6 | "model": "gpt-4-turbo", 7 | "style": "BBC", 8 | "camera_entity": "camera.webcam" 9 | } 10 | } -------------------------------------------------------------------------------- /responses/GroupPhoto.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": "Ah, here we see the majestic 'Leather Lounger' and the elusive 'Curtain Cloak', accompanied by the vigilant 'Telescope Totem'\u2014all residing in their natural habitat, the 'Luminous Living Room', as they coexist in perfect harmony, utterly unaware of the outside world's chaos.", 3 | "prompt": "I want you to examine the person or people in this picture, and describe what you see. This is to demonstrate your capabilities in a fun and humourous way to the people in the photo, who have never seen Chatgpt in action before, so make it impressive! Your response should be as humourous as possible, making up nicknames for the people based on their appearance. Make the output in a single line of text with no carriage returns or unusual characters I want you to write this in the character of David_Attenborough", 4 | "image": "https://ravensnest.soundcheckvn.com/local/GroupPhoto.jpg", 5 | "settings": { 6 | "model": "gpt-4o", 7 | "style": "David_Attenborough", 8 | "camera_entity": "camera.living_room_camera" 9 | } 10 | } -------------------------------------------------------------------------------- /responses/Kitchen.json: -------------------------------------------------------------------------------- 1 | { 2 | "response": "I\u2019d give this kitchen a 6 out of 10. Listen, mate, it's not a complete disaster but it\u2019s definitely not winning any awards either! For crying out loud, you\u2019ve got a pan left on the sink, a chopping board still out, and what\u2019s this, glasses just lying around like someone\u2019s thrown a frat party? Honestly, this place looks like it\u2019s halfway between making a decent meal and deciding to abandon ship! Get it together!", 3 | "prompt": "I want you to look at the kitchen in this picture, and give it a rating from 1 (poor) to 10 (outstanding). Then write a paragraph describing the cleanliness of the kitchen. Make the output in a single line of text with no carriage returns or unusual characters You are to assume the personality of Gordon Ramsey and write the response in character as if Gordon were reading it himself. You can be as cheeky, candid or nsfw as you like, I don't mind a good roasting!", 4 | "image": "https://ravensnest.soundcheckvn.com/local/Kitchen.jpg", 5 | "settings": { 6 | "model": "gpt-4o", 7 | "style": "Gordon_Ramsey", 8 | "camera_entity": "camera.kitchen_camera" 9 | } 10 | } -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import homeassistant.helpers.config_validation as cv 3 | import voluptuous as vol 4 | from homeassistant.const import CONF_NAME 5 | from homeassistant.helpers import discovery 6 | import yaml 7 | 8 | _LOGGER = logging.getLogger(__name__) 9 | 10 | DOMAIN = "openai_vision" 11 | 12 | CONFIG_SCHEMA = vol.Schema( 13 | { 14 | DOMAIN: vol.Schema( 15 | { 16 | vol.Required("sensors"): vol.All(cv.ensure_list, [ 17 | vol.Schema({vol.Required(CONF_NAME): cv.string}) 18 | ]) 19 | } 20 | ) 21 | }, 22 | extra=vol.ALLOW_EXTRA, 23 | ) 24 | 25 | async def async_setup(hass, config): 26 | """Set up the OpenAI Vision component.""" 27 | if DOMAIN not in config: 28 | return True 29 | 30 | # Load settings from YAML 31 | with open('/config/custom_components/openai_vision/settings.yaml', 'r') as f: 32 | settings = yaml.safe_load(f) 33 | 34 | ha_url = settings['settings']['HA_URL'] 35 | hass_token = settings['settings']['HASS_TOKEN'] 36 | 37 | for entry in config[DOMAIN]["sensors"]: 38 | name = entry[CONF_NAME] 39 | hass.async_create_task( 40 | discovery.async_load_platform(hass, "sensor", DOMAIN, {"name": name, "ha_url": ha_url, "hass_token": hass_token}, config) 41 | ) 42 | 43 | return True 44 | -------------------------------------------------------------------------------- /sensor.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import requests 3 | from homeassistant.helpers.entity import Entity 4 | 5 | _LOGGER = logging.getLogger(__name__) 6 | 7 | def setup_platform(hass, config, add_entities, discovery_info=None): 8 | """Set up the OpenAI Vision sensor platform.""" 9 | if discovery_info is None: 10 | return 11 | 12 | name = discovery_info["name"] 13 | ha_url = discovery_info["ha_url"] 14 | hass_token = discovery_info["hass_token"] 15 | add_entities([OpenAIVisionSensor(hass, name, ha_url, hass_token)], True) 16 | 17 | class OpenAIVisionSensor(Entity): 18 | """Representation of an OpenAI Vision sensor.""" 19 | 20 | def __init__(self, hass, name, ha_url, hass_token): 21 | """Initialize the sensor.""" 22 | self.hass = hass 23 | self._name = name 24 | self._ha_url = ha_url 25 | self._hass_token = hass_token 26 | self._state = "waiting" 27 | self._attributes = {} 28 | 29 | @property 30 | def name(self): 31 | """Return the name of the sensor.""" 32 | return f"openai_vision_{self._name.lower()}_response" 33 | 34 | @property 35 | def state(self): 36 | """Return the state of the sensor.""" 37 | return self._state 38 | 39 | @property 40 | def extra_state_attributes(self): 41 | """Return the state attributes.""" 42 | return self._attributes 43 | 44 | def update(self): 45 | """Fetch new state data for the sensor.""" 46 | if not self.entity_id: 47 | _LOGGER.warning(f"Entity ID for {self._name} is not set. Skipping update.") 48 | return 49 | 50 | url = f"{self._ha_url}/api/states/{self.entity_id}" 51 | headers = { 52 | "Authorization": f"Bearer {self._hass_token}", 53 | "Content-Type": "application/json" 54 | } 55 | response = requests.get(url, headers=headers) 56 | if response.status_code == 200: 57 | data = response.json() 58 | self._state = data['state'] 59 | self._attributes = data['attributes'] 60 | else: 61 | _LOGGER.error(f"Error fetching data from {url}: {response.status_code} - {response.text}") 62 | -------------------------------------------------------------------------------- /prompts.yaml: -------------------------------------------------------------------------------- 1 | models: 2 | - gpt-4o 3 | - gpt-4-turbo 4 | - gpt-4 5 | - gpt-3.5-turbo 6 | 7 | prompts: 8 | Weather: 9 | description: "I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters." 10 | Curtains: 11 | description: "Look at the picture and tell me if the curtains are open or closed. You should recognise if there are more than one set of curtains and identify them, and if they are fully or partially closed. Make the output in a single line of text with no carriage returns or unusual characters." 12 | Kitchen: 13 | description: "I want you to look at the kitchen in this picture, and give it a rating from 1 (poor) to 10 (outstanding). Then write a paragraph describing the cleanliness of the kitchen. Make the output in a single line of text with no carriage returns or unusual characters" 14 | LivingRoom: 15 | description: "I want you to describe what you see in this picture. Describe the Ambience of the room and suggest 3 songs which might be appropriate. Make the output in a single line of text with no carriage returns or unusual characters" 16 | Garage: 17 | description: "I want you to report all the items you see in this picture. Make the output in a single line of text with no carriage returns or unusual characters" 18 | GroupPhoto: 19 | description: "I want you to examine the person or people in this picture, and describe what you see. This is to demonstrate your capabilities in a fun and humourous way to the people in the photo, who have never seen Chatgpt in action before, so make it impressive! Your response should be as humourous as possible, making up nicknames for the people based on their appearance. Make the output in a single line of text with no carriage returns or unusual characters" 20 | Aircon: 21 | description: "In the top left of this picture is an air conditioner. You can tell if it's working because you can see if the flap is open or closed. I want you t respond with one word - 'On' if you can see the flap open (indicating that the Air Conditioner is turner on), or 'Off' if you cant see the flap on the bottom of the A/C unit open, or cant see it at all" 22 | LivingroomSensor: 23 | description: "In the picture is a room, I want you to identify what room it is and record that, then identify and count the items in the room. In a bedroom for example you might count 1 bed, 2 bedside lamps, 1 mirror etc. Make the output in JSON so I can easily add these items to a database. If there is a person or people in the photo, I want you to count the number of people under the field name person_count. If someone is obstructing the picture, I want you to simply output Obstruction and not record any information about the room. If there is an air conditioner unit in the room, I want you to record the field air_conditioner with status either on or off, depending on if it is operating or not. You can tell this by looking for the flap on the air conditioner, it is down if the unit is on. If there is a TV in the room, you should record the field TV with status On or Off, same as the aircon example above. If curtains are detected, they should be recorded with status open or closed. In case of multiple curtains, use curtain_right, curtain_left table names to record the status of each pair of curtains. In cases where there are more than one item, the first item should be named, say, tv, with the following televisions labelled tv2, tv3, tv4 etc. If you cannot determine the status of the item, do not record any information in the JSON about the item. If there are people present, make a paragraph which summarises what is happening in the photograph, the mood and atmosphere of the room. For each photo, you should judge how messy or tidy the room is, and create a field for that room called tidiness. Give the room a score out of 10 (most tidy) and save it as the status. In this particular photo, there is an air conditioner unit in the top left corner of the image, and a television on the right. The sofa is an L shape, there is no armchair. Use the following conventions for naming the items you find in the picture. Field names should be entirely in lowercase using an underscore to separate words, no spaces. They should be a maximum of 3 words long. If any of the following objects are detected, they should be given the following field names: Air conditioner unit, aircon; Black sofa, sofa_black; Brown armchair, armchair_brown; Coffee table, coffee_table; Tripod, telescope; Television set on a stand, tv; Turntable setup, dj_booth. Field names should be entirely in lowercase using an underscore to separate words, no spaces. They should be a maximum of 3 words long." 24 | wherearemyglasses: 25 | description: "Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are" 26 | bedstatus: 27 | description: "I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text." 28 | lightsensor_livingroom: 29 | description: "In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off." 30 | styles: 31 | BBC: 32 | description: "Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct." 33 | Gordon_Ramsey: 34 | description: "You are to assume the personality of Gordon Ramsey and write the response in character as if Gordon were reading it himself. You can be as cheeky, candid or nsfw as you like, I don't mind a good roasting!" 35 | Snoop_Dogg: 36 | description: "I want you to write this in the character of Snoop Dogg." 37 | David_Attenborough: 38 | description: "I want you to write this in the character of David_Attenborough" 39 | Jarvis: 40 | description: "You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room." 41 | json: 42 | description: "Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described." 43 | audience: 44 | Children: 45 | description: "The audience for your response will be children, so tailor your response to be safe for kids to hear." 46 | Paul: 47 | description: "The audience for your response is Paul, a 49 Year Old Devops engineer, the author of the openai-vision integration which is communicating with you now. He is interested in Music and plays Guitar, ukulele, Bass and Piano, and loves all things technology related. He likes to experiment with electronics and has some arduino projects underway." 48 | Shayna: 49 | description: "The audience for your response is Shayna, a 22 year old Surgery Theatre technician. She is interested in surfing, hockey and loves the show Desperate housewives" 50 | -------------------------------------------------------------------------------- /image2text.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import json 3 | import base64 4 | import os 5 | import argparse 6 | import yaml 7 | import logging 8 | 9 | # Configure logging 10 | log_file = '/config/custom_components/openai_vision/openai-vision.log' 11 | logging.basicConfig(filename=log_file, level=logging.INFO, format='%(asctime)s - %(message)s') 12 | 13 | # Load settings from YAML 14 | with open('/config/custom_components/openai_vision/settings.yaml', 'r') as f: 15 | settings = yaml.safe_load(f) 16 | 17 | HA_URL = settings['settings']['HA_URL'] 18 | RESPONSE_DIR = settings['settings']['RESPONSE_DIR'] 19 | MEDIA_DIR = settings['settings']['MEDIA_DIR'] 20 | HASS_TOKEN = settings['settings']['HASS_TOKEN'] 21 | OPENAI_API_KEY = settings['settings']['OPENAI_API_KEY'] 22 | MODEL_CHOICES = settings['settings']['MODEL_CHOICES'] 23 | 24 | # Headers for authentication 25 | headers = { 26 | "Authorization": f"Bearer {HASS_TOKEN}", 27 | "content-type": "application/json", 28 | } 29 | 30 | def take_snapshot(camera_entity_id, image_path): 31 | """Take a snapshot from the specified camera.""" 32 | snapshot_url = f"{HA_URL}/api/services/camera/snapshot" 33 | data = { 34 | "entity_id": camera_entity_id, 35 | "filename": image_path 36 | } 37 | response = requests.post(snapshot_url, headers=headers, data=json.dumps(data)) 38 | response.raise_for_status() 39 | 40 | def encode_image(image_path): 41 | """Encode the image as base64.""" 42 | with open(image_path, "rb") as image_file: 43 | return base64.b64encode(image_file.read()).decode('utf-8') 44 | 45 | def get_prompt_and_style(prompt_name, style_name=None): 46 | """Get the prompt and style text from the YAML file.""" 47 | with open('/config/custom_components/openai_vision/prompts.yaml', 'r') as f: 48 | data = yaml.safe_load(f) 49 | prompt_text = data['prompts'].get(prompt_name, {}).get('description', '') 50 | style_text = data['styles'].get(style_name, {}).get('description', '') if style_name else "" 51 | logging.info(f"Loaded prompt for {prompt_name}: {prompt_text}") # Log the loaded prompt 52 | if style_name: 53 | logging.info(f"Loaded style for {style_name}: {style_text}") # Log the loaded style 54 | return f"{prompt_text} {style_text}" 55 | 56 | def get_response(image_path, model, prompt_text): 57 | """Send the snapshot to the OpenAI API and get the response.""" 58 | base64_image = encode_image(image_path) 59 | headers = { 60 | "Content-Type": "application/json", 61 | "Authorization": f"Bearer {OPENAI_API_KEY}" 62 | } 63 | payload = { 64 | "model": model, 65 | "messages": [ 66 | { 67 | "role": "user", 68 | "content": [ 69 | { 70 | "type": "text", 71 | "text": prompt_text 72 | }, 73 | { 74 | "type": "image_url", 75 | "image_url": { 76 | "url": f"data:image/jpeg;base64,{base64_image}" 77 | } 78 | } 79 | ] 80 | } 81 | ], 82 | "max_tokens": 300 83 | } 84 | logging.info(f"Sending prompt to OpenAI API: {prompt_text}") # Add logging for the prompt 85 | response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload) 86 | response.raise_for_status() 87 | response_data = response.json() 88 | logging.info(f"Received response from OpenAI API: {response_data}") # Add logging for the response 89 | return response_data['choices'][0]['message']['content'] 90 | 91 | def write_response(response, file_path, prompt_text=None, image_path=None, settings=None, is_json=False): 92 | """Write the response to a JSON file.""" 93 | if is_json: 94 | json_data = response 95 | else: 96 | image_link = f"{HA_URL}/local/{os.path.basename(image_path)}" 97 | json_data = { 98 | "response": response, 99 | "prompt": prompt_text, 100 | "image": image_link, 101 | "settings": settings 102 | } 103 | with open(file_path, "w") as file: 104 | json.dump(json_data, file, indent=4) 105 | 106 | def update_sensor(entity_id, state, attributes): 107 | """Update the sensor in Home Assistant with the given state and attributes.""" 108 | url = f"{HA_URL}/api/states/{entity_id}" 109 | headers = { 110 | "Authorization": f"Bearer {HASS_TOKEN}", 111 | "Content-Type": "application/json" 112 | } 113 | payload = { 114 | "state": state, 115 | "attributes": attributes 116 | } 117 | try: 118 | response = requests.post(url, headers=headers, json=payload) # Use json parameter to ensure proper JSON encoding 119 | response.raise_for_status() 120 | except requests.exceptions.HTTPError as e: 121 | logging.error(f"Failed to update sensor: {e}\nResponse: {response.text}") 122 | logging.error(f"Payload: {json.dumps(payload, indent=4)}") # Add payload logging 123 | 124 | def strip_code_blocks(response): 125 | """Strip code block formatting from the response.""" 126 | if response.startswith("```json") and response.endswith("```"): 127 | response = response[7:-3].strip() 128 | elif response.startswith("```") and response.endswith("```"): 129 | response = response[3:-3].strip() 130 | return response 131 | 132 | def extract_state_and_attributes_from_json(response): 133 | """Extract the state and attributes from the JSON response.""" 134 | try: 135 | response = strip_code_blocks(response) # Strip code block formatting if present 136 | response_json = json.loads(response) 137 | # Determine state and attributes based on the number of key-value pairs 138 | if len(response_json) == 1: 139 | state_key = list(response_json.keys())[0] 140 | state_value = response_json[state_key] 141 | return state_value, {"response": response_json} 142 | else: 143 | state = "Updated" 144 | attributes = response_json 145 | return state, attributes 146 | except json.JSONDecodeError as e: 147 | logging.error(f"Error decoding JSON: {e}") 148 | return "Unknown", {} 149 | 150 | def main(): 151 | """Main function to process the image.""" 152 | parser = argparse.ArgumentParser(description='Process some arguments.') 153 | parser.add_argument('--model', choices=MODEL_CHOICES, default='gpt-4o', help='Model to use for OpenAI API') 154 | parser.add_argument('--camera', required=True, help='Camera entity ID') 155 | parser.add_argument('--prompt', required=True, help='Prompt name') 156 | parser.add_argument('--style', help='Style name') 157 | parser.add_argument('--json', action='store_true', help='Indicate if the response is already in JSON format') 158 | 159 | args = parser.parse_args() 160 | 161 | logging.info(f"Command line arguments: model={args.model}, camera={args.camera}, prompt={args.prompt}, style={args.style}, json={args.json}") 162 | 163 | if args.json: 164 | image_path = os.path.join(MEDIA_DIR, f"{args.prompt}.jpg") 165 | response_path = os.path.join(RESPONSE_DIR, f"{args.prompt}.json") 166 | 167 | prompt_text = get_prompt_and_style(args.prompt, args.style).strip() 168 | take_snapshot(args.camera, image_path) 169 | response = get_response(image_path, args.model, prompt_text) 170 | state, attributes = extract_state_and_attributes_from_json(response) # Extract state and attributes from JSON response 171 | update_sensor(f"sensor.openai_vision_{args.prompt.lower()}_response", state, attributes) # Update sensor state and attributes 172 | print(response) # Print only the response content 173 | else: 174 | combined_text = get_prompt_and_style(args.prompt, args.style) 175 | 176 | if not combined_text.strip(): 177 | logging.error(f"Prompt '{args.prompt}' or style '{args.style}' not found in prompts.yaml") 178 | print(f"Prompt '{args.prompt}' or style '{args.style}' not found in prompts.yaml") 179 | return 180 | 181 | image_path = os.path.join(MEDIA_DIR, f"{args.prompt}.jpg") 182 | response_path = os.path.join(RESPONSE_DIR, f"{args.prompt}.json") 183 | 184 | take_snapshot(args.camera, image_path) 185 | logging.info(f"Combined prompt text: {combined_text}") # Add logging for combined text 186 | response = get_response(image_path, args.model, combined_text) 187 | response = strip_code_blocks(response) 188 | 189 | settings = { 190 | "model": args.model, 191 | "style": args.style, 192 | "camera_entity": args.camera 193 | } 194 | 195 | write_response(response, response_path, combined_text, image_path, settings) 196 | json_data = { 197 | "response": response, 198 | "prompt": combined_text, 199 | "image": f"{HA_URL}/local/{os.path.basename(image_path)}", 200 | "settings": settings 201 | } 202 | update_sensor(f"sensor.openai_vision_{args.prompt.lower()}_response", "updated", json_data) # Keep "updated" state for non-JSON responses 203 | print(json.dumps(json_data, indent=4)) 204 | 205 | if __name__ == "__main__": 206 | main() 207 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OpenAI Vision Integration for Home Assistant 2 | 3 | OpenAI Vision Integration for Home Assistant 4 | ============================================ 5 | 6 | Overview 7 | -------- 8 | 9 | The OpenAI Vision Integration is a custom component for Home Assistant that leverages OpenAI's GPT models to analyze images captured by your home cameras. This integration can generate insightful descriptions, identify objects, and even add a touch of humor to your snapshots. The results are saved in JSON format and can be used to update Home Assistant sensors. 10 | This integration allows you to add hundreds of sensors to your home assistant installation, using existing security cameras or cheap webcams. Add a sensor to check if the beds are made and the dishes are done, and cut off the kids internet until they are. Remind me if I havent got my Rubbish bins out on collection day. Let me know if I have clothes on the line and its going to rain. And so on - theres a huge number of opportunities we can exploit with this software, so I've tried to keep it as straightforward as possible to modify, and I look forward to hearing your suggestions and implementations. 11 | 12 | Features 13 | -------- 14 | 15 | * **Image Analysis**: Automatically captures images from your cameras and analyzes them using OpenAI's GPT models. 16 | * **Flexible Prompts and Styles**: Customize the analysis with various prompts and styles defined in a YAML file. 17 | * **Home Assistant Integration**: Updates sensors in Home Assistant with the analyzed data. 18 | * **JSON Response Handling**: Outputs responses in JSON format for easy integration with other Home Assistant components. 19 | 20 | Installation 21 | ------------ 22 | 23 | 1. **Clone the Repository**: 24 | 25 | git clone https://github.com/paulmacnicol/openai_vision.git 26 | 27 | 2. **Copy Custom Component**: 28 | 29 | mv openai_vision /config/custom_components/ 30 | 31 | 3. **Alternatively, Download the ZIP File**: 32 | * Download the ZIP file from the [GitHub repository](https://github.com/paulmacnicol/openai_vision.git). 33 | * Extract the contents and move the `openai_vision` directory to your Home Assistant's custom components directory: 34 | 35 | mv openai_vision /config/custom_components/ 36 | 37 | 4. **Install Dependencies**: 38 | 39 | pip install requests pyyaml 40 | 41 | 42 | Configuration 43 | ------------- 44 | 45 | ### Edit Settings 46 | 47 | Configure your settings in `/config/custom_components/openai_vision/settings.yaml`: 48 | 49 | settings: 50 | HA_URL: "https://" 51 | RESPONSE_DIR: "/config/custom_components/openai_vision/responses" 52 | MEDIA_DIR: "/config/custom_components/openai_vision/responses" 53 | HASS_TOKEN: "" 54 | OPENAI_API_KEY: "" 55 | MODEL_CHOICES: 56 | - gpt-3.5-turbo 57 | - gpt-4 58 | - gpt-4o 59 | - gpt4-turbo 60 | - gpt-3.5-turbo-16k 61 | 62 | ### Prompts and Styles 63 | 64 | Define your prompts and styles in `/config/custom_components/openai_vision/prompts.yaml. Below are just examples,the actual prompts.yaml has much longer prompts. Customise them to suit your environment`: 65 | 66 | models: 67 | - gpt-4o 68 | - gpt-4-turbo 69 | - gpt-4 70 | - gpt-3.5-turbo 71 | 72 | prompts: 73 | Weather: 74 | description: "Summarize the weather in the picture." 75 | Curtains: 76 | description: "Identify if the curtains are open or closed." 77 | Kitchen: 78 | description: "Rate the cleanliness of the kitchen from 1 to 10 and describe it." 79 | LivingRoom: 80 | description: "Describe the ambience of the room and suggest 3 appropriate songs." 81 | Garage: 82 | description: "List all items you see in the picture." 83 | GroupPhoto: 84 | description: "Humorously describe the people in the group photo." 85 | Aircon: 86 | description: "Check if the air conditioner is on or off." 87 | LivingroomSensor: 88 | description: "Identify and count items in the room and present the data in JSON." 89 | wherearemyglasses: 90 | description: "Find the glasses in the photo." 91 | bedstatus: 92 | description: "Check if the bed is made or identify the person's activity." 93 | lightsensor_livingroom: 94 | description: "Determine the status of ceiling and DJ lights in JSON." 95 | 96 | styles: 97 | BBC: 98 | description: "Formal and correct, suitable for reading aloud." 99 | Gordon_Ramsey: 100 | description: "Cheeky and candid, in the style of the famous chef." 101 | Snoop_Dogg: 102 | description: "Written in the character of Snoop Dogg." 103 | David_Attenborough: 104 | description: "In the style of David Attenborough." 105 | Jarvis: 106 | description: "In the style of Jarvis from Ironman." 107 | json: 108 | description: "Response in simple JSON format with no additional comments." 109 | 110 | ### Add to `configuration.yaml` 111 | 112 | Register the custom component and configure its settings in your Home Assistant `configuration.yaml`: 113 | 114 | shell_command: 115 | run_openai_weather: "python3 /config/custom_components/openai_vision/image2text.py --camera camera.webcam --prompt Weather --style BBC --model gpt-4o" 116 | 117 | openai_vision: 118 | sensors: 119 | - name: Weather 120 | 121 | ### Explanation of `configuration.yaml` Components 122 | 123 | * **`shell_command`**: Defines shell commands to run the image processing script with various prompts and styles. The `run_openai_weather` command uses the `Weather` prompt from `prompts.yaml`, `camera.webcam` as the camera entity, `BBC` as the style, and `gpt-4o` as the model. The name `Weather` must match the `--prompt` argument and the prompt defined in `prompts.yaml`. 124 | * **`openai_vision`**: Defines the sensors that will be created by the integration. The `name` of the sensor must match the `--prompt` value used in the shell command. 125 | 126 | ### Detailed Configuration Options 127 | 128 | * **Camera**: Specify the camera entity ID (e.g., `camera.webcam`). 129 | * **Model**: Select the OpenAI model to use (e.g., `gpt-4o`). 130 | * **Style**: Choose the style for the response (e.g., `BBC`). 131 | * **Prompt**: Define the prompt from `prompts.yaml` (e.g., `Weather`). 132 | 133 | Usage 134 | ----- 135 | 136 | Run the script with the desired parameters by invoking the shell commands defined in the `configuration.yaml` from the Home Assistant Developer Tools screen, an automation, or a Lovelace button. 137 | 138 | Example shell command invocation: 139 | 140 | shell_command: 141 | run_openai_weather: "python3 /config/custom_components/openai_vision/image2text.py --camera camera.webcam --prompt Weather --style BBC --model gpt-4o" 142 | 143 | Trigger this command from the Developer Tools screen, an automation, or a Lovelace button to run the image processing script. The output is a weather report in the style of a BBC reporter, based on the photo from the camera specified. 144 | 145 | The response is then saved as an attribute in sensor.openai_vision_weather_response. The response includes the prompt, model, camera, and style in the json attributes, making it easy to present the results or process further 146 | 147 | Required Tokens and Information 148 | ------------------------------- 149 | 150 | ### Home Assistant Long-Lived Access Token 151 | 152 | 1. Go to your Home Assistant user profile. 153 | 2. Scroll down to the "Long-Lived Access Tokens" section. 154 | 3. Click on "Create Token", provide a name, and copy the token. 155 | 156 | ### Home Assistant URL 157 | 158 | The URL of your Home Assistant instance (e.g., `https://your-home-assistant-url`). This URL does not require external access. 159 | 160 | ### OpenAI API Key 161 | 162 | 1. Sign up for an OpenAI account at [OpenAI](https://platform.openai.com/). 163 | 2. Go to the API keys section and generate a new API key. 164 | 3. Note that using OpenAI's API might require credits, so ensure your account has sufficient balance. 165 | 166 | Sensor Integration 167 | ------------------ 168 | 169 | The OpenAI Vision integration updates Home Assistant sensors with the analyzed data. Depending on whether the `--json` flag is used, the sensor output differs: 170 | 171 | * **Without `--json` Flag**: The response is treated as plain text, suitable for notifications, TTS, or display on a dashboard. The text is saved directly in the sensor's state. 172 | * **With `--json` Flag**: The response is treated as a JSON object. If it reports a single entity (e.g., a light bulb), the sensor's state will show "on" or "off", matching the current state of the light bulb. If multiple objects are being monitored, the information is saved as attributes in the sensor. 173 | 174 | ### Example Sensor Template Configuration 175 | 176 | The following template sensor configuration extracts specific attributes from the JSON response and presents them as individual entities in Home Assistant: 177 | 178 | sensor: 179 | - platform: template 180 | sensors: 181 | lightsensor_livingroom_response: 182 | friendly_name: "Lightsensor Livingroom Response" 183 | value_template: "{{ states.sensor.openai_vision_lightsensor_livingroom_response.state }}" 184 | attribute_templates: 185 | dj_lights: "{{ state_attr('sensor.openai_vision_lightsensor_livingroom_response', 'lightsensor_livingroom.dj_lights') }}" 186 | ceiling_lights: "{{ state_attr('sensor.openai_vision_lightsensor_livingroom_response', 'lightsensor_livingroom.ceiling_lights') }}" 187 | 188 | * **`value_template`**: Extracts the main state from the JSON response. 189 | * **`attribute_templates`**: Extracts specific attributes from the JSON response and presents them as key-value pairs. 190 | 191 | Logging 192 | ------- 193 | 194 | Logs are stored in `/config/custom_components/openai_vision/openai-vision.log`. The logging includes information about prompts, API responses, and errors. 195 | 196 | Prompts and Styles 197 | ------------------ 198 | 199 | The `prompts.yaml` file contains various prompts and styles that define how the images should be analyzed. Here are the main categories that are included, you can create your own or modify these to suit your requirements. Just remember that the prompt name must match in prompts.yaml, and the --prompt in the shell command, and the name of the sensor that receives the data - see the examples included 200 | 201 | ### Prompts 202 | 203 | * **Weather**: Summarize the weather in the picture. 204 | * **Curtains**: Identify if the curtains are open or closed. 205 | * **Kitchen**: Rate the cleanliness of the kitchen from 1 to 10 and describe it. 206 | * **LivingRoom**: Describe the ambience of the room and suggest 3 appropriate songs. 207 | * **Garage**: List all items you see in the picture. 208 | * **GroupPhoto**: Humorously describe the people in the group photo. 209 | * **Aircon**: Check if the air conditioner is on or off. 210 | * **LivingroomSensor**: Identify and count items in the room and present the data in JSON. 211 | * **wherearemyglasses**: Find the glasses in the photo. 212 | * **bedstatus**: Check if the bed is made or identify the person's activity. 213 | * **lightsensor\_livingroom**: Determine the status of ceiling and DJ lights in JSON. 214 | 215 | ### Styles 216 | 217 | * **BBC**: Formal and correct, suitable for reading aloud. 218 | * **Gordon\_Ramsey**: Cheeky and candid, in the style of the famous chef. 219 | * **Snoop\_Dogg**: Written in the character of Snoop Dogg. 220 | * **David\_Attenborough**: In the style of David Attenborough. 221 | * **Jarvis**: In the style of Jarvis from Ironman. 222 | * **json**: Response in simple JSON format with no additional comments. 223 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /openai-vision.log: -------------------------------------------------------------------------------- 1 | 2024-06-06 08:46:17,190 - Command line arguments: model=gpt-4o, camera=camera.living_room_camera, prompt=lightsensor_livingroom, style=None, json=True 2 | 2024-06-06 08:46:17,581 - Sending prompt to OpenAI API: 3 | 2024-06-06 08:46:26,103 - Received response from OpenAI API: {'id': 'chatcmpl-9WroT057yVi1em5wJCHGFa1KDHLYs', 'object': 'chat.completion', 'created': 1717620381, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': "The image shows an indoor living space that appears to be a living room. The room is dimly lit with a few spotlights. Here are some notable elements in the room:\n\n1. **Corner Sofa**: A black leather sectional sofa with some cushions on it.\n2. **Coffee Table**: A round wooden coffee table in front of the sofa, which has some items on it, including what appears to be a remote control.\n3. **Curtains**: Dark-colored curtains covering the windows.\n4. **Telescope**: A telescope is set up on a tripod near the right side of the image.\n5. **TV Stand**: A wooden TV stand, possibly with a television on top of it, although it's not entirely visible in the image.\n6. **Wall-mounted Lights**: There are a few wall-mounted lights providing illumination.\n7. **Record Player**: On the left side, there is a setup that appears to be a record player on a stand with some records underneath.\n\nThe room has a minimalist and modern décor, with a focus on functionality."}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 1112, 'completion_tokens': 219, 'total_tokens': 1331}, 'system_fingerprint': 'fp_aa87380ac5'} 4 | 2024-06-06 08:52:25,299 - Command line arguments: model=gpt-4o, camera=camera.living_room_camera, prompt=lightsensor_livingroom, style=None, json=True 5 | 2024-06-06 08:52:25,882 - Sending prompt to OpenAI API: 6 | 2024-06-06 08:52:32,549 - Received response from OpenAI API: {'id': 'chatcmpl-9WruPzsGXvLMaHBLqLPd9JrmZuaPV', 'object': 'chat.completion', 'created': 1717620749, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': 'The image shows a cozy living room with the following features:\n\n1. **Furniture:**\n - There is a black leather sectional sofa with several cushions.\n - A round wooden coffee table with a few items on it.\n - A low wooden unit under the TV on the right.\n\n2. **Lighting:**\n - The room is lit by ceiling lights and wall-mounted lights.\n\n3. **Decor:**\n - Curtains covering the windows.\n - A telescope standing on a tripod near the right side of the room.\n\n4. **Electronics:**\n - A TV placed on a low unit on the right side.\n - Some equipment that appears to be DJ turntables set up on the left side on top of a cabinet.\n\nThe room has a comfortable and well-organized feel, suitable for relaxation and leisure activities such as watching TV or stargazing with the telescope.'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 1112, 'completion_tokens': 180, 'total_tokens': 1292}, 'system_fingerprint': 'fp_aa87380ac5'} 7 | 2024-06-06 08:58:03,323 - Command line arguments: model=gpt-4o, camera=camera.living_room_camera, prompt=lightsensor_livingroom, style=json, json=True 8 | 2024-06-06 08:58:04,174 - Sending prompt to OpenAI API: 9 | 2024-06-06 08:58:12,871 - Received response from OpenAI API: {'id': 'chatcmpl-9Wrzrh9QHJKoljJqo2exxMv0CxMiO', 'object': 'chat.completion', 'created': 1717621087, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': "This image depicts a living room setting with the following details:\n\n1. **Furniture:**\n - A black leather sectional sofa with various pillows adorned with different patterns.\n - A wooden coffee table in front of the sofa, with a few items on it including a coaster and other small objects.\n\n2. **Lighting and Windows:**\n - Two windows with curtains covering them, likely to minimize outside light.\n - A ceiling light providing illumination to the room.\n - Wall-mounted lights located above the sofa and next to the turntables that are contributing to the room's lighting.\n\n3. **Additional Features:**\n - There is a table or stand set up with DJ equipment, including turntables and a mixer.\n - A telescope mounted on a tripod is positioned in the room, suggesting that someone might be interested in stargazing or observing distant terrestrial objects.\n - The room appears to be neat and orderly, with a few personal items on the coffee table and the stand beside the sofa.\n\nThe overall decor suggests an interest in music and possibly astronomy, indicated by the presence of the DJ equipment and the telescope. The space seems comfortable and designed for relaxation and leisure activities."}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 1112, 'completion_tokens': 238, 'total_tokens': 1350}, 'system_fingerprint': 'fp_aa87380ac5'} 10 | 2024-06-06 09:01:42,716 - Command line arguments: model=gpt-4o, camera=camera.living_room_camera, prompt=lightsensor_livingroom, style=json, json=True 11 | 2024-06-06 09:01:42,758 - Loaded prompt for lightsensor_livingroom: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. 12 | 2024-06-06 09:01:42,758 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 13 | 2024-06-06 09:01:43,035 - Sending prompt to OpenAI API: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 14 | 2024-06-06 09:01:49,138 - Received response from OpenAI API: {'id': 'chatcmpl-9Ws3P3x1JZiHlOwK6kWTvANU3GfBa', 'object': 'chat.completion', 'created': 1717621307, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "lightsensor_livingroom.dj_lights": "on",\n "lightsensor_livingroom.ceiling_lights": "on"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 1272, 'completion_tokens': 35, 'total_tokens': 1307}, 'system_fingerprint': 'fp_aa87380ac5'} 15 | 2024-06-06 09:02:20,160 - Command line arguments: model=gpt-4o, camera=camera.kitchen_camera, prompt=Kitchen, style=Gordon_Ramsey, json=False 16 | 2024-06-06 09:02:20,199 - Loaded prompt for Kitchen: I want you to look at the kitchen in this picture, and give it a rating from 1 (poor) to 10 (outstanding). Then write a paragraph describing the cleanliness of the kitchen. Make the output in a single line of text with no carriage returns or unusual characters 17 | 2024-06-06 09:02:20,200 - Loaded style for Gordon_Ramsey: You are to assume the personality of Gordon Ramsey and write the response in character as if Gordon were reading it himself. You can be as cheeky, candid or nsfw as you like, I don't mind a good roasting! 18 | 2024-06-06 09:02:21,494 - Combined prompt text: I want you to look at the kitchen in this picture, and give it a rating from 1 (poor) to 10 (outstanding). Then write a paragraph describing the cleanliness of the kitchen. Make the output in a single line of text with no carriage returns or unusual characters You are to assume the personality of Gordon Ramsey and write the response in character as if Gordon were reading it himself. You can be as cheeky, candid or nsfw as you like, I don't mind a good roasting! 19 | 2024-06-06 09:02:21,496 - Sending prompt to OpenAI API: I want you to look at the kitchen in this picture, and give it a rating from 1 (poor) to 10 (outstanding). Then write a paragraph describing the cleanliness of the kitchen. Make the output in a single line of text with no carriage returns or unusual characters You are to assume the personality of Gordon Ramsey and write the response in character as if Gordon were reading it himself. You can be as cheeky, candid or nsfw as you like, I don't mind a good roasting! 20 | 2024-06-06 09:02:31,055 - Received response from OpenAI API: {'id': 'chatcmpl-9Ws44nbQpMlFWY9OmRFFevldlb8aR', 'object': 'chat.completion', 'created': 1717621348, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': "I’d give this kitchen a 6 out of 10. Listen, mate, it's not a complete disaster but it’s definitely not winning any awards either! For crying out loud, you’ve got a pan left on the sink, a chopping board still out, and what’s this, glasses just lying around like someone’s thrown a frat party? Honestly, this place looks like it’s halfway between making a decent meal and deciding to abandon ship! Get it together!"}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 874, 'completion_tokens': 94, 'total_tokens': 968}, 'system_fingerprint': 'fp_aa87380ac5'} 21 | 2024-06-06 09:06:45,587 - Command line arguments: model=gpt-4o, camera=camera.webcam, prompt=bedstatus, style=json, json=False 22 | 2024-06-06 09:06:45,628 - Loaded prompt for bedstatus: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. 23 | 2024-06-06 09:06:45,629 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 24 | 2024-06-06 09:06:54,473 - Combined prompt text: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 25 | 2024-06-06 09:06:54,475 - Sending prompt to OpenAI API: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 26 | 2024-06-06 09:06:58,498 - Received response from OpenAI API: {'id': 'chatcmpl-9Ws8PgceCHrkKCZA8PKp6A8OnItdO', 'object': 'chat.completion', 'created': 1717621617, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "Bed": "Unmade"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 564, 'completion_tokens': 14, 'total_tokens': 578}, 'system_fingerprint': 'fp_aa87380ac5'} 27 | 2024-06-06 09:08:03,239 - Command line arguments: model=gpt-4o, camera=camera.kitchen_camera, prompt=wherearemyglasses, style=BBC, json=False 28 | 2024-06-06 09:08:03,280 - Loaded prompt for wherearemyglasses: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are 29 | 2024-06-06 09:08:03,281 - Loaded style for BBC: Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 30 | 2024-06-06 09:08:04,546 - Combined prompt text: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 31 | 2024-06-06 09:08:04,548 - Sending prompt to OpenAI API: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 32 | 2024-06-06 09:08:08,931 - Received response from OpenAI API: {'id': 'chatcmpl-9Ws9XvCcznsij9ftPq3EIk7DUKYBG', 'object': 'chat.completion', 'created': 1717621687, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': 'In this particular photograph, one can observe a modern kitchen setting. If one directs their attention to the kitchen island in the foreground, positioned centrally, a pair of glasses can be seen resting upon the white countertop, adjacent to a packet of sliced bread and opposite a set of white stools. This should facilitate the retrieval of the aforementioned spectacles.'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 831, 'completion_tokens': 67, 'total_tokens': 898}, 'system_fingerprint': 'fp_aa87380ac5'} 33 | 2024-06-06 09:11:11,032 - Command line arguments: model=gpt-4o, camera=camera.kitchen_camera, prompt=wherearemyglasses, style=Jarvis, json=False 34 | 2024-06-06 09:11:11,072 - Loaded prompt for wherearemyglasses: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are 35 | 2024-06-06 09:11:11,072 - Loaded style for Jarvis: You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 36 | 2024-06-06 09:11:11,923 - Combined prompt text: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 37 | 2024-06-06 09:11:11,927 - Sending prompt to OpenAI API: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 38 | 2024-06-06 09:11:16,836 - Received response from OpenAI API: {'id': 'chatcmpl-9WsCaKUO0GdNM7In6qUBVZrHSZr8i', 'object': 'chat.completion', 'created': 1717621876, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': 'I found your glasses. They are on the kitchen island countertop, near the glass of water and the frying pan.'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 862, 'completion_tokens': 23, 'total_tokens': 885}, 'system_fingerprint': 'fp_aa87380ac5'} 39 | 2024-06-06 09:11:45,707 - Command line arguments: model=gpt-4o, camera=camera.kitchen_camera, prompt=wherearemyglasses, style=Jarvis, json=False 40 | 2024-06-06 09:11:45,749 - Loaded prompt for wherearemyglasses: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are 41 | 2024-06-06 09:11:45,750 - Loaded style for Jarvis: You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 42 | 2024-06-06 09:11:46,640 - Combined prompt text: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 43 | 2024-06-06 09:11:46,643 - Sending prompt to OpenAI API: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 44 | 2024-06-06 09:11:54,180 - Received response from OpenAI API: {'id': 'chatcmpl-9WsDA25KPnqksHtdspRSuQxlWfjnf', 'object': 'chat.completion', 'created': 1717621912, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': "I've scanned the provided image of your kitchen, but I do not see a pair of glasses on the counter or in the immediate surrounding area. Consider checking other rooms or common places where you might lay down your glasses. If there's anything else you need help locating or any other assistance required, feel free to ask!"}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 862, 'completion_tokens': 62, 'total_tokens': 924}, 'system_fingerprint': 'fp_aa87380ac5'} 45 | 2024-06-06 09:12:29,668 - Command line arguments: model=gpt-4o, camera=camera.kitchen_camera, prompt=wherearemyglasses, style=Jarvis, json=False 46 | 2024-06-06 09:12:29,712 - Loaded prompt for wherearemyglasses: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are 47 | 2024-06-06 09:12:29,712 - Loaded style for Jarvis: You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 48 | 2024-06-06 09:12:30,813 - Combined prompt text: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 49 | 2024-06-06 09:12:30,815 - Sending prompt to OpenAI API: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 50 | 2024-06-06 09:12:35,708 - Received response from OpenAI API: {'id': 'chatcmpl-9WsDqP6t3mRNHsWkWT4PTvfaVbqZe', 'object': 'chat.completion', 'created': 1717621954, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': 'I have located what appear to be your glasses in the image. They are on the kitchen countertop, slightly to the left of the sink, near the other items on the counter.\n\nWould you like me to send a notification to your phone or display this information on your wall-mounted tablet in the living room?'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 862, 'completion_tokens': 61, 'total_tokens': 923}, 'system_fingerprint': 'fp_aa87380ac5'} 51 | 2024-06-06 09:13:19,911 - Command line arguments: model=gpt-4o, camera=camera.kitchen_camera, prompt=wherearemyglasses, style=Jarvis, json=False 52 | 2024-06-06 09:13:19,951 - Loaded prompt for wherearemyglasses: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are 53 | 2024-06-06 09:13:19,951 - Loaded style for Jarvis: You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 54 | 2024-06-06 09:13:20,888 - Combined prompt text: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 55 | 2024-06-06 09:13:20,890 - Sending prompt to OpenAI API: Ive lost my glasses - the type you wear on your face, not for drinking out of. Please search for them in this photo, and tell me where they are You are a home AI like Jarvis from the movie Ironman. You run on a home assistant server with access to cameras and entities around the home, and you communicate through smart speakers throughout the house, text message notifications, and a wall mounted tablet dashboard in the living room. 56 | 2024-06-06 09:13:26,553 - Received response from OpenAI API: {'id': 'chatcmpl-9WsEfsnV9AEVLoMAjDsnDdaWFn4F1', 'object': 'chat.completion', 'created': 1717622005, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': 'I see your glasses on the kitchen counter next to the sink. They are to the left of a glass of water.'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 862, 'completion_tokens': 24, 'total_tokens': 886}, 'system_fingerprint': 'fp_aa87380ac5'} 57 | 2024-06-06 09:13:51,138 - Command line arguments: model=gpt-4o, camera=camera.webcam, prompt=bedstatus, style=json, json=True 58 | 2024-06-06 09:13:51,181 - Loaded prompt for bedstatus: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. 59 | 2024-06-06 09:13:51,181 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 60 | 2024-06-06 09:14:00,072 - Sending prompt to OpenAI API: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 61 | 2024-06-06 09:14:02,629 - Received response from OpenAI API: {'id': 'chatcmpl-9WsFGUZ46fK7hqBHiCmjYky5T91qr', 'object': 'chat.completion', 'created': 1717622042, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "Bed": "Unmade"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 564, 'completion_tokens': 14, 'total_tokens': 578}, 'system_fingerprint': 'fp_aa87380ac5'} 62 | 2024-06-06 09:31:01,487 - Command line arguments: model=gpt-4o, camera=camera.webcam, prompt=bedstatus, style=json, json=True 63 | 2024-06-06 09:31:01,526 - Loaded prompt for bedstatus: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. 64 | 2024-06-06 09:31:01,527 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 65 | 2024-06-06 09:31:10,378 - Sending prompt to OpenAI API: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 66 | 2024-06-06 09:31:14,880 - Received response from OpenAI API: {'id': 'chatcmpl-9WsVu8Sau9dWKBcyql2nL5O2iV3Zr', 'object': 'chat.completion', 'created': 1717623074, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "Bed": "Unmade"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 564, 'completion_tokens': 14, 'total_tokens': 578}, 'system_fingerprint': 'fp_aa87380ac5'} 67 | 2024-06-06 09:31:14,885 - Error decoding JSON: Expecting value: line 1 column 1 (char 0) 68 | 2024-06-06 09:47:35,338 - Command line arguments: model=gpt-4o, camera=camera.webcam, prompt=bedstatus, style=json, json=True 69 | 2024-06-06 09:47:35,380 - Loaded prompt for bedstatus: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. 70 | 2024-06-06 09:47:35,381 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 71 | 2024-06-06 09:47:44,536 - Sending prompt to OpenAI API: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 72 | 2024-06-06 09:47:47,181 - Received response from OpenAI API: {'id': 'chatcmpl-9Wslu3mlF8Pdm158ROypc3hkfwYUr', 'object': 'chat.completion', 'created': 1717624066, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "Bed": "Unmade"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 564, 'completion_tokens': 14, 'total_tokens': 578}, 'system_fingerprint': 'fp_aa87380ac5'} 73 | 2024-06-06 09:48:47,733 - Command line arguments: model=gpt-4o, camera=camera.living_room_camera, prompt=lightsensor_livingroom, style=json, json=True 74 | 2024-06-06 09:48:47,774 - Loaded prompt for lightsensor_livingroom: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. 75 | 2024-06-06 09:48:47,775 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 76 | 2024-06-06 09:48:48,039 - Sending prompt to OpenAI API: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 77 | 2024-06-06 09:48:54,253 - Received response from OpenAI API: {'id': 'chatcmpl-9WsmyvHs8l7lgNp1IYteT844QddXg', 'object': 'chat.completion', 'created': 1717624132, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "lightsensor_livingroom.dj_lights": "on",\n "lightsensor_livingroom.ceiling_lights": "on"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 1272, 'completion_tokens': 35, 'total_tokens': 1307}, 'system_fingerprint': 'fp_aa87380ac5'} 78 | 2024-06-06 10:25:50,204 - Command line arguments: model=gpt-4o, camera=camera.living_room_camera, prompt=lightsensor_livingroom, style=json, json=True 79 | 2024-06-06 10:25:50,243 - Loaded prompt for lightsensor_livingroom: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. 80 | 2024-06-06 10:25:50,244 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 81 | 2024-06-06 10:25:50,606 - Sending prompt to OpenAI API: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 82 | 2024-06-06 10:25:55,955 - Received response from OpenAI API: {'id': 'chatcmpl-9WtMoNQzx2WW23fziFyhmm0MA5s4d', 'object': 'chat.completion', 'created': 1717626354, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "lightsensor_livingroom.dj_lights": "on",\n "lightsensor_livingroom.ceiling_lights": "on"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 1272, 'completion_tokens': 35, 'total_tokens': 1307}, 'system_fingerprint': 'fp_aa87380ac5'} 83 | 2024-06-06 10:26:15,220 - Command line arguments: model=gpt-4o, camera=camera.living_room_camera, prompt=lightsensor_livingroom, style=json, json=True 84 | 2024-06-06 10:26:15,260 - Loaded prompt for lightsensor_livingroom: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. 85 | 2024-06-06 10:26:15,260 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 86 | 2024-06-06 10:26:15,627 - Sending prompt to OpenAI API: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 87 | 2024-06-06 10:26:20,892 - Received response from OpenAI API: {'id': 'chatcmpl-9WtNDNkNEj5VrYDxhaKY6xN699q6C', 'object': 'chat.completion', 'created': 1717626379, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "lightsensor_livingroom.dj_lights": "off",\n "lightsensor_livingroom.ceiling_lights": "on"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 1272, 'completion_tokens': 35, 'total_tokens': 1307}, 'system_fingerprint': 'fp_aa87380ac5'} 88 | 2024-06-06 10:26:45,881 - Command line arguments: model=gpt-4o, camera=camera.webcam, prompt=bedstatus, style=json, json=True 89 | 2024-06-06 10:26:45,920 - Loaded prompt for bedstatus: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. 90 | 2024-06-06 10:26:45,920 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 91 | 2024-06-06 10:26:55,905 - Sending prompt to OpenAI API: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 92 | 2024-06-06 10:26:59,186 - Received response from OpenAI API: {'id': 'chatcmpl-9WtNqavXCovwJgLXKENfHInvZ1PVe', 'object': 'chat.completion', 'created': 1717626418, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "Bed": "Unmade"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 564, 'completion_tokens': 14, 'total_tokens': 578}, 'system_fingerprint': 'fp_aa87380ac5'} 93 | 2024-06-06 10:51:08,343 - Command line arguments: model=gpt-4o, camera=camera.living_room_camera, prompt=lightsensor_livingroom, style=json, json=True 94 | 2024-06-06 10:51:08,383 - Loaded prompt for lightsensor_livingroom: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. 95 | 2024-06-06 10:51:08,384 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 96 | 2024-06-06 10:51:08,658 - Sending prompt to OpenAI API: In this picture there are 2 sets of lights. On the roof are the Ceiling Lights, and in the distance on the far wall and the wall to the left are a set of lights named DJ Lights. I want you to determine if the lights are on or off, and return the json response lightsensor_livingroom.dj_lights: on/off and lightsensor_livingroom.ceiling_lights: on/off, choosing on or off depending on what you see. If the lights are on you should be able to see bright spots where I have described, otherwise you should just see the light fixtures. If the screen is completely dark, mark all lights as off. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 97 | 2024-06-06 10:51:14,530 - Received response from OpenAI API: {'id': 'chatcmpl-9WtlJkIe8IblU2pdPhah7L3VPqd7S', 'object': 'chat.completion', 'created': 1717627873, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "lightsensor_livingroom.dj_lights": "on",\n "lightsensor_livingroom.ceiling_lights": "off"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 1272, 'completion_tokens': 35, 'total_tokens': 1307}, 'system_fingerprint': 'fp_aa87380ac5'} 98 | 2024-06-06 11:15:07,522 - Command line arguments: model=gpt-4o, camera=camera.webcam, prompt=bedstatus, style=json, json=True 99 | 2024-06-06 11:15:07,561 - Loaded prompt for bedstatus: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. 100 | 2024-06-06 11:15:07,562 - Loaded style for json: Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 101 | 2024-06-06 11:15:11,844 - Sending prompt to OpenAI API: I want you to look at this photo and respond with a simple response as follows. If the bed is unoccupied, decide if the bed is 'Made', 'Unmade', or 'Badly Made' and return one of these options as your response. If there is a person present, you should analyze what the person is doing, and respond with - Person Reading, Person using Devices, Person watching TV, Person Sleeping. Remember, just a 1-3 word response, exactly as I've described, with no additional text. Remember, the response should be in simple json with no other comments whatsoever. Entities should be listed with their state as described. 102 | 2024-06-06 11:15:15,061 - Received response from OpenAI API: {'id': 'chatcmpl-9Wu8YECQAYZnuT9BRhPA8Zsp6lTH7', 'object': 'chat.completion', 'created': 1717629314, 'model': 'gpt-4o-2024-05-13', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': '```json\n{\n "Bed": "Made"\n}\n```'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 564, 'completion_tokens': 13, 'total_tokens': 577}, 'system_fingerprint': 'fp_aa87380ac5'} 103 | 2024-06-07 09:49:59,548 - Command line arguments: model=gpt-4-2024-04-09, camera=camera.webcam, prompt=Weather, style=BBC, json=False 104 | 2024-06-07 09:49:59,588 - Loaded prompt for Weather: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. 105 | 2024-06-07 09:49:59,588 - Loaded style for BBC: Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 106 | 2024-06-07 09:50:08,612 - Combined prompt text: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 107 | 2024-06-07 09:50:08,614 - Sending prompt to OpenAI API: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 108 | 2024-06-07 09:50:48,820 - Command line arguments: model=gpt-4-1106-vision-preview, camera=camera.webcam, prompt=Weather, style=BBC, json=False 109 | 2024-06-07 09:50:48,857 - Loaded prompt for Weather: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. 110 | 2024-06-07 09:50:48,857 - Loaded style for BBC: Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 111 | 2024-06-07 09:50:50,285 - Combined prompt text: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 112 | 2024-06-07 09:50:50,287 - Sending prompt to OpenAI API: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 113 | 2024-06-07 09:50:54,237 - Received response from OpenAI API: {'id': 'chatcmpl-9XFIRwqDuRJf2hKN7U47LDmkTlGRA', 'object': 'chat.completion', 'created': 1717710651, 'model': 'gpt-4-1106-vision-preview', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': 'Good morning, viewers. Currently, we are seeing partly sunny skies with moderate clouds, indicating fair weather. As the day progresses, we expect these conditions to continue, potentially leading to a lovely afternoon with a gentle chance of increased cloud cover towards the evening. Stay tuned for further updates as the day unfolds.'}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 510, 'completion_tokens': 61, 'total_tokens': 571}, 'system_fingerprint': None} 114 | 2024-06-07 09:51:22,933 - Command line arguments: model=gpt-4-2024-05-13, camera=camera.webcam, prompt=Weather, style=BBC, json=False 115 | 2024-06-07 09:51:22,970 - Loaded prompt for Weather: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. 116 | 2024-06-07 09:51:22,970 - Loaded style for BBC: Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 117 | 2024-06-07 09:51:23,607 - Combined prompt text: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 118 | 2024-06-07 09:51:23,609 - Sending prompt to OpenAI API: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 119 | 2024-06-07 09:51:49,413 - Command line arguments: model=gpt-4-turbo, camera=camera.webcam, prompt=Weather, style=BBC, json=False 120 | 2024-06-07 09:51:49,453 - Loaded prompt for Weather: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. 121 | 2024-06-07 09:51:49,453 - Loaded style for BBC: Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 122 | 2024-06-07 09:51:52,740 - Combined prompt text: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 123 | 2024-06-07 09:51:52,742 - Sending prompt to OpenAI API: I want you to look at the weather in this picture, and summarise the current conditions, to create a short weather report including a prediction of the weather in the next hours. Make the output in a single line of text with no carriage returns or unusual characters. Your response will be read aloud, so it should be written in the style of a BBC Presenter, very formal and correct. 124 | 2024-06-07 09:51:58,796 - Received response from OpenAI API: {'id': 'chatcmpl-9XFJTRATb1LVyxFu6W6hoS3Va4q1P', 'object': 'chat.completion', 'created': 1717710715, 'model': 'gpt-4-turbo-2024-04-09', 'choices': [{'index': 0, 'message': {'role': 'assistant', 'content': "Good morning, viewers. Currently, we're observing a bright and sunny morning with scattered clouds and a gentle breeze. As the day progresses, expect the sunny conditions to prevail with a slight increase in cloud cover towards the afternoon, maintaining mild temperatures and a picturesque day ahead. Perfect weather for outdoor activities."}, 'logprobs': None, 'finish_reason': 'stop'}], 'usage': {'prompt_tokens': 510, 'completion_tokens': 60, 'total_tokens': 570}, 'system_fingerprint': 'fp_9b82693875'} 125 | --------------------------------------------------------------------------------