Skip to content

Commit

Permalink
Restore current weather date
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed Dec 6, 2024
1 parent c620fda commit f2a0d29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion extensions/owm/owm.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ define(['./owm.xml'], function(owmTemplate) {
//console.info('units:', this.unit);
}
var props = properties[thing.thingId];
if (props && thing.properties.date) {
if (props && thing.properties.rain) {
var t = props.date ? new Date(props.date).getTime() : 0;
var h = t > now ? Math.floor((t - now) / 3600000) : 0;
var item = Object.assign({
Expand Down
18 changes: 9 additions & 9 deletions extensions/owm/owm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ local function createWeatherThing(title, description)
readOnly = true,
unit = 'degree'
})
thing:addProperty('date', {
['@type'] = "DateTimeProperty",
configuration = true,
description = "The date of the data",
readOnly = true,
title = "Date",
type = "string",
unit = "date time"
})
return thing
end

Expand All @@ -63,15 +72,6 @@ local function createForecastThing(title, description)
readOnly = true,
unit = 'mm'
})
thing:addProperty('date', {
['@type'] = "DateTimeProperty",
configuration = true,
description = "The date of the data",
readOnly = true,
title = "Date",
type = "string",
unit = "date time"
})
return thing
end

Expand Down

0 comments on commit f2a0d29

Please sign in to comment.