Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Refoss integration #100573

Merged
merged 157 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
eaf6a9c
refoss
ashionky Jul 6, 2023
a3f6cc7
refoss
ashionky Jul 6, 2023
a20663f
refoss
ashionky Jul 7, 2023
ba92e23
Merge branch 'dev' into feature/refoss
ashionky Jul 7, 2023
6a1f5d3
refoss
ashionky Jul 7, 2023
9be93be
merge dev
ashionky Jul 7, 2023
cc344f2
refoss modify
ashionky Jul 7, 2023
0f31136
Merge branch 'dev' into feature/refoss
ashionky Jul 7, 2023
acb4a8b
Merge branch 'dev' into feature/refoss
ashionky Jul 10, 2023
a344463
ip
ashionky Aug 21, 2023
b4e3ca2
Merge branch 'dev' into feature/refoss
ashionky Aug 22, 2023
2b6df3f
8.22
ashionky Aug 23, 2023
dae2cc9
format
ashionky Aug 24, 2023
2eef759
Merge branch 'dev' into feature/refoss
ashionky Aug 24, 2023
5867452
format
ashionky Aug 24, 2023
88f73d7
format
ashionky Aug 24, 2023
ead5a1f
Merge branch 'dev' into feature/refoss
ashionky Aug 24, 2023
9fea603
format
ashionky Aug 24, 2023
530ebe2
pull origin
ashionky Aug 24, 2023
ca50475
Merge branch 'dev' into feature/refoss
ashionky Aug 24, 2023
368aaf8
bugfix
ashionky Aug 25, 2023
40bd2e7
test
ashionky Aug 25, 2023
e99a8df
test
ashionky Aug 25, 2023
af76d90
test
ashionky Aug 25, 2023
b266ae8
test
ashionky Aug 25, 2023
1150eea
Merge branch 'dev' into feature/refoss
ashionky Aug 25, 2023
2246be9
test
ashionky Aug 25, 2023
bba4006
test
ashionky Aug 25, 2023
b45009b
test
ashionky Aug 25, 2023
c27c18c
Merge branch 'dev' into feature/refoss
ashionky Aug 25, 2023
7820b9c
test
ashionky Aug 25, 2023
961ff37
test
ashionky Aug 25, 2023
f230a12
Merge branch 'dev' into feature/refoss
ashionky Aug 28, 2023
37a8d13
Merge branch 'dev' into feature/refoss
ashionky Aug 28, 2023
761a9f7
Merge branch 'dev' into feature/refoss
ashionky Aug 28, 2023
ebbfa62
9.1
ashionky Sep 3, 2023
a5c0fe7
refosss
ashionky Sep 4, 2023
1f995da
refoss
ashionky Sep 4, 2023
f0494e1
refoss
ashionky Sep 4, 2023
fce8da5
refoss
ashionky Sep 5, 2023
be0f00c
Merge branch 'dev' into feature/refoss
ashionky Sep 5, 2023
3211683
refoss
ashionky Sep 5, 2023
511a0d2
refoss
ashionky Sep 5, 2023
d25cadb
refoss
ashionky Sep 7, 2023
0ee8ea6
refoss
ashionky Sep 7, 2023
fc6add8
refoss
ashionky Sep 8, 2023
bd17485
refoss
ashionky Sep 8, 2023
f3085f1
Merge branch 'dev' into feature/refoss
ashionky Sep 8, 2023
10e2146
test
ashionky Sep 11, 2023
cf74c6e
test
ashionky Sep 11, 2023
7de1833
requirements_test_all.txt
ashionky Sep 11, 2023
19ed9ef
Merge branch 'dev' into feature/refoss
ashionky Sep 11, 2023
35a6659
merge origin
ashionky Sep 11, 2023
3a2170a
codeowners
ashionky Sep 11, 2023
cfc1e67
Merge branch 'dev' into feature/refoss
ashionky Sep 11, 2023
9b3191a
Merge branch 'dev' into feature/refoss
ashionky Sep 11, 2023
9d2848d
Merge branch 'dev' into feature/refoss
ashionky Sep 11, 2023
5b3e8cc
Merge branch 'dev' into feature/refoss
ashionky Sep 14, 2023
4dd03c4
refoss
ashionky Sep 14, 2023
63ab856
Merge branch 'dev' into feature/refoss
ashionky Sep 14, 2023
8ec56ad
Merge branch 'dev' into feature/refoss
ashionky Sep 15, 2023
3df61ab
Merge branch 'dev' into feature/refoss
ashionky Sep 15, 2023
146238e
Merge branch 'dev' into feature/refoss
ashionky Sep 15, 2023
f1bbd18
Merge branch 'dev' into feature/refoss
ashionky Sep 18, 2023
69b638f
Merge branch 'dev' into feature/refoss
ashionky Sep 19, 2023
962addd
Merge branch 'dev' into feature/refoss
ashionky Sep 19, 2023
d0a8d4b
Merge branch 'dev' into feature/refoss
ashionky Sep 19, 2023
ba5f751
Review feedback repair
ashionky Sep 20, 2023
89487d7
Merge branch 'dev' into feature/refoss
ashionky Sep 20, 2023
1bcfd2a
merge origin dev
ashionky Sep 20, 2023
7bd9915
strings
ashionky Sep 20, 2023
96963fa
Merge branch 'dev' into feature/refoss
ashionky Sep 20, 2023
bb4d886
refoss
ashionky Sep 21, 2023
7cf5641
merge origin
ashionky Sep 21, 2023
06a202d
Merge branch 'dev' into feature/refoss
ashionky Sep 21, 2023
fd47cd0
refoss
ashionky Sep 21, 2023
0ecc058
Merge branch 'dev' into feature/refoss
ashionky Sep 21, 2023
bfe5163
Merge branch 'dev' into feature/refoss
ashionky Sep 21, 2023
e4a1d20
refoss
ashionky Sep 21, 2023
d5c8ed0
merge origin
ashionky Sep 21, 2023
5fcf869
Merge branch 'dev' into feature/refoss
ashionky Sep 21, 2023
9df5404
Merge branch 'dev' into feature/refoss
ashionky Sep 22, 2023
64149b7
Merge branch 'dev' into feature/refoss
ashionky Sep 27, 2023
263f3da
1.1.1
ashionky Sep 27, 2023
df21f95
Merge branch 'dev' into feature/refoss
ashionky Sep 27, 2023
a3191c2
Merge branch 'dev' into feature/refoss
ashionky Sep 28, 2023
7d9d2ff
1.1.2
ashionky Sep 28, 2023
7087582
1.1.2
ashionky Sep 28, 2023
d241d3b
refoss
ashionky Sep 28, 2023
526a186
refoss
ashionky Sep 28, 2023
733c6b2
Merge branch 'dev' into feature/refoss
ashionky Sep 28, 2023
e452974
Merge branch 'dev' into feature/refoss
ashionky Oct 8, 2023
f1f7298
refoss.1.1.7
ashionky Oct 8, 2023
adaadd9
refoss-gree
ashionky Oct 8, 2023
fa834d1
Merge branch 'dev' into feature/refoss
ashionky Oct 8, 2023
e9f9c14
1.1.7
ashionky Oct 8, 2023
98ad434
Merge branch 'dev' into feature/refoss
ashionky Oct 8, 2023
9959a04
Merge branch 'dev' into feature/refoss
ashionky Oct 9, 2023
827bdb9
test
ashionky Oct 9, 2023
77761ba
Merge branch 'dev' into feature/refoss
ashionky Oct 9, 2023
19b93ce
refoss
ashionky Oct 9, 2023
231c39f
merge dev
ashionky Oct 9, 2023
fd32d87
Merge branch 'dev' into feature/refoss
ashionky Oct 9, 2023
cdce33a
Merge branch 'dev' into feature/refoss
ashionky Oct 10, 2023
fb86ce1
test refoss
ashionky Oct 10, 2023
511e450
test refoss
ashionky Oct 10, 2023
144daf5
test refoss
ashionky Oct 10, 2023
6c09c6d
refoss-test
ashionky Oct 10, 2023
71bf204
Merge branch 'dev' into feature/refoss
ashionky Oct 10, 2023
46dbdd9
refoss
ashionky Oct 10, 2023
4760b3a
refoss
ashionky Oct 10, 2023
43fa3b2
Merge branch 'dev' into feature/refoss
ashionky Oct 11, 2023
92246f5
Merge branch 'dev' into feature/refoss
ashionky Oct 12, 2023
bf0fa02
Merge branch 'dev' into feature/refoss
ashionky Oct 12, 2023
a5473cd
Merge branch 'dev' into feature/refoss
ashionky Oct 17, 2023
db343fb
test
ashionky Oct 17, 2023
6dc989f
test
ashionky Oct 17, 2023
b7a9989
Merge branch 'dev' into feature/refoss
ashionky Oct 18, 2023
9292c54
Merge branch 'dev' into feature/refoss
ashionky Oct 19, 2023
c700939
Merge branch 'dev' into feature/refoss
ashionky Oct 23, 2023
2a9e784
refoss
ashionky Oct 23, 2023
a2e0c43
Merge branch 'dev' into feature/refoss
ashionky Oct 23, 2023
2f355ad
Merge branch 'dev' into feature/refoss
ashionky Oct 24, 2023
2cc2619
Merge branch 'dev' into feature/refoss
ashionky Oct 25, 2023
1435994
Merge branch 'dev' into feature/refoss
ashionky Oct 26, 2023
2064d3e
Merge branch 'dev' into feature/refoss
ashionky Oct 27, 2023
3f4f839
Merge branch 'dev' into feature/refoss
ashionky Oct 27, 2023
0e84830
Merge branch 'dev' into feature/refoss
ashionky Oct 30, 2023
a47bd54
Merge branch 'dev' into feature/refoss
ashionky Oct 30, 2023
618b78f
Merge branch 'dev' into feature/refoss
ashionky Oct 31, 2023
b0c4983
Merge branch 'dev' into feature/refoss
ashionky Nov 1, 2023
a39a622
Merge branch 'dev' into feature/refoss
ashionky Nov 2, 2023
2a684b7
Merge branch 'dev' into feature/refoss
ashionky Nov 3, 2023
14d4c81
Merge branch 'dev' into feature/refoss
ashionky Nov 3, 2023
bdb7c20
Merge branch 'dev' into feature/refoss
ashionky Nov 6, 2023
5d0200c
Merge branch 'dev' into feature/refoss
ashionky Nov 7, 2023
15349e9
Merge branch 'dev' into feature/refoss
ashionky Nov 8, 2023
a15d021
CODEOWNERS
ashionky Nov 8, 2023
4ab6c10
Merge branch 'home-assistant:dev' into feature/refoss
ashionky Nov 8, 2023
9a78872
Merge branch 'dev' into feature/refoss
ashionky Nov 8, 2023
9ff034f
Merge branch 'dev' into feature/refoss
ashionky Nov 8, 2023
a5c41e1
Merge branch 'dev' into feature/refoss
ashionky Nov 9, 2023
7f67b4b
Merge branch 'dev' into feature/refoss
ashionky Nov 9, 2023
43df03d
Merge branch 'dev' into feature/refoss
ashionky Nov 9, 2023
6cfa22a
Merge branch 'dev' into feature/refoss
ashionky Nov 10, 2023
7b878ad
Merge branch 'dev' into feature/refoss
ashionky Nov 10, 2023
1d88465
Merge branch 'dev' into feature/refoss
ashionky Nov 13, 2023
9dbf26b
Merge branch 'dev' into feature/refoss
ashionky Nov 13, 2023
9f4fd1b
Merge branch 'dev' into feature/refoss
ashionky Nov 14, 2023
63d8fe0
fix
ashionky Nov 15, 2023
44233ed
Merge branch 'dev' into feature/refoss
ashionky Nov 19, 2023
5b05638
Merge branch 'dev' into feature/refoss
ashionky Dec 1, 2023
3ada9d2
Merge branch 'dev' into feature/refoss
ashionky Dec 6, 2023
5079429
Merge branch 'dev' into feature/refoss
ashionky Dec 13, 2023
65bf984
fix
ashionky Dec 18, 2023
a86653d
Merge branch 'dev' into feature/refoss
ashionky Dec 21, 2023
0804ea5
Update homeassistant/components/refoss/__init__.py
joostlek Dec 22, 2023
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
Prev Previous commit
Next Next commit
refoss
  • Loading branch information
ashionky committed Sep 28, 2023
commit 526a186e87fd1594b174f70c5d1fc0018119574a
18 changes: 18 additions & 0 deletions homeassistant/components/refoss/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from homeassistant.helpers.typing import DiscoveryInfoType

from .const import DOMAIN
from .models import HomeAssistantRefossData
from .util import get_refoss_socket_server


Expand Down Expand Up @@ -40,6 +41,9 @@ def message_received(self, data: dict):
data=data,
)

elif "header" in data and "payload" in data:
self.hass.create_task(self.async_update_push_state(data=data))

async def async_step_discovery(
self, discovery_info: DiscoveryInfoType
) -> FlowResult:
Expand All @@ -56,3 +60,17 @@ async def async_step_discovery(
self._abort_if_unique_id_configured(updates=discovery_info)

return self.async_create_entry(title=device_name, data=discovery_info)

async def async_update_push_state(self, data: dict) -> None:
"""Async update the status of device."""
header = data["header"]
uuid = header["uuid"]
if entry := await self.async_set_unique_id(uuid):
namespace = header["namespace"]
payload = data["payload"]
refoss_data: HomeAssistantRefossData = self.hass.data[DOMAIN][
entry.entry_id
]
await refoss_data.base_device.async_handle_push_notification(
namespace, payload, uuid
)
24 changes: 23 additions & 1 deletion homeassistant/components/refoss/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, device: BaseDevice, channel: int) -> None:
else:
self._attr_name = str(channel)
self.device = device
self.channel = channel
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, device.uuid)},
manufacturer="refoss",
Expand All @@ -41,4 +42,25 @@ def available(self) -> bool:

async def async_device_update(self, warning: bool = True) -> None:
"""Async update device status."""
await self.device.async_handle_update()
await self.device.async_handle_update(self.channel)

async def async_added_to_hass(self) -> None:
"""Call when entity is added to hass."""
self.device.register_push_notification_handler_coroutine(
self._async_push_notification_received
)

async def async_will_remove_from_hass(self) -> None:
"""Call when entity is remove from hass."""
self.device.unregister_push_notification_handler_coroutine(
self._async_push_notification_received
)

async def _async_push_notification_received(
self, namespace: str, data: dict, uuid: str
) -> None:
"""Synchronize the status of device push."""
await self.device.async_update_push_state(
namespace=namespace, data=data, uuid=uuid
)
self.async_write_ha_state()
2 changes: 1 addition & 1 deletion homeassistant/components/refoss/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/refoss",
"integration_type": "device",
"iot_class": "local_polling",
"requirements": ["refoss-ha==1.1.3"]
"requirements": ["refoss-ha==1.1.6"]
}
11 changes: 11 additions & 0 deletions homeassistant/components/refoss/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ def shutdown_listener(ev: Event) -> None:

hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, shutdown_listener)
return socket_server


def verify_msg(data: dict) -> str | None:
"""Verify push msg."""
header = data.get("header", {})
namespace = header.get("namespace", None)
uuid = header.get("uuid", None)
payload = data.get("payload", None)
if namespace is None or uuid is None or payload is None:
return None
return uuid
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2303,7 +2303,7 @@ rapt-ble==0.1.2
raspyrfm-client==1.2.8

# homeassistant.components.refoss
refoss-ha==1.1.3
refoss-ha==1.1.6

# homeassistant.components.rainmachine
regenmaschine==2023.06.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,7 @@ radiotherm==2.1.0
rapt-ble==0.1.2

# homeassistant.components.refoss
refoss-ha==1.1.3
refoss-ha==1.1.6

# homeassistant.components.rainmachine
regenmaschine==2023.06.0
Expand Down