i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

example flows on media etc. #80

Closed thomasvjohansen closed 2 years ago

thomasvjohansen commented 2 years ago

I could you please make some example flows for playing mp3 etc. something I can import to node-red and learn from. I cant make your examples to work.

thomasvjohansen commented 2 years ago

finally got one working playing mp3

[{"id":"893970accc994877","type":"device-status","z":"cc5bd9e5.26e4a8","name":"","deviceName":"ringeklokke","bridge":"4101c422.6ee1cc","genericMqttDevice":false,"device":"","x":270,"y":40,"wires":[["ed10bc5a5a0caf65","445efe6d5f9a4759"]]},{"id":"ed10bc5a5a0caf65","type":"delay","z":"cc5bd9e5.26e4a8","name":"","pauseType":"delay","timeout":"8","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":460,"y":80,"wires":[["ade80c3422570a3f"]]},{"id":"445efe6d5f9a4759","type":"function","z":"cc5bd9e5.26e4a8","name":"Doorbell","func":"return {\n payload: {\n app: \"DefaultMediaReceiver\",\n type: \"MEDIA\",\n media: {\n url: \"https://www.zapsplat.com/wp-content/uploads/2015/sound-effects-three/household_door_bell_ding_dong_single.mp3\",\n contentType: \"audio/mp3\", // optional if type can be infered from url file type\n streamType: \"BUFFERED\", // optional unless you want to send LIVE instead\n \n }\n }\n}\n;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":40,"wires":[["7e62e7317331eab9"]]},{"id":"ade80c3422570a3f","type":"function","z":"cc5bd9e5.26e4a8","name":"CLOSE","func":"return {\n payload: {\n app: \"DefaultMediaReceiver\",\n type: \"CLOSE\",\n \n }\n}\n;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":80,"wires":[["7e62e7317331eab9"]]},{"id":"4101c422.6ee1cc","type":"zigbee2mqtt-bridge-config","name":"zigbee2mqtt","broker":"4fd748ea.35adb8","baseTopic":"zigbee2mqtt","enabledLogging":false,"allowDeviceStatusRefresh":false},{"id":"4fd748ea.35adb8","type":"mqtt-broker","name":"MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

i8beef commented 2 years ago

Glad you figured it out. The documentation describes the message format that needs to be passed to the node with generic node-red semantics, though the "close" message you send is a non-obvious usage that could be useful to others (I do the same thing to close the DefaultMediaReceiver after my media plays).

I'll consider adding an example to the documentation for the next release.

thomasvjohansen commented 2 years ago

Great, I also figured out how to control the volume by a dashboard slider, for my dashboard radio. If you want I add this example too.

i8beef commented 2 years ago

Just be aware, Google just lost a patent law suit from Sonos over adjusting volume on speaker groups and they are removing that feature this month. I believe you can still adjust volume on an individual speaker, but you won't be able to do so across a speaker group anymore.