@@ -309,6 +309,10 @@ def _build_notification_message(notification_format, sensor_data, sensor_mapping
309309 if "water_change_recommendation" in ai_data :
310310 message_parts .append (f"\n 💧 Water Change:\n { ai_data ['water_change_recommendation' ]} " )
311311
312+ # Add camera visual analysis if available
313+ if "camera_visual_notification_analysis" in ai_data :
314+ message_parts .append (f"\n 📷 Camera Analysis:\n { ai_data ['camera_visual_notification_analysis' ]} " )
315+
312316 # Add overall analysis
313317 if "overall_notification_analysis" in ai_data :
314318 message_parts .append (f"\n 🎯 Overall Assessment:\n { ai_data ['overall_notification_analysis' ]} " )
@@ -348,6 +352,10 @@ def _build_notification_message(notification_format, sensor_data, sensor_mapping
348352 if "water_change_recommendation" in ai_data :
349353 message_parts .append (f"\n 💧 Water Change: { ai_data ['water_change_recommendation' ]} " )
350354
355+ # Add camera visual analysis if available (brief version for condensed)
356+ if "camera_visual_analysis" in ai_data :
357+ message_parts .append (f"\n 📷 Camera Analysis: { ai_data ['camera_visual_analysis' ]} " )
358+
351359 # Add overall brief analysis (same as used for sensors)
352360 if "overall_analysis" in ai_data :
353361 message_parts .append (f"\n 🎯 Overall Assessment: { ai_data ['overall_analysis' ]} " )
@@ -387,6 +395,10 @@ def _build_notification_message(notification_format, sensor_data, sensor_mapping
387395 if "water_change_recommendation" in ai_data :
388396 message_parts .append (f"\n 💧 Water Change:\n { ai_data ['water_change_recommendation' ]} " )
389397
398+ # Add camera visual analysis if available (detailed version)
399+ if "camera_visual_notification_analysis" in ai_data :
400+ message_parts .append (f"\n 📷 Camera Analysis:\n { ai_data ['camera_visual_notification_analysis' ]} " )
401+
390402 # Add overall detailed analysis
391403 if "overall_notification_analysis" in ai_data :
392404 message_parts .append (f"\n 🎯 Overall Assessment:\n { ai_data ['overall_notification_analysis' ]} " )
@@ -521,6 +533,18 @@ async def send_ai_aquarium_analysis(now):
521533 # Prepare camera instructions if camera is configured
522534 camera_instructions = ""
523535 if camera :
536+ # Add camera analysis fields to the structure
537+ combined_analysis_structure ["camera_visual_analysis" ] = {
538+ "description" : "Brief 1-2 sentence visual analysis of the aquarium from the camera image (under 200 characters). Focus on water clarity, fish/plant health, and any maintenance needs visible." ,
539+ "required" : True ,
540+ "selector" : {"text" : None }
541+ }
542+ combined_analysis_structure ["camera_visual_notification_analysis" ] = {
543+ "description" : "Detailed visual analysis of the aquarium from the camera image. Include observations about water clarity, fish identification and behavior, plant health, equipment condition, and any visible maintenance needs. Provide specific observations and recommendations based on what is visible in the image." ,
544+ "required" : True ,
545+ "selector" : {"text" : None }
546+ }
547+
524548 camera_instructions = """
525549
526550If an aquarium camera image is provided:
@@ -533,7 +557,10 @@ async def send_ai_aquarium_analysis(now):
533557 * Any visible algae, debris, or maintenance needs
534558- Focus only on aquarium-related observations that can be determined visually
535559- Do not attempt to provide numerical measurements from the image
536- - Integrate visual observations with sensor data when drawing conclusions"""
560+ - Integrate visual observations with sensor data when drawing conclusions
561+
562+ For camera_visual_analysis: Provide a brief 1-2 sentence summary of visual observations (under 200 characters).
563+ For camera_visual_notification_analysis: Provide detailed visual analysis with specific observations and recommendations."""
537564
538565 # Prepare AI Task data with separate instructions for sensor vs notification analysis
539566 ai_task_data = {
@@ -658,6 +685,13 @@ async def send_ai_aquarium_analysis(now):
658685 water_change_rec = water_change_rec [:252 ] + "..."
659686 sensor_analysis_data ["water_change_recommended" ] = water_change_rec
660687
688+ # Store camera visual analysis with brief version for sensors (if camera configured)
689+ if "camera_visual_analysis" in ai_data :
690+ camera_analysis = ai_data ["camera_visual_analysis" ]
691+ if len (camera_analysis ) > 255 :
692+ camera_analysis = camera_analysis [:252 ] + "..."
693+ sensor_analysis_data ["camera_visual_analysis" ] = camera_analysis
694+
661695 # Store the analysis data and sensor data in hass.data for sensors to access
662696 hass .data [DOMAIN ][entry .entry_id ]["sensor_analysis" ] = sensor_analysis_data
663697 hass .data [DOMAIN ][entry .entry_id ]["sensor_data" ] = sensor_data
0 commit comments