Skip to content

Commit 4e523b5

Browse files
committed
Updated home-assistant
1 parent 2dd9355 commit 4e523b5

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

pkg/homeassistant/states.go

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ type State struct {
1919
}
2020

2121
type Sensor struct {
22-
Type string `json:"type"`
23-
Entity string `json:"entity_id"`
24-
Name string `json:"friendly_name"`
25-
Value string `json:"state,omitempty"`
26-
Unit string `json:"unit_of_measurement,omitempty"`
27-
Class string `json:"device_class,omitempty"`
28-
LastChanged time.Time `json:"last_changed"`
22+
Type string `json:"type"`
23+
Entity string `json:"entity_id"`
24+
Name string `json:"friendly_name"`
25+
Value string `json:"state,omitempty"`
26+
Unit string `json:"unit_of_measurement,omitempty"`
27+
Class string `json:"device_class,omitempty"`
2928
}
3029

3130
///////////////////////////////////////////////////////////////////////////////
@@ -60,13 +59,12 @@ func (c *Client) Sensors() ([]Sensor, error) {
6059
continue
6160
}
6261
sensors = append(sensors, Sensor{
63-
Type: "sensor",
64-
Entity: state.Entity,
65-
Name: state.Name(),
66-
Value: state.State,
67-
Unit: state.UnitOfMeasurement(),
68-
Class: state.DeviceClass(),
69-
LastChanged: state.LastChanged,
62+
Type: "sensor",
63+
Entity: state.Entity,
64+
Name: state.Name(),
65+
Value: state.State,
66+
Unit: state.UnitOfMeasurement(),
67+
Class: state.DeviceClass(),
7068
})
7169
}
7270

@@ -90,12 +88,11 @@ func (c *Client) Actuators() ([]Sensor, error) {
9088
continue
9189
}
9290
sensors = append(sensors, Sensor{
93-
Type: "actuator",
94-
Entity: state.Entity,
95-
Name: state.Name(),
96-
Value: state.State,
97-
Class: state.DeviceClass(),
98-
LastChanged: state.LastChanged,
91+
Type: "actuator",
92+
Entity: state.Entity,
93+
Name: state.Name(),
94+
Value: state.State,
95+
Class: state.DeviceClass(),
9996
})
10097
}
10198

@@ -119,11 +116,10 @@ func (c *Client) Lights() ([]Sensor, error) {
119116
continue
120117
}
121118
lights = append(lights, Sensor{
122-
Type: "light",
123-
Entity: state.Entity,
124-
Name: state.Name(),
125-
Value: state.State,
126-
LastChanged: state.LastChanged,
119+
Type: "light",
120+
Entity: state.Entity,
121+
Name: state.Name(),
122+
Value: state.State,
127123
})
128124
}
129125

0 commit comments

Comments
 (0)