forked from massivebox/ecodash
Fixes
This commit is contained in:
parent
45ad55a648
commit
066e210d8a
|
@ -21,6 +21,6 @@ WORKDIR /app
|
||||||
|
|
||||||
COPY --from=1 /app/app .
|
COPY --from=1 /app/app .
|
||||||
COPY ./templates /app/templates
|
COPY ./templates /app/templates
|
||||||
RUN touch config.json
|
RUN touch config.json database.db
|
||||||
|
|
||||||
CMD ["./app"]
|
CMD ["./app"]
|
|
@ -27,7 +27,8 @@ func dayStart(t time.Time) time.Time {
|
||||||
var errNon200 = errors.New("got a non-200 status code. Check the correctness of sensors IDs")
|
var errNon200 = errors.New("got a non-200 status code. Check the correctness of sensors IDs")
|
||||||
|
|
||||||
func (config *Config) queryHistory(entityID string, startTime, endTime time.Time) (HistoryResult, error) {
|
func (config *Config) queryHistory(entityID string, startTime, endTime time.Time) (HistoryResult, error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
|
defer cancel()
|
||||||
req, err := http.NewRequestWithContext(
|
req, err := http.NewRequestWithContext(
|
||||||
ctx,
|
ctx,
|
||||||
http.MethodGet,
|
http.MethodGet,
|
||||||
|
@ -40,7 +41,6 @@ func (config *Config) queryHistory(entityID string, startTime, endTime time.Time
|
||||||
),
|
),
|
||||||
http.NoBody,
|
http.NoBody,
|
||||||
)
|
)
|
||||||
cancel()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return HistoryResult{}, err
|
return HistoryResult{}, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<h3>HomeAssistant</h3>
|
<h3>HomeAssistant</h3>
|
||||||
<label>HomeAssistant's base URL <input type="text" name="base_url" value="{{.Config.HomeAssistant.BaseURL}}" required></label>
|
<label>HomeAssistant's base URL <input type="text" name="base_url" value="{{.Config.HomeAssistant.BaseURL}}" required></label>
|
||||||
<label>HomeAssistant's API Key <input type="text" name="api_key" value="{{.Config.HomeAssistant.ApiKey}}" required></label>
|
<label>HomeAssistant's API Key <input type="text" name="api_key" value="{{.Config.HomeAssistant.APIKey}}" required></label>
|
||||||
<lablel>Installation date<input type="date" name="installation_date" value="{{HTMLDateFormat .Config.HomeAssistant.InstallationDate}}" required></lablel>
|
<lablel>Installation date<input type="date" name="installation_date" value="{{HTMLDateFormat .Config.HomeAssistant.InstallationDate}}" required></lablel>
|
||||||
|
|
||||||
<h3>Sensors</h3>
|
<h3>Sensors</h3>
|
||||||
|
|
Loading…
Reference in a new issue