Supergiovane / node-red-contrib-tts-ultimate

This node transforms a text into a speech audio. You can hear the voice natively through Sonos or external players.
MIT License
22 stars 5 forks source link

How TTS-Ultimate understands/translates msg.payload sent from another node #70

Closed kars85 closed 1 year ago

kars85 commented 1 year ago

Hi @Supergiovane!

Describe the bug I'm not sure if this is a bug, or if I'm doing something wrong. I have a call service node set to output a msg.payload. I am unsure of the proper syntax of that call service node's msg.payload output in order for TTS-ultimate to speak correctly. Presently, all my speakers say is "payload" instead of the proper string I'm expecting.

To Reproduce See attached node red flow

Expected behavior msg.payload to be interpreted correctly and speak the right string

Screenshots image

TTS-Ultimate Version

Are you running node-red behind homematic, docker or anything similar? Docker

Additional context Here is the export of my simple flow.

[ { "id": "fb106f0953c589ab", "type": "tab", "label": "Flow 2", "disabled": false, "info": "", "env": [] }, { "id": "fad2d312d08edc5d", "type": "server-state-changed", "z": "fb106f0953c589ab", "name": "Indoor Swing Sensors", "server": "e204944a.31bc78", "version": 4, "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "entityidfilter": "binary_sensor.swing_indoor_sensors_only", "entityidfiltertype": "exact", "outputinitially": true, "state_type": "str", "haltifstate": "", "halt_if_type": "str", "halt_if_compare": "is", "outputs": 1, "output_only_on_state_change": true, "for": 0, "forType": "num", "forUnits": "minutes", "ignorePrevStateNull": false, "ignorePrevStateUnknown": false, "ignorePrevStateUnavailable": false, "ignoreCurrentStateUnknown": false, "ignoreCurrentStateUnavailable": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "", "valueType": "triggerId" } ], "x": 320, "y": 320, "wires": [ [ "8abce97126b545bb" ] ] }, { "id": "10b897c87fc08701", "type": "api-current-state", "z": "fb106f0953c589ab", "name": "Home?", "server": "e204944a.31bc78", "version": 3, "outputs": 2, "halt_if": "home", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "group.presence_home", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": 0, "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 750, "y": 360, "wires": [ [ "ad751533e42451a4" ], [] ] }, { "id": "8abce97126b545bb", "type": "switch", "z": "fb106f0953c589ab", "name": "On/Off", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "off", "vt": "str" }, { "t": "eq", "v": "on", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 530, "y": 320, "wires": [ [ "59daab0a9c2e91df" ], [ "10b897c87fc08701" ] ] }, { "id": "ad751533e42451a4", "type": "stoptimer", "z": "fb106f0953c589ab", "duration": "15", "units": "Second", "payloadtype": "num", "payloadval": "0", "name": "", "x": 1140, "y": 300, "wires": [ [ "456b4c6727787658" ], [] ] }, { "id": "f176046f69d4a67c", "type": "api-call-service", "z": "fb106f0953c589ab", "name": "Notify Karson's Phone", "server": "e204944a.31bc78", "version": 5, "debugenabled": true, "domain": "notify", "service": "mobile_app_karsons_iphone", "areaId": [], "deviceId": [], "entityId": [], "data": "{\"message\":\"{{payload}} was left open for more than 15 seconds. Save Mr. Kitty!!\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "{{payload}} was left open for more than 15 seconds. Save Mr. Kitty!!\"", "valueType": "str" } ], "queue": "none", "x": 1760, "y": 240, "wires": [ [ "172f16309f8ac6ad" ] ] }, { "id": "438edab5f2ca3b45", "type": "api-call-service", "z": "fb106f0953c589ab", "name": "Notify Amy's Phone", "server": "e204944a.31bc78", "version": 5, "debugenabled": true, "domain": "notify", "service": "mobile_app_amys_iphone", "areaId": [], "deviceId": [], "entityId": [], "data": "{\"message\":\"{{payload}} was left open for more than 15 seconds. Save Mr. Kitty!!\"}", "dataType": "json", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 1750, "y": 300, "wires": [ [] ] }, { "id": "172f16309f8ac6ad", "type": "ttsultimate", "z": "fb106f0953c589ab", "name": "", "voice": "en-US", "ssml": false, "sonosipaddress": "10.10.100.32", "sonosvolume": "40", "sonoshailing": "Hailing_Hailing.mp3", "config": "a585de9c1021e86d", "property": "payload", "propertyType": {}, "rules": [ { "host": "10.10.100.135", "hostVolumeAdjust": "0" }, { "host": "10.10.100.196", "hostVolumeAdjust": "0" }, { "host": "10.10.100.177", "hostVolumeAdjust": "0" }, { "host": "10.10.100.198", "hostVolumeAdjust": "0" }, { "host": "10.10.100.176", "hostVolumeAdjust": "0" }, { "host": "10.10.100.160", "hostVolumeAdjust": "0" } ], "playertype": "sonos", "speakingrate": "1", "speakingpitch": "0", "unmuteIfMuted": true, "x": 2090, "y": 240, "wires": [ [], [] ] }, { "id": "59daab0a9c2e91df", "type": "change", "z": "fb106f0953c589ab", "name": "Stop Timer", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "stop", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 770, "y": 300, "wires": [ [ "ad751533e42451a4" ] ] }, { "id": "456b4c6727787658", "type": "ha-get-entities", "z": "fb106f0953c589ab", "name": "Which Sensors?", "server": "e204944a.31bc78", "version": 0, "rules": [ { "property": "entity_id", "logic": "in_group", "value": "binary_sensor.swing_indoor_sensors_only", "valueType": "str" }, { "property": "state", "logic": "includes", "value": "on", "valueType": "str" } ], "output_type": "split", "output_empty_results": false, "output_location_type": "msg", "output_location": "payload", "output_results_count": 1, "x": 1300, "y": 380, "wires": [ [ "3ff8effe4570d0ad" ] ] }, { "id": "3ff8effe4570d0ad", "type": "template", "z": "fb106f0953c589ab", "name": "Format Msg", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "{{payload.attributes.friendly_name}}", "output": "str", "x": 1320, "y": 460, "wires": [ [ "b34caa7951060775" ] ] }, { "id": "b34caa7951060775", "type": "join", "z": "fb106f0953c589ab", "name": "", "mode": "custom", "build": "string", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": ", ", "joinerType": "str", "accumulate": false, "timeout": "", "count": "", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 1540, "y": 460, "wires": [ [ "f176046f69d4a67c", "438edab5f2ca3b45" ] ] }, { "id": "e204944a.31bc78", "type": "server", "name": "Home Assistant", "version": 5, "addon": false, "rejectUnauthorizedCerts": false, "ha_boolean": "y|yes|true|on|home|open", "connectionDelay": true, "cacheJson": true, "heartbeat": false, "heartbeatInterval": "30", "areaSelector": "friendlyName", "deviceSelector": "friendlyName", "entitySelector": "friendlyName", "statusSeparator": "at: ", "statusYear": "hidden", "statusMonth": "short", "statusDay": "numeric", "statusHourCycle": "h23", "statusTimeFormat": "h:m", "enableGlobalContextStore": true }, { "id": "a585de9c1021e86d", "type": "ttsultimate-config", "name": "TTS Service", "noderedipaddress": "10.10.100.3", "noderedport": "1980", "purgediratrestart": "purge", "ttsservice": "googletranslate" } ]

Supergiovane commented 1 year ago

Hi Basically, you must pass msg.payload as text. I cannot debug your flow, because i haven’t installed any of your nodes. Please refer to the github readme page for more info. There are tons of samples. Thanks!