Add Tasmota timezone handling and dashboard updates
This commit is contained in:
@@ -85,6 +85,29 @@ func TestParseTasmotaFixtures(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseTasmotaInLocationUsesConfiguredTimezoneForTimezoneLessTime(t *testing.T) {
|
||||
location := time.FixedZone("CET", 3600)
|
||||
receivedAt := time.Date(2026, time.March, 16, 11, 55, 30, 0, time.UTC)
|
||||
|
||||
records, err := ParseTasmotaInLocation(model.RawMessage{
|
||||
Topic: "tele/tasmota_67850B/SENSOR",
|
||||
Payload: []byte(`{"Time":"2026-03-16T11:55:29","ENERGY":{"Power":9}}`),
|
||||
ReceivedAt: receivedAt,
|
||||
}, location)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseTasmotaInLocation returned error: %v", err)
|
||||
}
|
||||
|
||||
if len(records) != 1 {
|
||||
t.Fatalf("expected 1 record, got %d", len(records))
|
||||
}
|
||||
|
||||
want := time.Date(2026, time.March, 16, 10, 55, 29, 0, time.UTC)
|
||||
if !records[0].Timestamp.Equal(want) {
|
||||
t.Fatalf("unexpected timestamp: got %s want %s", records[0].Timestamp.Format(time.RFC3339), want.Format(time.RFC3339))
|
||||
}
|
||||
}
|
||||
|
||||
func fieldEquals(got any, want any) bool {
|
||||
switch typedWant := want.(type) {
|
||||
case float64:
|
||||
|
||||
Reference in New Issue
Block a user