node-red-contrib-sonospollytts
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -8,2 +8,6 @@ ![Sample Node](img/logo.png) | ||
<p> | ||
<b>Version 1.1.6</b><br/> | ||
- NEW: You can now UPLOAD your own mp3 files and play it via the newly added OwnFile node.<br/> | ||
</p> | ||
<p> | ||
<b>Version 1.1.5</b><br/> | ||
@@ -10,0 +14,0 @@ - NEW: you can now select whether to purge the TTS cache file at start or to leave all TTS files untouched.<br/> |
{ | ||
"name": "node-red-contrib-sonospollytts", | ||
"version": "1.1.5", | ||
"description": "Node-Red TTS with Sonos and Amazon Polly", | ||
"version": "1.1.6", | ||
"description": "Node-Red TTS with Sonos and Amazon Polly or with your own local mp3 announcement files. This node is specific for security alarm announcement, zone announcement, doorbell, weather annoucement etc.", | ||
"main": "index.js", | ||
@@ -25,3 +25,4 @@ "scripts": { | ||
"nodes": { | ||
"sonospollytts": "sonospollytts/sonospollytts.js" | ||
"sonospollytts": "sonospollytts/sonospollytts.js", | ||
"ownfile": "sonospollytts/ownfile.js" | ||
} | ||
@@ -42,3 +43,4 @@ }, | ||
"sonos": ">=1.12.6", | ||
"util": ">=0.10.1" | ||
"util": ">=0.10.1", | ||
"formidable": "1.2.2" | ||
}, | ||
@@ -45,0 +47,0 @@ "devDependencies": { |
@@ -30,34 +30,36 @@ # Node-Red SonosPollyTTS | ||
## CONFIGURATION | ||
<br/><br/><br/><br/> | ||
**Polly Config** | ||
# SONOSPOLLYTTS CONFIGURATION | ||
**Polly Config**<br/> | ||
Create a config with your AWS credentials. If you put incorrect credentials, you'll see this error in the node-red's debug window: *"The security token included in the request is invalid."* | ||
**Polly Voice** | ||
**Polly Voice**<br/> | ||
Select your preferred voice | ||
**Sonos IP** | ||
**Sonos IP** <br/> | ||
Insert your sonos's IP (If your Sonos device doesn't allow you to set a fixed IP, you need to reserve an IP using the DHCP Reservation function of your router/firewall's DHCP Server) | ||
**Sonos Volume** | ||
**Sonos Volume** <br/> | ||
set the preferred TTS volume, from "0" to "100" (can be overridden by passing <code>msg.volume="40";</code> to the node) | ||
**Sonos Hailing** | ||
**Sonos Hailing**<br/> | ||
before the first TTS message of the message queues, Sonos will play an "hailing" sound. You can select the hailing or totally disable it. | ||
**Node-Red IP** | ||
**Node-Red IP**<br/> | ||
set IP of your node-red machine | ||
**Host Port** | ||
**Host Port**<br/> | ||
normally 1980. This is the IP of your machine, running node-red | ||
**TTS path** | ||
**TTS path**<br/> | ||
you can change the temp folder for storing cached TTS files. Default is "tmp". This is valid only if you select to purge the cache folder at each deploy or restart of node-red (see the next option below) | ||
**TTS Cache** | ||
<br/> | ||
Purge and delete the TTS cache folder at deploy or restart(default): on each deploy or node-red restart, delete all tts files in the cache. This is useful not to run out of disk space, in case you've a lot of TTS speech files.<br/> | ||
Leave the TTS cache folder untouched (not suggested if you have less disk space): don't delete any tts file. Useful if you wish to keep the tts files, even in case of internet outages. | ||
<code>Purge and delete the TTS cache folder at deploy or restart(default)</code>: on each deploy or node-red restart, delete all tts files in the cache. This is useful not to run out of disk space, in case you've a lot of TTS speech files.<br/> | ||
<code>Leave the TTS cache folder untouched (not suggested if you have less disk space)</code>: don't delete any tts file. Useful if you wish to keep the tts files, even in case of internet outages. | ||
## INPUT | ||
### INPUT MESSAGES TO THE NODE | ||
* <code>msg.volume</code> set the volume (values between "0" and "100" with quotes) | ||
@@ -74,8 +76,10 @@ * <code>msg.nohailing</code> temporarely doesn't play the Hailing sound prior to the message (values "true" or "1" with quotes) | ||
## OUTPUT | ||
### OUTPUT MESSAGES FROM THE NODE | ||
* <code>msg.completed</code> <b>true</b> when the node has finished playing, <b>false</b> if the node is playing | ||
* <code>msg.connectionerror</code> <b>true</b> when the node cannot connect to the Sonos device, <b>false</b> if the connection is restored.<br/> | ||
## COPY/PASTE IN YOUR NODE-RED FLOW | ||
<details><summary>View code</summary> | ||
> Adjust the nodes according to your setup | ||
```js | ||
@@ -248,3 +252,19 @@ [ | ||
``` | ||
</details> | ||
<br/><br/><br/> | ||
# OWNFILE NODE CONFIGURATION | ||
<img src='https://github.com/Supergiovane/node-red-contrib-sonospollytts/raw/master/img/sampleOwnFile.png' width="80%"> | ||
This node allow you to upload your custom message and play it via SonosPollyTTS without the need of an internet connection. You can use it, for example, with your alarm panel, to annuce a zone breach, a doorbell or so. | ||
**Name**<br/> | ||
Node name | ||
**File to be player**<br/> | ||
Select a file to be played. You can upload one or multiple files at the same time via the "upload" button. | ||
@@ -251,0 +271,0 @@ [license-image]: https://img.shields.io/badge/license-MIT-blue.svg |
@@ -541,4 +541,4 @@ module.exports = function (RED) { | ||
// Change the temp dir acccordingly, to a folder inside the current path of sonospollytts | ||
config.dir=__dirname + "/ttspermanentfiles" | ||
}; | ||
config.dir = __dirname + "/ttspermanentfiles" | ||
}; | ||
@@ -625,3 +625,3 @@ // 03/06/2019 you can select the temp dir | ||
// 03/06/2019 Move the hailing file from the original location (shipped with SonosPollyTTS) to the temp folder. | ||
@@ -646,4 +646,4 @@ if (node.sHailingFile != "") { | ||
node.setNodeStatus({ | ||
@@ -716,3 +716,2 @@ fill: 'green', | ||
} | ||
}); | ||
@@ -733,4 +732,2 @@ | ||
res.setHeader('Content-Disposition', 'attachment; filename=tts.mp3') | ||
@@ -966,2 +963,12 @@ if (fs.existsSync(query.f)) { | ||
// 27/02/2020 Handling OwnFile | ||
if (msg.indexOf("OwnFile_") !== -1) { | ||
RED.log.info('SonosPollyTTS: OwnFile .MP3, skip polly, filename: ' + msg); | ||
var newPath = __dirname + "/ttspermanentfiles/" + msg; | ||
PlaySonos(newPath, node); | ||
return; | ||
} | ||
// If the msg contains a string .mp3, skip polly and go to Playsonos | ||
@@ -968,0 +975,0 @@ if (msg.indexOf(".mp3") !== -1) { |
Sorry, the diff of this file is not supported yet
508618
15
1057
273
8
2
+ Addedformidable@1.2.2
+ Addedformidable@1.2.2(transitive)