Skip to content

Commit

Permalink
Reduced error log output. If "debug" is not set on the plugin, only n…
Browse files Browse the repository at this point in the history
…ew error states will be logged, Minor changes
  • Loading branch information
mwittig committed May 26, 2015
1 parent 64ceca4 commit 5e32330
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,7 @@ History
* Added support for xLink and xAttributeOptions as part of the device configuration
* Fixed some typos, added version badge, added screenshots
* 20150509, V0.0.7
* Bug fix: destroy socket on error to release socket descriptor
* Bug fix: destroy socket on error to release socket descriptor
* 20150526, V0.0.8
* Reduced error log output. If "debug" is not set on the plugin, only new error states will be logged
* Minor changes
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@
"name": "Marcus Wittig",
"url": "https://github.com/mwittig/pimatic-solarview"
},
"contributors": [
{
"name": "Marcus Wittig",
"url": "https://github.com/mwittig"
}
],
"main": "solarview",
"files": [
"screenshots/solarview-screenshot1.png",
"screenshots/solarview-screenshot2.png",
"solarview.coffee",
"README.md",
"solarview-config-schema.coffee",
"device-config-schema.coffee",
"LICENSE"
],
"version": "0.0.7",
"version": "0.0.8",
"homepage": "https://github.com/mwittig/pimatic-solarview",
"keywords": [
"pimatic",
Expand Down
10 changes: 7 additions & 3 deletions solarview.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = (env) ->
@interval = 1000 * (config.interval or plugin.config.interval)
@inverterId = config.inverterId
@debug = plugin.config.debug;
@_lastError = ""
super()

# keep updating
Expand All @@ -81,16 +82,19 @@ module.exports = (env) ->
values = rawData.split ","

if values.length >= 20
@_lastError = ""
@emit "solarViewData", values

socket.end()
)

socket.on 'error', (error) ->
if error.code == 'ETIMEDOUT'
env.logger.error("Timeout fetching SolarView data")
newError = "Timeout fetching SolarView data"
else
env.logger.error("Error fetching SolarView data: " + error.toString())
newError = "Error fetching SolarView data: " + error.toString()
env.logger.error newError if @_lastError isnt newError or @debug
@_lastError = newError
socket.destroy()


Expand Down Expand Up @@ -118,7 +122,7 @@ module.exports = (env) ->
unit: 'kWh'
acronym: 'KMT'
energyYear:
description: "Energy Yield if Current Year"
description: "Energy Yield of Current Year"
type: "number"
unit: 'kWh'
acronym: 'KYR'
Expand Down

0 comments on commit 5e32330

Please sign in to comment.