const.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. """Constants for the Solar of Things integration."""
  2. DOMAIN = "solar_of_things"
  3. # Configuration keys
  4. CONF_IOT_TOKEN = "iot_token"
  5. CONF_STATION_ID = "station_id"
  6. CONF_DEVICE_ID = "device_id"
  7. CONF_TIME_ZONE = "time_zone"
  8. # API endpoints
  9. API_BASE_URL = "https://solar.siseli.com"
  10. # Endpoints based on the working reference client
  11. # https://github.com/Hyllesen/solar-of-things-solar-usage
  12. API_TIME_SERIES = "/apis/deviceState/simple/attribute/keys/history/v1"
  13. API_MONTHLY_SUMMARY = "/apis/stationOverView/stateAttributeSummary/category/yearly"
  14. API_SETTINGS_GET = "/api/device/settings/v1"
  15. API_SETTINGS_SET = "/api/device/settings/update/v1"
  16. # Station -> devices
  17. API_DEVICE_LIST = "/apis/device/list"
  18. # Sensor keys
  19. SENSOR_KEYS = [
  20. "pvInputPower",
  21. "acOutputActivePower",
  22. "batteryDischargeCurrent",
  23. "batteryChargingCurrent",
  24. "batteryVoltage",
  25. "feedInPower",
  26. "batteryPower",
  27. "batterySOC",
  28. "gridPower",
  29. "loadPower",
  30. ]
  31. # Sensor names and units
  32. SENSOR_DEFINITIONS = {
  33. "pvInputPower": {
  34. "name": "PV Input Power",
  35. "unit": "W",
  36. "device_class": "power",
  37. "icon": "mdi:solar-power",
  38. },
  39. "acOutputActivePower": {
  40. "name": "AC Output Power",
  41. "unit": "W",
  42. "device_class": "power",
  43. "icon": "mdi:power-plug",
  44. },
  45. "batteryDischargeCurrent": {
  46. "name": "Battery Discharge Current",
  47. "unit": "A",
  48. "device_class": "current",
  49. "icon": "mdi:battery-arrow-down",
  50. },
  51. "batteryChargingCurrent": {
  52. "name": "Battery Charging Current",
  53. "unit": "A",
  54. "device_class": "current",
  55. "icon": "mdi:battery-arrow-up",
  56. },
  57. "batteryVoltage": {
  58. "name": "Battery Voltage",
  59. "unit": "V",
  60. "device_class": "voltage",
  61. "icon": "mdi:battery",
  62. },
  63. "batteryPower": {
  64. "name": "Battery Power",
  65. "unit": "W",
  66. "device_class": "power",
  67. "icon": "mdi:battery-charging",
  68. },
  69. "batterySOC": {
  70. "name": "Battery State of Charge",
  71. "unit": "%",
  72. "device_class": "battery",
  73. "icon": "mdi:battery",
  74. },
  75. "feedInPower": {
  76. "name": "Grid Feed-in Power",
  77. "unit": "W",
  78. "device_class": "power",
  79. "icon": "mdi:transmission-tower-export",
  80. },
  81. "gridPower": {
  82. "name": "Grid Import Power",
  83. "unit": "W",
  84. "device_class": "power",
  85. "icon": "mdi:transmission-tower-import",
  86. },
  87. "loadPower": {
  88. "name": "Load Power",
  89. "unit": "W",
  90. "device_class": "power",
  91. "icon": "mdi:home-lightning-bolt",
  92. },
  93. # Monthly summary sensors
  94. "monthly_pv_generated": {
  95. "name": "Monthly PV Generated",
  96. "unit": "kWh",
  97. "device_class": "energy",
  98. "icon": "mdi:solar-power",
  99. },
  100. "monthly_grid_import": {
  101. "name": "Monthly Grid Import",
  102. "unit": "kWh",
  103. "device_class": "energy",
  104. "icon": "mdi:transmission-tower-import",
  105. },
  106. "monthly_total_consumption": {
  107. "name": "Monthly Total Consumption",
  108. "unit": "kWh",
  109. "device_class": "energy",
  110. "icon": "mdi:home-lightning-bolt",
  111. },
  112. "monthly_solar_percentage": {
  113. "name": "Monthly Solar Coverage",
  114. "unit": "%",
  115. "icon": "mdi:percent",
  116. },
  117. }