Skip to content

Commit

Permalink
Merge pull request #67 from zweckj/feature/flushstopped
Browse files Browse the repository at this point in the history
Add new websocket messages for GW 3.7-rc7
  • Loading branch information
zweckj authored Dec 7, 2024
2 parents 378de62 + 1e0a227 commit dca807f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 36 deletions.
93 changes: 59 additions & 34 deletions docs/websockets.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,99 @@ ws://IP:8081/api/v1/streaming -H "Authorization: Bearer <Token>"
```

# Messages

## Statistics

```json
[
{
"MachineStatistics": "{\"groups\":[{\"doses\":[{\"DoseA\":343},{\"DoseB\":0},{\"DoseC\":0},{\"DoseD\":0},{\"ContinuousDose\":0}],\"clean\":0,\"ev_activations\":1012,\"ev_ontime\":11849}],\"tot_doses\":343,\"boilers\":[{\"rsteam_ontime\":25},{\"rcoffee_ontime\":37}],\"tea\":{\"count\":0,\"ev_activation\":0,\"ev_ontime\":0},\"pump_ontime\":11660,\"machine_ontime\":2522,\"refill_ontime\":473,\"count_liter\":0}"
}
{
"MachineStatistics": "{\"groups\":[{\"doses\":[{\"DoseA\":343},{\"DoseB\":0},{\"DoseC\":0},{\"DoseD\":0},{\"ContinuousDose\":0}],\"clean\":0,\"ev_activations\":1012,\"ev_ontime\":11849}],\"tot_doses\":343,\"boilers\":[{\"rsteam_ontime\":25},{\"rcoffee_ontime\":37}],\"tea\":{\"count\":0,\"ev_activation\":0,\"ev_ontime\":0},\"pump_ontime\":11660,\"machine_ontime\":2522,\"refill_ontime\":473,\"count_liter\":0}"
}
]
```

## SystemInfo

```json
{
    "SystemInfo": "{\"network_interfaces\":[{\"name\":\"wlan0\",\"address\":\"192.168.x.x\",\"mac\":\"<MAC>\",\"auth\":\"WPA2_WPA3_PSK\",\"channel\":11,\"rssi\":-61}],\"system_ram\":[{\"name\":\"internal\",\"free\":48671,\"allocated\":244116},{\"name\":\"external\",\"free\":4046327,\"allocated\":380152}],\"cpu\":{\"cpu0\":14,\"cpu1\":11},\"connections\":{\"ws\":21,\"ble\":17,\"mqtt\":10,\"wifi\":3},\"up_time\":228801,\"curr_time\":\"2023-07-10 06:03:50\",\"boot_reason\":\"ESP_RST_POWERON\",\"boot_count\":0,\"timezone\":2,\"fs\":{\"total\":4096000,\"used\":16384,\"files\":[{\"path\":\"/storage/auth\",\"size\":175},{\"path\":\"/storage/cert.crt\",\"size\":1224},{\"path\":\"/storage/log.txt\",\"size\":0},{\"path\":\"/storage/private.key\",\"size\":1675}]}}"
"SystemInfo": "{\"network_interfaces\":[{\"name\":\"wlan0\",\"address\":\"192.168.x.x\",\"mac\":\"<MAC>\",\"auth\":\"WPA2_WPA3_PSK\",\"channel\":11,\"rssi\":-61}],\"system_ram\":[{\"name\":\"internal\",\"free\":48671,\"allocated\":244116},{\"name\":\"external\",\"free\":4046327,\"allocated\":380152}],\"cpu\":{\"cpu0\":14,\"cpu1\":11},\"connections\":{\"ws\":21,\"ble\":17,\"mqtt\":10,\"wifi\":3},\"up_time\":228801,\"curr_time\":\"2023-07-10 06:03:50\",\"boot_reason\":\"ESP_RST_POWERON\",\"boot_count\":0,\"timezone\":2,\"fs\":{\"total\":4096000,\"used\":16384,\"files\":[{\"path\":\"/storage/auth\",\"size\":175},{\"path\":\"/storage/cert.crt\",\"size\":1224},{\"path\":\"/storage/log.txt\",\"size\":0},{\"path\":\"/storage/private.key\",\"size\":1675}]}}"
}
```

## Brewing Snapshot

```json
[
    {
        "BrewingSnapshotGroup1": "{\"groupConfiguration\":{\"groupNumber\":\"Group1\",\"capabilities\":{\"groupType\":\"AV_Group\",\"boilerId\":\"CoffeeBoiler1\",\"boilerTemperature\":47,\"hasScale\":false,\"hasFlowmeter\":true},\"dose\":{\"doseIndex\":\"DoseA\",\"stopTarget\":0,\"doseType\":\"PulsesType\"},\"doseMode\":{\"brewingType\":\"PulsesType\"}},\"flushInfo\":{\"doseIndex\":\"DoseA\",\"stopReason\":\"Manual\",\"time\":6.7829999923706055,\"stopType\":\"Volumetric\",\"volume\":0}}"
    },
    {
        "FlushStoppedGroup1DoseIndex": "DoseA"
    },
    {
        "FlushStoppedGroup1Time": 6.783
    },
    {
        "FlushStoppedGroup1Volume": 0
    }
{
"BrewingSnapshotGroup1": "{\"groupConfiguration\":{\"groupNumber\":\"Group1\",\"capabilities\":{\"groupType\":\"AV_Group\",\"boilerId\":\"CoffeeBoiler1\",\"boilerTemperature\":47,\"hasScale\":false,\"hasFlowmeter\":true},\"dose\":{\"doseIndex\":\"DoseA\",\"stopTarget\":0,\"doseType\":\"PulsesType\"},\"doseMode\":{\"brewingType\":\"PulsesType\"}},\"flushInfo\":{\"doseIndex\":\"DoseA\",\"stopReason\":\"Manual\",\"time\":6.7829999923706055,\"stopType\":\"Volumetric\",\"volume\":0}}"
},
{
"FlushStoppedGroup1DoseIndex": "DoseA"
},
{
"FlushStoppedGroup1Time": 6.783
},
{
"FlushStoppedGroup1Volume": 0
}
]
```

## Brewing Update

```json
[
    {
        "BrewingUpdateGroup1Time": 6.188
    },
    {
        "BrewingUpdateGroup1Ev": true
    },
    {
        "BrewingUpdateGroup1Volume": 0
    }
{
"BrewingUpdateGroup1Time": 6.188
},
{
"BrewingUpdateGroup1Ev": true
},
{
"BrewingUpdateGroup1Volume": 0
}
]
```

## Brewing stopped

```json
[{'BrewingStartedGroup1StopType': 'Volume'}, {'BrewingStartedGroup1DoseIndex': 'DoseA'}, {'BrewingStartedGroup1VolumeTarget': 0}]
[
{ "BrewingStartedGroup1StopType": "Volume" },
{ "BrewingStartedGroup1DoseIndex": "DoseA" },
{ "BrewingStartedGroup1VolumeTarget": 0 }
]
```

## Wake up

```json
[
{
"WakeUp": "manual"
}
{
"WakeUp": "manual"
}
]
```

## Sleep
## Sleep

```json
[
{
"Sleep": "command"
}
]
```

# Flush Snapshot

```json
[
{
"Sleep": "command"
}
{
"FlushSnapshotGroup1": "{\"groupConfiguration\":{\"groupNumber\":\"Group1\",\"capabilities\":{\"groupType\":\"AV_Group\",\"boilerId\":\"CoffeeBoiler1\",\"boilerTemperature\":97,\"boilerTemperatureAtStart\":97,\"hasScale\":false,\"hasFlowmeter\":true},\"dose\":{\"doseIndex\":\"DoseA\",\"stopTarget\":0,\"doseType\":\"PulsesType\"},\"doseMode\":{\"brewingType\":\"PulsesType\"}},\"flushInfo\":{\"doseIndex\":\"DoseA\",\"stopReason\":\"Manual\",\"time\":4.521,\"stopType\":\"Volumetric\",\"volume\":0}}"
},
{ "FlushStoppedGroup1DoseIndex": "DoseA" },
{ "FlushStoppedGroup1Time": 4.521 },
{ "FlushStoppedGroup1Volume": 0 }
]
```
```
9 changes: 8 additions & 1 deletion pylamarzocco/devices/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,18 @@ def _parse_list_message(self, message: list[dict[str, Any]]) -> bool:
property_updated = True

elif (
"BrewingStoppedGroup1StopType" in msg or "BrewingSnapshotGroup1" in msg
"BrewingStoppedGroup1StopType" in msg
or "BrewingSnapshotGroup1" in msg
or "FlushSnapshotGroup1" in msg
):
self.config.brew_active = False
property_updated = True

elif "FlushStoppedGroup1Time" in msg:
self.config.brew_active = False
self.config.brew_active_duration = msg["FlushStoppedGroup1Time"]
property_updated = True

elif "SteamBoilerUpdateSetPoint" in msg:
self.config.boilers[BoilerType.STEAM].target_temperature = msg[
"SteamBoilerUpdateSetPoint"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pylamarzocco"
version = "1.3.2"
version = "1.3.3"
license = { text = "MIT License" }
description = "A Python implementation of the new La Marzocco API"
readme = "README.md"
Expand Down

0 comments on commit dca807f

Please sign in to comment.