Skip to content

Commit 6e7c623

Browse files
committed
[Pushsafer] Remove special handling for vibration again
1 parent 2145d47 commit 6e7c623

File tree

6 files changed

+6
-22
lines changed

6 files changed

+6
-22
lines changed

CHANGES.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ in progress
88

99
- Pushsafer: Fix to prevent submitting empty parameters to upstream API.
1010

11-
BREAKING CHANGE: This has an impact on the ``vibration`` parameter:
12-
Previously, a Pushsafer notification would always have vibrations turned
13-
on, which is considered to be a bug. Now, you will have to explicitly
14-
configure ``vibration=0``, in order to use the "device-default" vibration.
15-
1611

1712
2023-02-13 0.32.0
1813
=================

HANDBOOK.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,8 +2457,8 @@ In order to receive pushsafer notifications you need what is called a _private o
24572457
targets = {
24582458
'nagios' : ['privatekey', 'Device ID', 'Icon', 'Sound', 'Vibration', 'URL', 'Url Title', 'Time2Live', 'Priority', 'Retry', 'Expire', 'Answer'],
24592459
'tracking' : ['aliaskey1'],
2460-
'extraphone' : ['aliaskey2', '', '', '', '0', '', '', '60', '2', '60', '600', '0'],
2461-
'warnme' : ['aliaskey3', '', '', '', '0', '', '', '60', '1', '', '', '1']
2460+
'extraphone' : ['aliaskey2', '', '', '', '', '', '', '60', '2', '60', '600', '0'],
2461+
'warnme' : ['aliaskey3', '', '', '', '', '', '', '60', '1', '', '', '1']
24622462
}
24632463
```
24642464
@@ -2472,9 +2472,6 @@ Please note:
24722472
- [Retry](https://www.pushsafer.com/en/pushapi_ext#API-RE)
24732473
with [Expire](https://www.pushsafer.com/en/pushapi_ext#API-EX):
24742474
For configuring delivery retries, you must set both parameters.
2475-
- [Vibration](https://www.pushsafer.com/en/pushapi_ext#API-V):
2476-
`vibration=0` means "device-default" vibration. This is a special value
2477-
used by mqttwarn, it will be translated to an empty `v=` upstream parameter.
24782475
24792476
| Topic option | M/O | Description |
24802477
| ------------- | :----: | -------------------------------------- |

mqttwarn/services/pushsafer.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,7 @@ def encode_v1(self):
143143
params['s'] = addrs[3]
144144

145145
if len(addrs) > 4:
146-
# Special handling for `vibration`.
147-
# With the v1 configuration layout, it should not always trigger a vibration when left empty.
148-
# Therefore, a synthetic value `0` can be used to configure "device-default" vibration.
149-
value = str(addrs[4])
150-
if value != "":
151-
params['v'] = value
146+
params['v'] = addrs[4]
152147

153148
if len(addrs) > 5:
154149
params['u'] = addrs[5]

tests/etc/better-addresses.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ targets = {
7777
'device': '52|65|78',
7878
'icon': 64,
7979
'sound': 2,
80-
# Zero means "vibrate with device-default".
81-
'vibration': '0',
80+
'vibration': 1,
8281
'url': 'http://example.org',
8382
'url_title': 'Example Org',
8483
'time_to_live': 60,

tests/services/pushsafer/test_pushsafer_v1.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ class IoTestItem:
106106
IoTestItem(id="device-id", in_addrs=[TEST_TOKEN, "52|65|78"], out_data={"d": "52|65|78"}),
107107
IoTestItem(id="icon", in_addrs=[TEST_TOKEN, "", "test.ico"], out_data={"i": "test.ico"}),
108108
IoTestItem(id="sound", in_addrs=[TEST_TOKEN, "", "", "test.mp3"], out_data={"s": "test.mp3"}),
109-
IoTestItem(id="vibration-default", in_addrs=[TEST_TOKEN, "", "", "", "0"], out_data={"v": ""}),
110-
IoTestItem(id="vibration-two", in_addrs=[TEST_TOKEN, "", "", "", "2"], out_data={"v": "2"}),
109+
IoTestItem(id="vibration", in_addrs=[TEST_TOKEN, "", "", "", "2"], out_data={"v": "2"}),
111110
IoTestItem(
112111
id="url", in_addrs=[TEST_TOKEN, "", "", "", "", "http://example.org"], out_data={"u": "http://example.org"}
113112
),

tests/services/pushsafer/test_pushsafer_v2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ class IoTestItem:
106106
IoTestItem(id="device-id", in_addrs={"private_key": TEST_TOKEN, "device": "52|65|78"}, out_data={"d": "52|65|78"}),
107107
IoTestItem(id="icon", in_addrs={"private_key": TEST_TOKEN, "icon": "test.ico"}, out_data={"i": "test.ico"}),
108108
IoTestItem(id="sound", in_addrs={"private_key": TEST_TOKEN, "sound": "test.mp3"}, out_data={"s": "test.mp3"}),
109-
IoTestItem(id="vibration-default", in_addrs={"private_key": TEST_TOKEN, "vibration": 0}, out_data={"v": ""}),
110-
IoTestItem(id="vibration-two", in_addrs={"private_key": TEST_TOKEN, "vibration": 2}, out_data={"v": "2"}),
109+
IoTestItem(id="vibration", in_addrs={"private_key": TEST_TOKEN, "vibration": 2}, out_data={"v": "2"}),
111110
IoTestItem(
112111
id="url",
113112
in_addrs={"private_key": TEST_TOKEN, "url": "http://example.org"},

0 commit comments

Comments
 (0)