Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
087e530
NewAppFromConfig(): more flexible way to configure an `App`
mhagger Mar 23, 2024
5f407ed
`ctx` should always be a function's first argument
mhagger Mar 29, 2024
f56fee7
Remove some unused `ctx` arguments
mhagger Mar 29, 2024
17fa8bc
Get rid of the `ctx` members in the service subtypes
mhagger Mar 29, 2024
3cb2d8d
newService(): remove the `ctx` argument
mhagger Mar 29, 2024
77effe9
Add a `ctx` argument to functions that set up a websocket connection
mhagger Mar 29, 2024
a11cb4f
App: remove the `ctx` member
mhagger Mar 29, 2024
7071b55
runSchedules(): simplify loop code
mhagger Mar 29, 2024
680cf67
runIntervals(): simplify loop code
mhagger Mar 29, 2024
d035b67
runIntervals(), runSchedules(): convert functions in to methods
mhagger Mar 29, 2024
9190da4
Interval, DailySchedule: extract `shouldRun()` methods
mhagger Mar 29, 2024
9261f61
Handle schedules and intervals using shared code
mhagger Mar 29, 2024
803e4ea
Work on cleanup of goroutines
mhagger Mar 29, 2024
2459f0e
Make example compile
mhagger Apr 13, 2024
516b5af
ListenWebsocket(): add comment, tighten signature
mhagger Apr 13, 2024
311327f
Remove unnecessary abbreviation
mhagger Apr 13, 2024
feabb04
WebsocketConn: type renamed from `WebsocketWriter`
mhagger Apr 13, 2024
5aab2a6
WebsocketConn.Close(): new method
mhagger Apr 13, 2024
0a6c6f1
WebsocketConn.WriteMessage(): change receiver name
mhagger Apr 13, 2024
4a31f80
ListenWebsocket(): make a method of `WebsocketConn`
mhagger Apr 13, 2024
8fc04de
App.conn: remove member
mhagger Apr 13, 2024
b57a5c0
WebsocketConn: change how type is constructed
mhagger Apr 13, 2024
6e24f42
WebsocketConn.conn: make member private
mhagger Apr 13, 2024
ed26c0c
websocket.Conn: rename type from `WebsocketConn`
mhagger Apr 13, 2024
a30ad12
Remove some more abbreviations
mhagger Apr 13, 2024
94ccdc4
websocket.Conn: add some methods
mhagger Apr 13, 2024
f866c52
websocket.Conn.Start(): rename method from `ListenWebsocket()`
mhagger Apr 13, 2024
0fd02f8
websocket.Conn: add some more methods
mhagger Apr 13, 2024
059e346
websocket.Conn: introduce a way to subscribe to IDs
mhagger Apr 13, 2024
7bc5ce6
Subscribe to state changed listeners through the new mechanism
mhagger Apr 13, 2024
309efa9
More work on event handling
mhagger Apr 13, 2024
84b0755
Subscribe to event listeners through the new mechanism
mhagger Apr 13, 2024
ef130ce
Rename local `*App` variables to `app`
mhagger Apr 13, 2024
ec5eece
Split up overlong lines
mhagger Apr 13, 2024
c7e894f
Always get the next message ID from `Conn`
mhagger Apr 14, 2024
db5cf90
Get rid of the wacky generic `BuildService()` function
mhagger Apr 14, 2024
c781076
Change how message IDs are allocated and messages are sent
mhagger Apr 14, 2024
b396ae7
Make `serviceData`, where supported, non-optional
mhagger Apr 14, 2024
f5b6f7a
Use more conventional capitalizations (e.g., `Id` → `ID`)
mhagger Apr 14, 2024
d349cd0
Initialize `CallServiceRequest` objects while defining them
mhagger Apr 20, 2024
8e146c1
Remove `types` package
mhagger Apr 20, 2024
4485009
Change `serviceData` types from `map[string]any` to `any`
mhagger Apr 20, 2024
06927b2
SetTemperatureRequest: distinguish between 0°C and "unset"
mhagger Apr 20, 2024
8a89b44
ChanMsg: remove unused field `Success`
mhagger Apr 21, 2024
4a7d8fe
ChanMsg.Raw: change type to `json.RawMessage`
mhagger Apr 21, 2024
be0e941
BaseResultMessage: type renamed from `BaseMessage`
mhagger Apr 21, 2024
1989fa5
BaseMessage: new type, implementing the minimum fields for a message
mhagger Apr 21, 2024
e88d4eb
websocket.Message: type renamed from `ChanMsg`
mhagger Apr 21, 2024
da3c113
Move the message types to a separate file
mhagger Apr 21, 2024
9ca032d
authRequest: rename type from `AuthMessage`
mhagger Apr 21, 2024
5e6aa5d
MessageWriter: add an `Unsubscribe()` method
mhagger Apr 21, 2024
8b6fe94
LockedConn: type renamed from `MessageWriter`
mhagger Apr 21, 2024
4e4a39f
Move subscription-related code to a separate file
mhagger Apr 21, 2024
897b49c
Subscription.Cancel(): remove method
mhagger Apr 21, 2024
5a3fdba
Inline some subscription-related functions in `lockedConn`
mhagger Apr 21, 2024
307fd01
Remove a race related to variable-capture
mhagger Apr 21, 2024
26d94f6
App: add convenience methods for interacting with the service
mhagger Apr 21, 2024
26bb7b7
Change a couple of services to use the new call mechanism
mhagger Apr 21, 2024
f5833fc
Switch to the new way of calling services
mhagger Apr 21, 2024
10c8d53
Make the websocket package public
mhagger Apr 21, 2024
f069988
Target: allow device targets
mhagger Apr 30, 2024
826704b
Move the "application" code to package `app`
mhagger Apr 30, 2024
2ffa0f9
Move `Target` to the top level
mhagger Apr 30, 2024
6fc5e5d
Allow service methods to take any `Target` as argument
mhagger Apr 30, 2024
aa8e2ed
State(): add methods `Latitude()` and `Longitude()`
mhagger Apr 30, 2024
8af6443
App.state: change type from `*StateImpl` to `State`
mhagger Apr 30, 2024
cdecbb7
App: make fields `Service` and `State` public
mhagger Apr 30, 2024
7fff90d
Change how callbacks are invoked
mhagger Apr 30, 2024
f3e163d
App: extract methods to register single listeners
mhagger Apr 30, 2024
e3c0e86
Include the raw data in `EntityState`
mhagger May 11, 2024
33091fe
Rename two `App` methods:
mhagger May 11, 2024
7360b95
app.go: reorder method definitions
mhagger May 11, 2024
7b42441
subscribeEventsRequest: rename from `SubEvent`
mhagger May 11, 2024
8d29eb2
Target.String(): new method
mhagger May 12, 2024
9f96127
Improve how raw messages are output
mhagger May 11, 2024
fe7913f
Message: avoid inadvertently filling the `Raw` field from the JSON
mhagger May 4, 2024
890f13e
Subscribe(): no need to wrap the incoming context
mhagger May 11, 2024
7a3f730
Add a way to tell when the app is ready for use
mhagger May 11, 2024
0789d28
Start the `websocket.Conn` earlier in the initialization sequence
mhagger May 11, 2024
753f589
App.SubscribeEvents(): use `App.Subscribe()` in implementation
mhagger May 11, 2024
4fc05c1
Conn.Start(): rename local variable
mhagger May 12, 2024
965a857
Conn.Start(): not all messages will be result messages
mhagger May 12, 2024
f94d31b
websocket.ResultMessage: new type
mhagger May 4, 2024
2815fc9
app/calls.go: new file, extracted from `app.go`
mhagger May 12, 2024
c61c702
Change the service calling convention
mhagger May 12, 2024
162e969
Start adding code to handle websocket `state_changed` events
mhagger May 15, 2024
cf22ace
Move `RawMessage` definition to a separate file
mhagger May 26, 2024
e04a1b9
Move `ResultMessage` definition to a separate file
mhagger May 26, 2024
17f3dac
Move `CompressedStateChangedMessage` definition to a separate file
mhagger May 26, 2024
6d1b0a0
EventContext, BaseEvent, Event, EventMessage: new types
mhagger May 26, 2024
3ae4160
JWaveJSEventData: new type
mhagger May 26, 2024
0d35e28
Change event listeners to take `websocket.Event` as argument
mhagger May 26, 2024
1712847
`encoding/json` should be able to unmarshal the time string here
mhagger Jun 2, 2024
cd413cc
Rename `EntityState` to `Entity`
mhagger Jun 2, 2024
f278132
EntityState: new type
mhagger Jun 2, 2024
e818956
According to the Python, the context ID can be null
mhagger Jun 2, 2024
49d8b8e
`encoding/json` should be able to unmarshal the time string here
mhagger Jun 2, 2024
e027a8e
entity.go: new file, split out from `state_changed_message.go`
mhagger Jun 2, 2024
a472d81
RawObject: new type
mhagger Jun 2, 2024
17c832a
Partly generify the `Entity` types
mhagger Jun 2, 2024
200eb25
ApplyChange(): function to apply changes to an arbitrary entity
mhagger Jun 2, 2024
87dd38d
Use a specialized `Context` type in more places
mhagger Jun 2, 2024
22584dd
Timestamps can be either strings or floats
mhagger Jun 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func myFunc(se *ga.Service, st *ga.State) {
Entity Listeners are used to respond to entities changing state. The simplest entity listener looks like:

```go
etl := ga.NewEntityListener().EntityIds("binary_sensor.front_door").Call(myFunc).Build()
etl := ga.NewEntityListener().EntityIDs("binary_sensor.front_door").Call(myFunc).Build()
```

Entity listeners have other functions to change the behavior.
Expand Down Expand Up @@ -139,7 +139,7 @@ func myFunc(se *ga.Service, st *ga.State, e ga.EntityData) {
Event Listeners are used to respond to entities changing state. The simplest event listener looks like:

```go
evl := ga.NewEntityListener().EntityIds("binary_sensor.front_door").Call(myFunc).Build()
evl := ga.NewEntityListener().EntityIDs("binary_sensor.front_door").Call(myFunc).Build()
```

Event listeners have other functions to change the behavior.
Expand Down
328 changes: 0 additions & 328 deletions app.go

This file was deleted.

Loading