@camstack/addon-import-alexa 0.2.176 → 0.2.177

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/i18n/en.json CHANGED
@@ -14,7 +14,6 @@
14
14
  "echoTarget.s_echo.title": "Echo",
15
15
  "echoTarget.s_echo.brokerId.label": "Amazon account",
16
16
  "echoTarget.s_echo.echoId.label": "Echo",
17
- "echoTarget.s_echo.volume.label": "Volume",
18
17
  "echoTarget.s_echo.respectDnd.label": "Respect Do Not Disturb",
19
18
  "globalSettings": {
20
19
  "s_alexa-proxy-login": {
package/i18n/it.json CHANGED
@@ -14,7 +14,6 @@
14
14
  "echoTarget.s_echo.title": "Echo",
15
15
  "echoTarget.s_echo.brokerId.label": "Account Amazon",
16
16
  "echoTarget.s_echo.echoId.label": "Echo",
17
- "echoTarget.s_echo.volume.label": "Volume",
18
17
  "echoTarget.s_echo.respectDnd.label": "Rispetta Non disturbare",
19
18
  "globalSettings": {
20
19
  "s_alexa-proxy-login": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-import-alexa",
3
- "version": "0.2.176",
3
+ "version": "0.2.177",
4
4
  "description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
5
5
  "keywords": [
6
6
  "camstack",
@@ -68,7 +68,7 @@
68
68
  }
69
69
  ],
70
70
  "requires": {
71
- "server": ">=1.2.729"
71
+ "server": ">=1.2.730"
72
72
  }
73
73
  },
74
74
  "files": [
@@ -89,9 +89,6 @@ class Session:
89
89
  text = message.get("text")
90
90
  if not isinstance(text, str) or text == "":
91
91
  raise ValueError("text required")
92
- volume = message.get("volume")
93
- if not isinstance(volume, int):
94
- volume = 40
95
92
  locale = REGION_LOCALE.get(self._gateway.region, "en-GB")
96
93
  outcomes: list[dict] = []
97
94
  for serial in targets:
@@ -104,7 +101,7 @@ class Session:
104
101
  continue
105
102
  try:
106
103
  if op == "speak":
107
- sequence = build_speak_sequence(target, text, volume, locale)
104
+ sequence = build_speak_sequence(target, text, locale)
108
105
  await self._gateway.speak(sequence, target["customerId"])
109
106
  else:
110
107
  announcement = build_announcement(target, text, locale)
@@ -29,27 +29,12 @@ def _speak_node(target: EchoTarget, text: str, locale: str) -> dict:
29
29
  }
30
30
 
31
31
 
32
- def _volume_node(target: EchoTarget, volume: int, nxt: dict) -> dict:
33
- return {
34
- "@type": "com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode",
35
- "type": "Alexa.DeviceControls.Volume",
36
- "operationPayload": {
37
- "deviceType": target["deviceType"],
38
- "deviceSerialNumber": target["id"],
39
- "customerId": target["customerId"],
40
- "value": volume,
41
- },
42
- "next": nxt,
43
- }
44
-
45
-
46
- def build_speak_sequence(target: EchoTarget, text: str, volume: int, locale: str) -> dict:
47
- """Volume, then speech. Speak honours Do Not Disturb on the device."""
32
+ def build_speak_sequence(target: EchoTarget, text: str, locale: str) -> dict:
33
+ """Speech at the Echo's current volume. Speak honours Do Not Disturb on the device."""
48
34
  speak = _speak_node(target, text, locale)
49
- start = _volume_node(target, volume, speak) if volume >= 0 else speak
50
35
  return {
51
36
  "@type": "com.amazon.alexa.behaviors.model.Sequence",
52
- "startNode": start,
37
+ "startNode": speak,
53
38
  }
54
39
 
55
40
 
@@ -136,19 +136,20 @@ class ProtocolTests(unittest.TestCase):
136
136
  session = Session(gateway)
137
137
  spoken = run(
138
138
  session,
139
- {"id": "4", "op": "speak", "targets": ["echo-1"], "text": "Person at the door", "volume": 30},
139
+ {"id": "4", "op": "speak", "targets": ["echo-1"], "text": "Person at the door"},
140
140
  )
141
141
  self.assertTrue(spoken["result"]["outcomes"][0]["ok"])
142
142
  sequence = gateway.spoken[0]["sequence"]
143
- self.assertEqual(sequence["startNode"]["type"], "Alexa.DeviceControls.Volume")
144
- self.assertEqual(sequence["startNode"]["next"]["type"], "Alexa.Speak")
143
+ # No volume node: the Echo speaks at its current volume.
144
+ self.assertEqual(sequence["startNode"]["type"], "Alexa.Speak")
145
+ self.assertNotIn("next", sequence["startNode"])
145
146
  self.assertEqual(
146
- sequence["startNode"]["next"]["operationPayload"]["textToSpeak"],
147
+ sequence["startNode"]["operationPayload"]["textToSpeak"],
147
148
  "Person at the door",
148
149
  )
149
150
  announced = run(
150
151
  session,
151
- {"id": "5", "op": "announce", "targets": ["echo-1"], "text": "Hello", "volume": 30},
152
+ {"id": "5", "op": "announce", "targets": ["echo-1"], "text": "Hello"},
152
153
  )
153
154
  self.assertTrue(announced["result"]["outcomes"][0]["ok"])
154
155
  self.assertEqual(gateway.announced[0]["content"][0]["speak"]["value"], "Hello")
@@ -167,7 +168,7 @@ class ProtocolTests(unittest.TestCase):
167
168
 
168
169
  def test_sequence_helpers_do_not_embed_markup(self) -> None:
169
170
  target = {"id": "echo-1", "deviceType": "T", "customerId": "c"}
170
- sequence = build_speak_sequence(target, "plain", 10, "en-GB")
171
+ sequence = build_speak_sequence(target, "plain", "en-GB")
171
172
  self.assertNotIn("<", json.dumps(sequence))
172
173
  announcement = build_announcement(target, "plain", "en-GB")
173
174
  self.assertEqual(announcement["content"][0]["speak"]["type"], "text")