Skip to content

Commit

Permalink
Fix issue with class being null
Browse files Browse the repository at this point in the history
  • Loading branch information
jkniest committed Mar 21, 2021
1 parent e75f0fc commit 6d461d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed
- Packages

## [0.1.1] - 2021-03-21
### Fixed
- Fixed issue with group 0 (all lights). Class can be null

## 0.1.0 - 2021-03-20
### Added
- `All` Initial release
Expand All @@ -25,3 +29,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Alert (none / select / lselect)
- Color (XY, Hex, RGB)
- `Cloud` Full OAuth2 authentication flow (including Digest Auth)

[0.1.1]: https://github.com/jkniest/hue-it/compare/0.1.0...0.1.1
6 changes: 3 additions & 3 deletions src/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Group implements IsControllable

private bool $anyOn;

private string $class;
private ?string $class;

private int $brightness;

Expand Down Expand Up @@ -89,7 +89,7 @@ public function isAnyOn(): bool
return $this->anyOn;
}

public function getClass(): string
public function getClass(): ?string
{
return $this->class;
}
Expand Down Expand Up @@ -291,7 +291,7 @@ private function mapData(array $rawData): void
$this->type = $rawData['type'];
$this->allOn = $rawData['state']['all_on'];
$this->anyOn = $rawData['state']['any_on'];
$this->class = $rawData['class'];
$this->class = $rawData['class'] ?? null;

$this->brightness = $rawData['action']['bri'];
$this->colorTemperature = $rawData['action']['ct'];
Expand Down

0 comments on commit 6d461d6

Please sign in to comment.