name: {{name}}
description: {{description}}
version: {% if version is defined and version|length %} {{version}} {% elif BuildID is defined and BuildID|length %} {{AppVersion}}-{{BuildID}} {% else %} {{AppVersion}} {% endif %}
image: {{image}}
url: https://github.com/s-allius/tsun-gen3-proxy
slug: {{slug}}
advanced: {{advanced}}
stage: {{stage}}
init: false
arch:
  - aarch64
  - amd64
  - armhf
  - armv7
startup: services
homeassistant_api: true
map:
  - type: addon_config
    path: /homeassistant/tsun-proxy
    read_only: False
services:
  - mqtt:want
ports:
  5005/tcp: 5005
  10000/tcp: 10000
webui: "http://[HOST]:[PORT:8127]/"
watchdog: "http://[HOST]:[PORT:8127]/-/healthy"
ingress: true
ingress_port: 8127
panel_icon: "mdi:application-cog-outline"

# Definition of parameters in the configuration tab of the addon
# parameters are available within the container as /data/options.json
# and should become picked up by the proxy - current workaround as a transfer script

schema:
  inverters:
    - serial: match(^(R17|R47|Y00|Y17|Y47).{13}$)
      monitor_sn: int?
      node_id: str
      suggested_area: str
      modbus_polling: bool
      client_mode.host: match(\b((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\b)?
      client_mode.port: port?
      client_mode.forward: bool?
      modbus_scanning.start: int(0,65535)?
      modbus_scanning.step: int(0,65535)?
      modbus_scanning.bytes: int(1,80)?
      pv1.manufacturer: str?
      pv1.type: str?
      pv2.manufacturer: str?
      pv2.type: str?
      pv3.manufacturer: str?
      pv3.type: str?
      pv4.manufacturer: str?
      pv4.type: str?
      pv5.manufacturer: str?
      pv5.type: str?
      pv6.manufacturer: str?
      pv6.type: str?
  tsun.enabled: bool
  solarman.enabled: bool
  inverters.allow_all: bool
  batteries:
    - serial: match(^(410).{13}$)
      monitor_sn: int
      node_id: str
      suggested_area: str
      modbus_polling: bool
      client_mode.host: match(\b((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\b)?
      client_mode.port: port?
      client_mode.forward: bool?
      pv1.manufacturer: str?
      pv1.type: str?
      pv2.manufacturer: str?
      pv2.type: str?

  # optionale parameter

  mqtt.host: str?
  mqtt.port: port?
  mqtt.user: str?
  mqtt.passwd: password?
  ha.auto_conf_prefix: str? # suggeriert optionale konfigurationsoption -> es darf jedoch kein default unter "options" angegeben werden
  ha.discovery_prefix: str? # dito
  ha.entity_prefix: str? #dito
  ha.proxy_node_id: str? #dito
  ha.proxy_unique_id: str? #dito
  tsun.host: str?
  solarman.host: str?
  gen3plus.at_acl.tsun.allow:
    - str
  gen3plus.at_acl.tsun.block:
    - str?
  gen3plus.at_acl.mqtt.allow:
    - str
  gen3plus.at_acl.mqtt.block:
    - str?

# set default options for mandatory parameters
# for optional parameters do not define any default value in the options dictionary.
# If any default value is given, the option becomes a required value.
options:
  inverters:
    - serial: R17E000000000000
      monitor_sn: 0
      node_id: inv_1
      suggested_area: Roof
      modbus_polling: false
      pv1.manufacturer: Shinefar
      pv1.type: SF-M18/144550
      pv2.manufacturer: Shinefar
      pv2.type: SF-M18/144550
  batteries:
    - serial: 4100000000000000
      monitor_sn: 0
      node_id: bat_1
      suggested_area: Garage
      modbus_polling: false
      pv1.manufacturer: Shinefar
      pv1.type: SF-M18/144550
      pv2.manufacturer: Shinefar
      pv2.type: SF-M18/144550
  tsun.enabled: true # set default
  solarman.enabled: true # set default
  inverters.allow_all: false # set default
  gen3plus.at_acl.tsun.allow: ["AT+Z", "AT+UPURL", "AT+SUPDATE"]
  gen3plus.at_acl.mqtt.allow: ["AT+"]