sebr / bhyve-home-assistant

Orbit BHyve custom component for Home Assistant
MIT License
251 stars 42 forks source link

Zone switch: Incorrect program attribute reported as enabled for program(s) enabled only for other zones. #244

Closed andrus2049 closed 3 months ago

andrus2049 commented 3 months ago

Latest HA version and latest bhyve-home-assistant integration.

Problem:

When having different programs (a, b and c) enabled for each zone, a switch. zonename _zone reports a program as 'enabled': true even if it's actually used only for another zone.

Example: zone1: uses program_c only zone2: uses program_a only

switch.zone1_zone for attribute _programa returns: {'enabled': True, 'name': 'my_program_A', 'is_smart_program': False} even if _programa is not enabled for that zone1. Here _programa 'enabled' should be reported as false for this zone.

Similarly, switch.zone2_zone for attribute _programc returns: {'enabled': True, 'name': 'my_program_C', 'is_smart_program': False} even if _programc is not enabled for that zone2. Here _programc 'enabled' should be reported as false for this zone.

sebr commented 3 months ago

Please upload your device diagnostics and reopen the issue when you have done so, thanks.

andrus2049 commented 3 months ago
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.4.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Rome",
    "os_name": "Linux",
    "os_version": "6.1.73-haos-raspi",
    "supervisor": "2024.05.1",
    "host_os": "Home Assistant OS 12.2",
    "docker_version": "25.0.5",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "bhyve": {
      "version": "3.2.4",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "bhyve",
    "name": "Orbit B-hyve",
    "codeowners": [
      "@sebr"
    ],
    "config_flow": true,
    "dependencies": [],
    "documentation": "https://github.com/sebr/bhyve-home-assistant/blob/main/README.md",
    "iot_class": "cloud_push",
    "requirements": [],
    "version": "3.2.4",
    "is_built_in": false
  },
  "data": {
    "devices": [
      {
        "last_connected_at": "2024-05-26T10:04:00.728Z",
        "address": "**REDACTED**",
        "water_sense_mode": "auto",
        "timezone": {
          "dst_offset": 3600,
          "raw_offset": 3600,
          "timezone_id": "Europe/Rome",
          "timezone_name": "Central European Summer Time"
        },
        "full_location": "**REDACTED**",
        "weather_forecast_location_id": "**REDACTED**",
        "firmware_version": "0087",
        "name": "Timer esterno intelligente",
        "type": "sprinkler_timer",
        "restricted_frequency": {
          "restricted_times": []
        },
        "updated_at": "2024-05-26T10:34:46.315Z",
        "reference": "446755a26e92",
        "mac_address": "446755a26e92",
        "weather_station_id": "**REDACTED**",
        "status": {
          "run_mode": "auto",
          "next_start_programs": [],
          "rain_delay_overridden_at": "2024-02-27T11:39:25.697Z",
          "watering_status": {
            "clear_on_idle": true
          },
          "flow_sensor": null,
          "next_start_time": "1970-01-01T01:59:59+02:00",
          "watering-status": null
        },
        "wifi_version": 0,
        "id": "64d3bbf2418fe72ce32ae48b",
        "num_stations": 12,
        "zones": [
          {
            "station": 1,
            "name": "Lato",
            "num_sprinklers": 0,
            "catch_cup_volumes": [],
            "catch_cup_run_time": 0,
            "smart_watering_enabled": false
          },
          {
            "station": 2,
            "name": "Fronte",
            "num_sprinklers": 0,
            "catch_cup_volumes": [],
            "catch_cup_run_time": 0,
            "smart_watering_enabled": false
          }
        ],
        "user_id": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
        "google_home_status": null,
        "device_gateway_topic": "devices-9",
        "smart_watering_enabled": true,
        "hardware_version": "WT25E-0001",
        "is_connected": true,
        "location": "**REDACTED**",
        "created_at": "2023-08-09T16:16:50.336Z",
        "suggested_start_time": null,
        "et_id": "5644ff26ad27a7777ff92b4e",
        "network_topology_id": "64d3bbf3418fe72ce32ae48d"
      }
    ],
    "programs": [
      {
        "name": "A giorni alterni",
        "program_start_date": "2024-05-10T22:00:00.000Z",
        "frequency": {
          "type": "interval",
          "interval": 2,
          "interval_start_time": "2024-05-26T00:00:00.000Z"
        },
        "program_end_date": null,
        "updated_at": "2024-05-26T10:34:46.314Z",
        "updated_via": "wifi",
        "start_times": [
          "03:00"
        ],
        "id": "663e2f14a45f554813302341",
        "budget": 100,
        "device_id": "64d3bbf2418fe72ce32ae48b",
        "program": "c",
        "run_times": [
          {
            "run_time": 15,
            "station": 2
          }
        ],
        "enabled": true,
        "created_at": "2024-05-10T14:28:36.373Z"
      },
      {
        "name": "Giorni dispari",
        "frequency": {
          "type": "odd"
        },
        "updated_at": "2024-05-26T10:34:46.316Z",
        "updated_via": "wifi",
        "start_times": [
          "06:05"
        ],
        "id": "66432ae494569a32f0cdba40",
        "budget": 100,
        "device_id": "64d3bbf2418fe72ce32ae48b",
        "program": "b",
        "run_times": [
          {
            "run_time": 10,
            "station": 1
          }
        ],
        "enabled": true,
        "created_at": "2024-05-14T09:12:04.012Z"
      }
    ]
  }
}

From Developers Tool:

switch.lato_zone

device_name: Timer esterno intelligente
device_id: xxxxxxxxxxxxxxxxxxxxxxx
zone_name: Lato
station: 1
smart_watering_enabled: false
manual_preset_runtime: 300
next_start_time: "1970-01-01T00:59:59+01:00"
next_start_programs: []
program_a:
  enabled: false
  name: Giornaliero
  is_smart_program: false
program_b:
  enabled: true
  name: Giorni dispari
  is_smart_program: false
  start_times:
    - "06:05"
  frequency:
    type: odd
  run_times:
    - run_time: 10
      station: 1
program_c:
  enabled: true
  name: A giorni alterni
  is_smart_program: false
current_station: null
current_program: null
current_runtime: null
started_watering_station_at: null
device_class: switch
icon: mdi:sprinkler
friendly_name: Lato

switch.fronte_zone

device_name: Timer esterno intelligente
device_id: xxxxxxxxxxxxxxxxxxxxxx
zone_name: Fronte
station: 2
smart_watering_enabled: false
manual_preset_runtime: 300
next_start_time: "1970-01-01T00:59:59+01:00"
next_start_programs: []
program_a:
  enabled: false
  name: Giornaliero
  is_smart_program: false
program_b:
  enabled: true
  name: Giorni dispari
  is_smart_program: false
program_c:
  enabled: true
  name: A giorni alterni
  is_smart_program: false
  start_times:
    - "03:00"
  frequency:
    type: interval
    interval: 2
    interval_start_time: "2024-05-26T00:00:00.000Z"
  run_times:
    - run_time: 15
      station: 2
current_station: null
current_program: null
current_runtime: null
started_watering_station_at: null
device_class: switch
icon: mdi:sprinkler
friendly_name: Fronte