From de99b2ad314d9310559903a8220e5cf7724c926f Mon Sep 17 00:00:00 2001
From: Leighm0 <69341431+Leighm0@users.noreply.github.com>
Date: Thu, 15 Aug 2024 17:15:49 +0800
Subject: [PATCH] v21
Bug fix for Enpower nil error, Thanks to RollyandSam.
---
README.md | 3 +++
driver.lua | 8 +++++---
driver.xml | 4 ++--
www/documentation.md | 3 +++
4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index d3f16f7..000bf52 100644
--- a/README.md
+++ b/README.md
@@ -191,6 +191,9 @@ Current Grid Status. (closed/opened)
- **v20**
- Added Discovery Mode (Auto/Manual) for the ability to manually set which Envoy IP to use. (Useful if you run multiple Envoy Gateways)
+- **v21**
+ - Bug fix for Enpower nil error, Thanks to RollyandSam.
+
## Compiled Driver Available from Releases:
https://github.com/Leighm0/enphase_gateway/releases
diff --git a/driver.lua b/driver.lua
index 4634fb5..3040d18 100644
--- a/driver.lua
+++ b/driver.lua
@@ -430,9 +430,11 @@ function GetDataResponse(strError, responseCode, tHeaders, data, context, url)
ENPHASE.DailyProduction(production_today)
ENPHASE.DailyConsumption(consumption_today)
elseif (context["data_type"] == "grid-status") then
- local enpower_connected = data["enpower"]["connected"]
- local grid_status = data["enpower"]["grid_status"]
- ENPHASE.GridStatus(enpower_connected, grid_status)
+ if (data["enpower"]) then
+ local enpower_connected = data["enpower"]["connected"]
+ local grid_status = data["enpower"]["grid_status"]
+ ENPHASE.GridStatus(enpower_connected, grid_status)
+ end
end
elseif (responseCode == 400) then
dbg("GetDataResponse: " .. context.data_type .. " Error 400.")
diff --git a/driver.xml b/driver.xml
index e70f45d..bc7ca12 100644
--- a/driver.xml
+++ b/driver.xml
@@ -5,8 +5,8 @@
Enphase Gateway
IQ/Envoy S Metered Gateways
11/3/2023 12:00 AM
- 2/14/2024 12:00 AM
- 20
+ 8/15/2024 12:00 AM
+ 21
lua_gen
DriverWorks
icons\device_lg.png
diff --git a/www/documentation.md b/www/documentation.md
index 3877d22..5920b70 100644
--- a/www/documentation.md
+++ b/www/documentation.md
@@ -187,3 +187,6 @@ Current Grid Status. (closed/opened)
- **v20**
- Added Discovery Mode (Auto/Manual) for the ability to manually set which Envoy IP to use. (Useful if you run multiple Envoy Gateways)
+
+- **v21**
+ - Bug fix for Enpower nil error, Thanks to RollyandSam.
\ No newline at end of file