Skip to content

Commit

Permalink
Version 22
Browse files Browse the repository at this point in the history
  • Loading branch information
Leighm0 committed Oct 15, 2024
1 parent de99b2a commit 20ffee8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ Current Grid Status. (closed/opened)

- **v21**
- Bug fix for Enpower nil error, Thanks to RollyandSam.

- **v22**
- Fixes for Auth flow.

## Compiled Driver Available from Releases:
https://github.com/Leighm0/enphase_gateway/releases
Expand Down
13 changes: 13 additions & 0 deletions driver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,19 @@ end

function GetProductionData()
if (gNeedAuth == true) and (gAuth == false) then
gAuthToken = nil
CreateAuth()
return
end
if (gNeedAuth == true) and (gAuth == true) then
if (gAuthToken == nil) then
dbg("GetProductionData(): No Auth Token yet, not continuing.")
gAuth = false
return
elseif (type(gAuthToken) ~= "string") then
dbg("GetProductionData(): No Auth Token yet, not continuing.")
gAuth = false
gAuthToken = nil
return
else
HEADERS["Authorization"] = "Bearer " .. gAuthToken
Expand All @@ -315,15 +319,19 @@ end

function GetTotals()
if (gNeedAuth == true) and (gAuth == false) then
gAuthToken = nil
CreateAuth()
return
end
if (gNeedAuth == true) and (gAuth == true) then
if (gAuthToken == nil) then
dbg("GetTotals(): No Auth Token yet, not continuing.")
gAuth = false
return
elseif (type(gAuthToken) ~= "string") then
dbg("GetTotals(): No Auth Token yet, not continuing.")
gAuth = false
gAuthToken = nil
return
else
HEADERS["Authorization"] = "Bearer " .. gAuthToken
Expand All @@ -336,15 +344,19 @@ end

function GetGridStatus()
if (gNeedAuth == true) and (gAuth == false) then
gAuthToken = nil
CreateAuth()
return
end
if (gNeedAuth == true) and (gAuth == true) then
if (gAuthToken == nil) then
dbg("GetGridStatus(): No Auth Token yet, not continuing.")
gAuth = false
return
elseif (type(gAuthToken) ~= "string") then
dbg("GetTotals(): No Auth Token yet, not continuing.")
gAuth = false
gAuthToken = nil
return
else
HEADERS["Authorization"] = "Bearer " .. gAuthToken
Expand Down Expand Up @@ -440,6 +452,7 @@ function GetDataResponse(strError, responseCode, tHeaders, data, context, url)
dbg("GetDataResponse: " .. context.data_type .. " Error 400.")
elseif (responseCode == 401) then
dbg("GetDataResponse: " .. context.data_type .. " Error 401.")
gAuth = false
gAuthToken = nil
CreateAuth()
elseif (responseCode == 404) then
Expand Down
4 changes: 2 additions & 2 deletions driver.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<name>Enphase Gateway</name>
<model>IQ/Envoy S Metered Gateways</model>
<created>11/3/2023 12:00 AM</created>
<modified>8/15/2024 12:00 AM</modified>
<version>21</version>
<modified>10/15/2024 12:00 AM</modified>
<version>22</version>
<control>lua_gen</control>
<driver>DriverWorks</driver>
<large image_source="c4z">icons\device_lg.png</large>
Expand Down
5 changes: 4 additions & 1 deletion www/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,7 @@ Current Grid Status. (closed/opened)
- 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.
- Bug fix for Enpower nil error, Thanks to RollyandSam.

- **v22**
- Fixes for Auth flow.

0 comments on commit 20ffee8

Please sign in to comment.