diff --git a/examples/followUpResponse/LockUnlock.json b/examples/followUpResponse/LockUnlock.json new file mode 100644 index 00000000..e978bbb6 --- /dev/null +++ b/examples/followUpResponse/LockUnlock.json @@ -0,0 +1 @@ +[{"id":"b03069f913a7af47","type":"google-device","z":"1797c1fc2aa93477","client":"d7ec4b2f72adc483","name":"Frontdoor","nicknames":"Voordeur","topic":"LockUnlock","online":true,"room_hint":"Corridor","device_type":"LOCK","trait_appselector":false,"trait_channel":false,"trait_inputselector":false,"trait_mediastate":false,"trait_onoff":false,"trait_transportcontrol":false,"trait_modes":false,"trait_volume":false,"trait_toggles":false,"trait_brightness":false,"trait_colorsetting":false,"appselector_file":"applications_.json","appselector_type":"str","channel_file":"channels_.json","channel_type":"str","inputselector_file":"inputs_.json","inputselector_type":"str","command_only_input_selector":false,"ordered_inputs":false,"support_activity_state":false,"support_playback_state":false,"command_query_onoff":"","supported_commands":["CAPTION_CONTROL","NEXT","PAUSE","PREVIOUS","RESUME","SEEK_RELATIVE","SEEK_TO_POSITION","SET_REPEAT","SHUFFLE","STOP"],"volume_max_level":100,"volume_can_mute_and_unmute":true,"volume_default_percentage":40,"level_step_size":1,"command_only_volume":false,"command_only_brightness":false,"command_only_colorsetting":false,"color_model":"temp","temperature_min_k":2000,"temperature_max_k":9000,"modes_file":"modes_.json","modes_type":"str","command_query_modes":"","toggles_file":"toggles_.json","toggles_type":"str","command_query_toggles":"","trait_camerastream":false,"hls":"","hls_app_id":"","dash":"","dash_app_id":"","smooth_stream":"","smooth_stream_app_id":"","progressive_mp4":"","progressive_mp4_app_id":"","webrtc":"","webrtc_offer":"","webrtc_ice_servers":"","webrtc_ice_servers_type":"str","auth_token":"","topic_filter":false,"passthru":false,"persistent_state":true,"trait_scene":false,"scene_reversible":true,"trait_timer":false,"trait_temperaturesetting":false,"max_timer_limit_sec":86400,"command_only_timer":false,"available_thermostat_modes":["off","heat","cool","on","heatcool","auto","fan-only","purifier","eco","dry"],"min_threshold_celsius":0,"max_threshold_celsius":40,"thermostat_temperature_unit":"C","buffer_range_celsius":2,"command_query_temperaturesetting":"","trait_temperaturecontrol":false,"tc_min_threshold_celsius":0,"tc_max_threshold_celsius":40,"tc_temperature_step_celsius":1,"tc_temperature_unit_for_ux":"C","tc_command_query_temperaturecontrol":"","trait_humiditysetting":false,"min_percent":0,"max_percent":100,"command_query_humiditysetting":"","trait_dock":false,"trait_locator":false,"trait_lockunlock":true,"trait_reboot":false,"trait_openclose":false,"discrete_only_openclose":false,"open_direction":[],"command_query_openclose":"","trait_startstop":false,"pausable":false,"available_zones":[],"trait_runcycle":false,"trait_softwareupdate":false,"trait_rotation":false,"supports_degrees":true,"supports_percent":true,"rotation_degrees_min":0,"rotation_degrees_max":360,"supports_continuous_rotation":false,"command_only_rotation":false,"trait_lighteffects":false,"default_sleep_duration":1800,"default_wake_duration":1800,"supported_effects":["colorLoop","sleep","wake"],"trait_statusreport":false,"trait_cook":false,"supported_cooking_modes":[],"food_presets_file":"foodPresets_.json","food_presets_type":"str","trait_fanspeed":false,"reversible":false,"supports_fan_speed_percent":false,"fan_speeds_ordered":false,"command_only_fanspeed":false,"available_fan_speeds_file":"availableFanSpeeds_.json","available_fan_speeds_type":"str","trait_sensorstate":false,"sensor_states_supported":[],"arm_levels_ordered":false,"trait_fill":false,"available_fill_levels_file":"availableFillLevels_.json","available_fill_levels_type":"str","supports_fill_percent":false,"ordered_fill_levels":true,"trait_armdisarm":false,"available_arm_levels_file":"availableArmLevels_.json","available_arm_levels_type":"str","trait_energystorage":false,"is_rechargeable":false,"query_only_energy_storage":false,"energy_storage_distance_unit_for_ux":"","trait_dispense":false,"supported_dispense_items_file":"supportedDispenseItems_.json","supported_dispense_items_type":"str","supported_dispense_presets_file":"supportedDispensePresets_.json","supported_dispense_presets_type":"str","trait_networkcontrol":false,"supports_enabling_guest_network":false,"supports_disabling_guest_network":false,"supports_getting_guest_network_password":false,"network_profiles":[],"supports_enabling_network_profile":false,"supports_disabling_network_profile":false,"supports_network_download_speedtest":false,"supports_network_upload_speedtest":false,"trait_objectdetection":false,"show_trait":"selected","advanced_settings":true,"ct_appselector":"","ct_armdisarm":"","ct_brightness":"","ct_camerastream":"","ct_channel":"","ct_colorsetting":"","ct_cook":"","ct_dispense":"","ct_dock":"","ct_energystorage":"","ct_fanspeed":"","ct_fill":"","ct_humiditysetting":"","ct_inputselector":"","ct_lighteffects":"","ct_locator":"","ct_lockunlock":"","ct_mediastate":"","ct_modes":"","ct_networkcontrol":"","ct_objectdetection":"","ct_onoff":"","ct_openclose":"","ct_reboot":"","ct_rotation":"","ct_runcycle":"","ct_scene":"","ct_sensorstate":"","ct_softwareupdate":"","ct_startstop":"","ct_statusreport":"","ct_temperaturecontrol":"","ct_temperaturesetting":"","ct_timer":"","ct_toggles":"","ct_transportcontrol":"","ct_volume":"","pin_appselector":"","pin_armdisarm":"","pin_brightness":"","pin_camerastream":"","pin_channel":"","pin_colorsetting":"","pin_cook":"","pin_dispense":"","pin_dock":"","pin_energystorage":"","pin_fanspeed":"","pin_fill":"","pin_humiditysetting":"","pin_inputselector":"","pin_lighteffects":"","pin_locator":"","pin_lockunlock":"","pin_mediastate":"","pin_modes":"","pin_networkcontrol":"","pin_objectdetection":"","pin_onoff":"","pin_openclose":"","pin_reboot":"","pin_rotation":"","pin_runcycle":"","pin_scene":"","pin_sensorstate":"","pin_softwareupdate":"","pin_startstop":"","pin_statusreport":"","pin_temperaturecontrol":"","pin_temperaturesetting":"","pin_timer":"","pin_toggles":"","pin_transportcontrol":"","pin_volume":"","x":580,"y":4700,"wires":[["e54a77dd1ee15a33"]]},{"id":"e54a77dd1ee15a33","type":"function","z":"1797c1fc2aa93477","name":"Function Out Lock/Unlock","func":"flow.set(\"lockUnlockFrontDoorToken\", msg.params.followUpToken);\n\nif (msg.params.lock === true) {\n msg.payload = \"lock\";\n }\n else if (msg.params.lock === false) {\n msg.payload = \"unlock\";\n }\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":4700,"wires":[["a92fd6ba749b5130"]]},{"id":"13df2ee093171617","type":"function","z":"1797c1fc2aa93477","name":"Return Result","func":"msg.topic = \"LockUnlock\";\nif (msg.payload === \"closed\") {\nmsg.payload =\n {\n \"status\": \"SUCCESS\",\n \"isLocked\": true,\n \"followUpToken\": flow.get (\"lockUnlockFrontDoorToken\")\n };\n} else if (msg.payload === \"open\") {\n msg.payload =\n {\n \"status\": \"SUCCESS\",\n \"isLocked\": false,\n \"followUpToken\": flow.get (\"lockUnlockFrontDoorToken\")\n }\n}\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":4700,"wires":[["b03069f913a7af47"]]},{"id":"e7d8cfafa9e29b47","type":"inject","z":"1797c1fc2aa93477","name":"Closed","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"closed","payloadType":"str","x":170,"y":4680,"wires":[["13df2ee093171617"]]},{"id":"701cdf97031e51df","type":"inject","z":"1797c1fc2aa93477","name":"Open","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"open","payloadType":"str","x":170,"y":4720,"wires":[["13df2ee093171617"]]},{"id":"a92fd6ba749b5130","type":"debug","z":"1797c1fc2aa93477","name":"debug 250","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":4700,"wires":[]},{"id":"cbd814eb063f2899","type":"comment","z":"1797c1fc2aa93477","name":"READ ME","info":"It is assumed that the response from the device\n(Frontdoor) in case of a **closed door** returns a \n**msg.payload = \"closed\"**\nIn case of an **open door** the device responds with\n**msg.payload = \"open\"**.","x":340,"y":4640,"wires":[]},{"id":"302922b0a4640561","type":"comment","z":"1797c1fc2aa93477","name":"READ ME","info":"It is assumed that the command to the device\n(Frontdoor) in case you want **to close** the\nFrondoor has to be **msg.payload = \"lock\"**\nIn case you want **to open** the Frontdoor the command\nhas to be **msg.payload = \"unlock\"**.","x":780,"y":4640,"wires":[]},{"id":"d7ec4b2f72adc483","type":"googlesmarthome-client","name":"Jonas","enabledebug":false,"default_lang":"en","usegooglelogin":true,"usehttpnoderoot":false,"port":"3001","httppath":"","ssloffload":false,"local_scan_type":"MDNS","local_scan_port":"","localport":"18080","accesstokenduration":"60","reportinterval":"60","request_sync_delay":"2","set_state_delay":"2"}] \ No newline at end of file diff --git a/examples/followUpResponse/NetworkControl.json b/examples/followUpResponse/NetworkControl.json new file mode 100644 index 00000000..d5a7a4a7 --- /dev/null +++ b/examples/followUpResponse/NetworkControl.json @@ -0,0 +1 @@ +[{"id":"8ae8518303932635","type":"function","z":"1797c1fc2aa93477","name":"Return Result","func":"let downloadSpeed = Number(parseFloat(msg.payload.download.bandwidth / 125000).toFixed(2));\nlet uploadSpeed = Number(parseFloat(msg.payload.upload.bandwidth / 125000).toFixed(2));\n\nmsg.topic = \"NetworkControl\";\nmsg.payload =\n{\n \"status\": \"SUCCESS\",\n \"networkDownloadSpeedMbps\": downloadSpeed,\n \"networkUploadSpeedMbps\": uploadSpeed,\n \"followUpToken\": flow.get (\"networkTestRouterToken\")\n};\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":4860,"wires":[["f56434c4abd08ec4"]]},{"id":"c315f0906deee944","type":"function","z":"1797c1fc2aa93477","name":"Start Test","func":"flow.set(\"networkTestRouterToken\", msg.params.followUpToken);\nmsg.payload = \"on\";\nmsg.topic = \"speedtest/cmd\";\n \nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":4860,"wires":[["5804d58708b9880a"]]},{"id":"f56434c4abd08ec4","type":"google-device","z":"1797c1fc2aa93477","client":"d7ec4b2f72adc483","name":"Testrouter","nicknames":"","topic":"","online":true,"room_hint":"","device_type":"NETWORK","trait_appselector":false,"trait_channel":false,"trait_inputselector":false,"trait_mediastate":false,"trait_onoff":false,"trait_transportcontrol":false,"trait_modes":false,"trait_volume":false,"trait_toggles":false,"trait_brightness":false,"trait_colorsetting":false,"appselector_file":"applications_.json","appselector_type":"str","channel_file":"channels_.json","channel_type":"str","inputselector_file":"inputs_.json","inputselector_type":"str","command_only_input_selector":false,"ordered_inputs":false,"support_activity_state":false,"support_playback_state":false,"command_query_onoff":"","supported_commands":["CAPTION_CONTROL","NEXT","PAUSE","PREVIOUS","RESUME","SEEK_RELATIVE","SEEK_TO_POSITION","SET_REPEAT","SHUFFLE","STOP"],"volume_max_level":100,"volume_can_mute_and_unmute":true,"volume_default_percentage":40,"level_step_size":1,"command_only_volume":false,"command_only_brightness":false,"command_only_colorsetting":false,"color_model":"temp","temperature_min_k":2000,"temperature_max_k":9000,"modes_file":"modes_.json","modes_type":"str","command_query_modes":"","toggles_file":"toggles_.json","toggles_type":"str","command_query_toggles":"","trait_camerastream":false,"hls":"","hls_app_id":"","dash":"","dash_app_id":"","smooth_stream":"","smooth_stream_app_id":"","progressive_mp4":"","progressive_mp4_app_id":"","webrtc":"","webrtc_offer":"","webrtc_ice_servers":"","webrtc_ice_servers_type":"str","auth_token":"","topic_filter":false,"passthru":false,"persistent_state":false,"trait_scene":false,"scene_reversible":true,"trait_timer":false,"trait_temperaturesetting":false,"max_timer_limit_sec":86400,"command_only_timer":false,"available_thermostat_modes":["off","heat","cool","on","heatcool","auto","fan-only","purifier","eco","dry"],"min_threshold_celsius":0,"max_threshold_celsius":40,"thermostat_temperature_unit":"C","buffer_range_celsius":2,"command_query_temperaturesetting":"","trait_temperaturecontrol":false,"tc_min_threshold_celsius":0,"tc_max_threshold_celsius":40,"tc_temperature_step_celsius":1,"tc_temperature_unit_for_ux":"C","tc_command_query_temperaturecontrol":"","trait_humiditysetting":false,"min_percent":0,"max_percent":100,"command_query_humiditysetting":"","trait_dock":false,"trait_locator":false,"trait_lockunlock":false,"trait_reboot":false,"trait_openclose":false,"discrete_only_openclose":false,"open_direction":[],"command_query_openclose":"","trait_startstop":false,"pausable":false,"available_zones":[],"trait_runcycle":false,"trait_softwareupdate":false,"trait_rotation":false,"supports_degrees":true,"supports_percent":true,"rotation_degrees_min":0,"rotation_degrees_max":360,"supports_continuous_rotation":false,"command_only_rotation":false,"trait_lighteffects":false,"default_sleep_duration":1800,"default_wake_duration":1800,"supported_effects":["colorLoop","sleep","wake"],"trait_statusreport":false,"trait_cook":false,"supported_cooking_modes":[],"food_presets_file":"foodPresets_.json","food_presets_type":"str","trait_fanspeed":false,"reversible":false,"supports_fan_speed_percent":false,"fan_speeds_ordered":false,"command_only_fanspeed":false,"available_fan_speeds_file":"availableFanSpeeds_.json","available_fan_speeds_type":"str","trait_sensorstate":false,"sensor_states_supported":[],"arm_levels_ordered":false,"trait_fill":false,"available_fill_levels_file":"availableFillLevels_.json","available_fill_levels_type":"str","supports_fill_percent":false,"ordered_fill_levels":true,"trait_armdisarm":false,"available_arm_levels_file":"availableArmLevels_.json","available_arm_levels_type":"str","trait_energystorage":false,"is_rechargeable":false,"query_only_energy_storage":false,"energy_storage_distance_unit_for_ux":"","trait_dispense":false,"supported_dispense_items_file":"supportedDispenseItems_.json","supported_dispense_items_type":"str","supported_dispense_presets_file":"supportedDispensePresets_.json","supported_dispense_presets_type":"str","trait_networkcontrol":true,"supports_enabling_guest_network":false,"supports_disabling_guest_network":false,"supports_getting_guest_network_password":false,"network_profiles":[],"supports_enabling_network_profile":false,"supports_disabling_network_profile":false,"supports_network_download_speedtest":true,"supports_network_upload_speedtest":true,"trait_objectdetection":false,"show_trait":"selected","advanced_settings":true,"ct_appselector":"","ct_armdisarm":"","ct_brightness":"","ct_camerastream":"","ct_channel":"","ct_colorsetting":"","ct_cook":"","ct_dispense":"","ct_dock":"","ct_energystorage":"","ct_fanspeed":"","ct_fill":"","ct_humiditysetting":"","ct_inputselector":"","ct_lighteffects":"","ct_locator":"","ct_lockunlock":"","ct_mediastate":"","ct_modes":"","ct_networkcontrol":"","ct_objectdetection":"","ct_onoff":"","ct_openclose":"","ct_reboot":"","ct_rotation":"","ct_runcycle":"","ct_scene":"","ct_sensorstate":"","ct_softwareupdate":"","ct_startstop":"","ct_statusreport":"","ct_temperaturecontrol":"","ct_temperaturesetting":"","ct_timer":"","ct_toggles":"","ct_transportcontrol":"","ct_volume":"","pin_appselector":"","pin_armdisarm":"","pin_brightness":"","pin_camerastream":"","pin_channel":"","pin_colorsetting":"","pin_cook":"","pin_dispense":"","pin_dock":"","pin_energystorage":"","pin_fanspeed":"","pin_fill":"","pin_humiditysetting":"","pin_inputselector":"","pin_lighteffects":"","pin_locator":"","pin_lockunlock":"","pin_mediastate":"","pin_modes":"","pin_networkcontrol":"","pin_objectdetection":"","pin_onoff":"","pin_openclose":"","pin_reboot":"","pin_rotation":"","pin_runcycle":"","pin_scene":"","pin_sensorstate":"","pin_softwareupdate":"","pin_startstop":"","pin_statusreport":"","pin_temperaturecontrol":"","pin_temperaturesetting":"","pin_timer":"","pin_toggles":"","pin_transportcontrol":"","pin_volume":"","x":590,"y":4860,"wires":[["c315f0906deee944"]]},{"id":"c703e27ba4a49744","type":"comment","z":"1797c1fc2aa93477","name":"READ ME","info":"In this example it is assumed that the Network\nSpeed Test from OOKLA will be used.\nThis is the same Network Speed Test, \nthat is used by the Node-RED contrib node.\nhttps://flows.nodered.org/node/node-red-contrib-speedtest\n\nIt will present both for the download and upload speed\nthe bandwidth in bytes per second.\nSee: https://github.com/ddsol/speedtest.net#data","x":340,"y":4800,"wires":[]},{"id":"95a8970ed8e29bcc","type":"comment","z":"1797c1fc2aa93477","name":"READ ME","info":"It is assumed that the command to **start** the\nNetwork Speed Test will be a **msg.payload = \"on\"**,\nwith a **msg.topic = \"speedtest/cmd**\".","x":800,"y":4800,"wires":[]},{"id":"5804d58708b9880a","type":"debug","z":"1797c1fc2aa93477","name":"debug 251","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":4860,"wires":[]},{"id":"d1f30187b33f7f99","type":"inject","z":"1797c1fc2aa93477","name":"Test Results","props":[{"p":"payload.download.bandwidth","v":"24985069","vt":"num"},{"p":"payload.upload.bandwidth","v":"26297282","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":4860,"wires":[["8ae8518303932635"]]},{"id":"d7ec4b2f72adc483","type":"googlesmarthome-client","name":"Jonas","enabledebug":false,"default_lang":"en","usegooglelogin":true,"usehttpnoderoot":false,"port":"3001","httppath":"","ssloffload":false,"local_scan_type":"MDNS","local_scan_port":"","localport":"18080","accesstokenduration":"60","reportinterval":"60","request_sync_delay":"2","set_state_delay":"2"}] \ No newline at end of file