Skip to content

Commit 379436f

Browse files
Release 1.2.2
1 parent 3b5adfa commit 379436f

File tree

15 files changed

+482
-189
lines changed

15 files changed

+482
-189
lines changed

.DS_Store

2 KB
Binary file not shown.

whatsapp_addon/.DS_Store

6 KB
Binary file not shown.

whatsapp_addon/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.2.2
2+
3+
- Added the ability to always be online or offline. This could lead to not receiving notifications on other devices. (**Restard required**)
4+
- Bug fixed.
5+
16
## 1.2.1
27

38
- Fixed bug that did not allow the reception of push notifications on other devices.

whatsapp_addon/DOCS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,4 @@ data:
271271
data:
272272
message: Contact is online!
273273
mode: single
274-
```
274+
```

whatsapp_addon/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ARG BUILD_FROM
22
FROM $BUILD_FROM
33

4-
RUN apk add --no-cache git npm --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main
4+
RUN apk add --no-cache git npm
55

66
COPY . /
77
RUN chmod a+x /run.sh
88
RUN chmod a+x /finish.sh
99

10-
RUN cd / && npm install
10+
RUN cd / && npm install -f
1111

1212
EXPOSE 3000
1313
CMD [ "/run.sh" ]

whatsapp_addon/WhatsappClient.js

Lines changed: 0 additions & 91 deletions
This file was deleted.

whatsapp_addon/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Whatsapp
2-
version: "1.2.1"
2+
version: "1.2.2"
33
slug: whatsapp_addon
44
description: Whatsapp addon for send message from Home Assistant
55
url: "https://github.com/giuseppecastaldo/ha-addons/tree/main/whatsapp_addon"

whatsapp_addon/custom_component/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ async def presence_subscribe(call: ServiceCall) -> None:
2929
async def send_presence_update(call: ServiceCall) -> None:
3030
await hass.async_add_executor_job(whatsapp.send_presence_update, call.data)
3131

32+
@callback
33+
async def send_infinity_presence_update(call: ServiceCall) -> None:
34+
await hass.async_add_executor_job(whatsapp.send_infinity_presence_update, call.data)
35+
3236
hass.services.async_register(DOMAIN, 'send_message', send_message)
3337
hass.services.async_register(DOMAIN, 'set_status', set_status)
3438
hass.services.async_register(DOMAIN, 'presence_subscribe', presence_subscribe)
3539
hass.services.async_register(DOMAIN, 'send_presence_update', send_presence_update)
40+
hass.services.async_register(DOMAIN, 'send_infinity_presence_update', send_infinity_presence_update)
3641

3742
return True

whatsapp_addon/custom_component/services.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set_status:
3535

3636
presence_subscribe:
3737
name: Presence subscribe
38-
description: Subscribe to user presence update like online, offline, typing, etc...
38+
description: Subscribe to user presence update like online, offline, typing, etc... Please first use send infinity presence update service to always appear online.
3939
fields:
4040
clientId:
4141
name: Client ID
@@ -75,3 +75,31 @@ send_presence_update:
7575
description: Target User ID
7676
required: false
7777
example: 391234567890@s.whatsapp.net
78+
79+
send_infinity_presence_update:
80+
name: Send infinity presence update
81+
description: Send presence update like online, offline, typing, etc... for a long time
82+
fields:
83+
clientId:
84+
name: Client ID
85+
description: Which instance of whatsapp should be used
86+
required: true
87+
example: default
88+
type:
89+
name: Presence type
90+
description: Presence type
91+
required: true
92+
example: composing
93+
selector:
94+
select:
95+
options:
96+
- "unavailable"
97+
- "available"
98+
- "composing"
99+
- "recording"
100+
- "paused"
101+
to:
102+
name: Target User ID
103+
description: Target User ID
104+
required: false
105+
example: 391234567890@s.whatsapp.net

whatsapp_addon/custom_component/whatsapp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ def presence_subscribe(self, data):
1515

1616
def send_presence_update(self, data):
1717
return requests.post(url_normalize(f'{HOST}/sendPresenceUpdate'), json=data).content == 'OK'
18+
19+
def send_infinity_presence_update(self, data):
20+
return requests.post(url_normalize(f'{HOST}/sendInfinityPresenceUpdate'), json=data).content == 'OK'

0 commit comments

Comments
 (0)