mikejac / node-red-contrib-google-smarthome

A collection of Node-RED nodes to control your smart home devices via Google Assistant.
GNU General Public License v3.0
116 stars 36 forks source link

FollowUpResponse - anyone? #476

Closed patrik-malina closed 5 months ago

patrik-malina commented 7 months ago

Anyone managed to setup followup response? I'm trying to do response on network speed: https://developers.home.google.com/cloud-to-cloud/traits/networkcontrol

This is mine flow: [{"id":"0599fe37b3a4c91c","type":"poll-state","z":"aa342ddbb02b2bce","name":"Guest net","server":"705207ff.d4d2f8","version":3,"exposeAsEntityConfig":"","updateInterval":"1","updateIntervalType":"num","updateIntervalUnits":"minutes","outputInitially":true,"outputOnChanged":true,"entityId":"switch.gosti","stateType":"habool","ifState":"","ifStateType":"str","ifStateOperator":"is","outputs":1,"outputProperties":[{"property":"gosti","propertyType":"msg","value":"","valueType":"entityState"}],"x":80,"y":2960,"wires":[["5dbcb7fa58731ffb"]]},{"id":"5dbcb7fa58731ffb","type":"function","z":"aa342ddbb02b2bce","name":"","func":"var newMsg = {payload: {}};\n\nnewMsg.payload.networkEnabled = true;\nnewMsg.payload.networkSettings = {ssid: \"Home\"};\n\nnewMsg.payload.guestNetworkEnabled = msg.gosti;\nnewMsg.payload.guestNetworkSettings = {ssid: \"Guests\"};\nnewMsg.payload.guestNetworkPassword = \"onlyforguests\";\n\nvar home = global.get(\"homeassistant\").homeAssistant.states['sensor.home'].state;\nvar home5 = global.get(\"homeassistant\").homeAssistant.states['sensor.home_5g'].state;\nvar iot = global.get(\"homeassistant\").homeAssistant.states['sensor.iot'].state;\n\nnewMsg.payload.numConnectedDevices = parseInt(home) + parseInt(home5) + parseInt(iot);\n\n\nreturn newMsg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":175,"y":2960,"wires":[["168a0d0abbcc097f"]],"l":false},{"id":"168a0d0abbcc097f","type":"google-device","z":"aa342ddbb02b2bce","client":"a65d046b0fe19232","name":"Router","nicknames":"Gateway; Network router; Acces point; Wifi; AP","topic":"","online":true,"room_hint":"Server room","device_type":"ROUTER","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_<id>.json","appselector_type":"str","channel_file":"channels_<id>.json","channel_type":"str","inputselector_file":"inputs_<id>.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_<id>.json","modes_type":"str","command_query_modes":"","toggles_file":"toggles_<id>.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":true,"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_<id>.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_<id>.json","available_fan_speeds_type":"str","trait_sensorstate":false,"sensor_states_supported":[],"arm_levels_ordered":false,"trait_fill":false,"available_fill_levels_file":"availableFillLevels_<id>.json","available_fill_levels_type":"str","supports_fill_percent":false,"ordered_fill_levels":true,"trait_armdisarm":false,"available_arm_levels_file":"availableArmLevels_<id>.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_<id>.json","supported_dispense_items_type":"str","supported_dispense_presets_file":"supportedDispensePresets_<id>.json","supported_dispense_presets_type":"str","trait_networkcontrol":true,"supports_enabling_guest_network":true,"supports_disabling_guest_network":true,"supports_getting_guest_network_password":true,"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":"ackNeeded","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":300,"y":2960,"wires":[["8af865884a21aa33"]]},{"id":"4734f95023eb25b5","type":"function","z":"aa342ddbb02b2bce","name":"","func":"var newMsg = {payload: {}};\nvar d = new Date();\nvar token = flow.get(\"token\");\n\nvar dspeed = parseFloat(global.get(\"homeassistant\").homeAssistant.states['sensor.speedtest_download'].state);\nvar uspeed = parseFloat(global.get(\"homeassistant\").homeAssistant.states['sensor.speedtest_upload'].state);\n\nvar timestamp = d.getTime() / 1000;\n\nnewMsg.payload.lastNetworkDownloadSpeedTest = {\"downloadSpeedMbps\": dspeed, \"unixTimestampSec\": timestamp, \"status\": \"SUCCESS\"};\nnewMsg.payload.lastNetworkUploadSpeedTest = {\"uploadSpeedMbps\": uspeed, \"unixTimestampSec\": timestamp, \"status\": \"SUCCESS\"};\n\n//newMsg.payload.NetworkControl.priority = 0;\n//newMsg.payload.NetworkControl.followUpResponse = {\"status\": \"SUCCESS\", \"networkDownloadSpeedMbps\": dspeed, \"networkUploadSpeedMbps\": uspeed, \"followUpToken\": token};\n\nnewMsg.payload = { \"NetworkControl\": { \"priority\": 0, \"followUpResponse\": { \"status\": \"SUCCESS\", \"networkDownloadSpeedMbps\": dspeed, \"networkUploadSpeedMbps\": uspeed, \"followUpToken\": token } } }; \n\nreturn newMsg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":655,"y":2960,"wires":[["168a0d0abbcc097f"]],"l":false},{"id":"8af865884a21aa33","type":"switch","z":"aa342ddbb02b2bce","name":"","property":"command","propertyType":"msg","rules":[{"t":"eq","v":"TestNetworkSpeed","vt":"str"},{"t":"eq","v":"EnableDisableGuestNetwork","vt":"str"},{"t":"eq","v":"Reboot","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":415,"y":2960,"wires":[["39dcbd77d37f18e7"],["fb70d2e5bf65e64a"],["6fe6fdb7c5c79239"]],"outputLabels":["test","guest","reboot"],"l":false},{"id":"63e77ac7d24dbc5f","type":"api-call-service","z":"aa342ddbb02b2bce","name":"speed","server":"705207ff.d4d2f8","version":5,"debugenabled":false,"domain":"homeassistant","service":"update_entity","areaId":[],"deviceId":[],"entityId":["sensor.speedtest_download","sensor.speedtest_upload"],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"last","x":570,"y":2960,"wires":[["4734f95023eb25b5"]]},{"id":"fb70d2e5bf65e64a","type":"function","z":"aa342ddbb02b2bce","name":"","func":"var newMsg = {payload: {}};\n\nif (msg.payload.guestNetworkEnabled){\n newMsg.payload = \"on\" \n} else newMsg.payload = \"off\";\n\nreturn newMsg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":515,"y":3020,"wires":[["c8c84bd0ee50b509"]],"l":false},{"id":"6fe6fdb7c5c79239","type":"api-call-service","z":"aa342ddbb02b2bce","name":"reboot","server":"705207ff.d4d2f8","version":5,"debugenabled":false,"domain":"button","service":"","areaId":[],"deviceId":[],"entityId":["button.u6_lite_restart"],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":530,"y":3080,"wires":[[]]},{"id":"39dcbd77d37f18e7","type":"function","z":"aa342ddbb02b2bce","name":"","func":"var newMsg = {payload: {}};\nflow.set(\"token\", msg.params.followUpToken);\n\nnewMsg.payload.networkSpeedTestInProgress = true;\n\nreturn newMsg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":485,"y":2960,"wires":[["63e77ac7d24dbc5f"]],"l":false},{"id":"c8c84bd0ee50b509","type":"api-call-service","z":"aa342ddbb02b2bce","name":"toggle","server":"705207ff.d4d2f8","version":5,"debugenabled":false,"domain":"switch","service":"turn_{{payload}}","areaId":[],"deviceId":[],"entityId":["switch.gosti"],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":3020,"wires":[[]]},{"id":"705207ff.d4d2f8","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"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":"a65d046b0fe19232","type":"googlesmarthome-client","name":"Home","enabledebug":false,"default_lang":"en","usegooglelogin":false,"usehttpnoderoot":false,"port":"3001","httppath":"","ssloffload":true,"local_scan_type":"","local_scan_port":"","localport":"","accesstokenduration":"60","reportinterval":"60","request_sync_delay":"","set_state_delay":""}]

Also cannot trigger get guest wifi password command.

patrik-malina commented 6 months ago

Anyone tried this? I would be good to have example.

Caprico85 commented 6 months ago

Judging by the code, the correct command would be this:

[{"id":"8ed8a4fe4b8f0d22","type":"inject","z":"ba4ea2f93145cb4f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"networkcontrol","payload":"{\"status\":\"SUCCESS\",\"networkDownloadSpeedMbps\":23.3,\"networkUploadSpeedMbps\":10.2,\"followUpToken\":\"1234\"}","payloadType":"json","x":290,"y":1020,"wires":[["168a0d0abbcc097f"]]}]

Cannot test it though. I haven't found the correct (german) voice command to trigger a speed test.

patrik-malina commented 6 months ago

German word "Wie hoch ist meine Netzwerkgeschwindigkeit?" is working for me fine. (google translate :) Screenshot (2)

I cannot find difference yours inject compared to mine function, except you are using topic instead nesting payload.

This is what I got from GA node: Screenshot (3) Notice token...

Then this is what i send to GA back: Screenshot (5) Using same token...

Assistant knows results, but never answers it back: 20240203_102505

Caprico85 commented 6 months ago

I got Google to understand my command. The last days I was at my parents apartment. I thought when I'm asking with my phone, which is connected to my account, it should work. But it didn't. Now I'm back in my apartment. Asking using my smart speaker, Google understands. But same results as you. "testing your network speed ..." and then nothing.

But I'm afraid there is nothing we can do. I had a look at Google's issue tracker. Both problems are already known there. So it's not our fault, it must be fixed by Google. TestNetworkSpeed is known since 2021 and won't be fixed (source). GetGuestPassword is known since 2020 and is still pending (source).

FireWizard52 commented 6 months ago

Hello @Caprico85

Please could you reopen this comment. I have been in doubt, whether I would request to open this issue or to start a new discussion, but decided to reopen it

The issue, first posted by @patrik-malina picked up my attention.

I created a flow as shown below:

Screenshot_Node-Red_Network_flow

You have to know my setup.

I run OOKLA speed test on my server/gateway. To start a test I post a payload "on" with topic "speedtest/cmd" to my MQTT server. After a successful test a MQTT result is returned with topic "speedtest/status". Node-RED with Google Smarthome devices runs on a Raspberry Pi 3B+ on the network. So a different machine. The reason, that I run OOKLA speed test on the server is to avoid throttling by the network port of the Pi.

If I issue a command, like "Ok Google, what is my network speed?" the Google Smarthome Device node outputs the following:

Screenshot_Node-Red_Network_flow_Debug Smarthome_Device

This is correct and I send a "on" command to the MQTT output node in order to start the test on the server/gateway.

My Google Home Mini speaker, responds accordingly and that he/she will tell me the results shortly.

Indeed, as soon as, I receive the result as shown below:

Screenshot_Node-Red_Network_flow_Debug MQTT-In

I convert this to:

Screenshot_Node-Red_Network_flow_Debug Return Result

I hear a bling and the result is nicely pronounced. So far so good, I do not believe that regarding this, there is an issue,

If I check the Google issue tracker, I see:

The reason why TestNetworkSpeed command for trait action.devices.traits.NetworkControl does not work can be related to the fact that it depends on follow-up notifications (https://developers.google.com/assistant/smarthome/develop/notifications) which are not supported by the phones. So when the request is issued from a phone, it won't work. But as a solution you can use a Nest Hub. The current architecture does not support this and we will be updating our documentation to represent this more accurately.

However 1 person responds, that he also noticed it on a Google Nest Hub, but as you already said, this is a long time ago and since then the Google Devices has been updated several times.

However I noticed a few issues.

  1. On a Google Nest Mini speaker it works fine. you get the information with an accuracy of 2 digits, behind the decimal point.

  2. On a Google Nest Hub, in case you asked the Hub by voice to start the test, you will receive a nice answer after some time. but the "Big Blue Dot" keeps produce babies.

Screenshot_Google-Nest-Hub_Network-Speed-Active

This will probably last until eternity (not tested). I do not see a possibility to return to a previous screen.

If you touch the button on the screen it does the same but, you will not get a spoken answer.

Screenshot_Google-Nest-Hub_Network-Speed-Test

On the Hub, I do not get a presentation, as show by @patrik-malina in his first post.

  1. Annoying is that the device node only shows "Unknown". I suggest that to change to either "Success" or "Failure" or to show the download/upload speed. "Unknown" suggests a non working device.

Please find my complete flow below:

[{"id":"0de3261e4b421162","type":"mqtt in","z":"1797c1fc2aa93477","name":"","topic":"speedtest/status","qos":"2","datatype":"auto-detect","broker":"7aff5cd755ba2941","nl":false,"rap":true,"rh":0,"inputs":0,"x":240,"y":4340,"wires":[["3eb97d1364d4340f","f99521a7.91a89"]]},{"id":"463518a9e9e358a2","type":"mqtt out","z":"1797c1fc2aa93477","name":"To Speedtest","topic":"","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"7aff5cd755ba2941","x":1070,"y":4340,"wires":[]},{"id":"c291c432a236fdce","type":"debug","z":"1797c1fc2aa93477","name":"debug 240","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":4300,"wires":[]},{"id":"f99521a7.91a89","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\nlet status;\n\nif (msg.payload.type === \"result\") {\n    status = \"SUCCESS\"\n} else {\n    status = \"FAILURE\"\n}\n\nmsg.topic = \"NetworkControl\";\nmsg.payload =\n{\n    \"status\": status,\n    \"networkDownloadSpeedMbps\": downloadSpeed,\n    \"networkUploadSpeedMbps\": uploadSpeed,\n    \"followUpToken\": flow.get (\"token\")\n};\n\nreturn msg","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":4340,"wires":[["c291c432a236fdce","f4b46685fd599df9"]]},{"id":"3eb97d1364d4340f","type":"debug","z":"1797c1fc2aa93477","name":"debug 241","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":4400,"wires":[]},{"id":"da640fed8c7458f5","type":"function","z":"1797c1fc2aa93477","name":"Start Test","func":"if (msg.command === \"TestNetworkSpeed\") {\n    flow.set(\"token\", msg.params.followUpToken);\n    msg.payload = \"on\";\n    msg.topic = \"speedtest/cmd\";\n    \nreturn msg;\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":4340,"wires":[["af5ab80f0cfa148d","463518a9e9e358a2"]]},{"id":"af5ab80f0cfa148d","type":"debug","z":"1797c1fc2aa93477","name":"debug 243","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1070,"y":4300,"wires":[]},{"id":"f4b46685fd599df9","type":"google-device","z":"1797c1fc2aa93477","client":"d7ec4b2f72adc483","name":"Router","nicknames":"Gateway; Network Router","topic":"","online":true,"room_hint":"Kamer Herman","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_<id>.json","appselector_type":"str","channel_file":"channels_<id>.json","channel_type":"str","inputselector_file":"inputs_<id>.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_<id>.json","modes_type":"str","command_query_modes":"","toggles_file":"toggles_<id>.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_<id>.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_<id>.json","available_fan_speeds_type":"str","trait_sensorstate":false,"sensor_states_supported":[],"arm_levels_ordered":false,"trait_fill":false,"available_fill_levels_file":"availableFillLevels_<id>.json","available_fill_levels_type":"str","supports_fill_percent":false,"ordered_fill_levels":true,"trait_armdisarm":false,"available_arm_levels_file":"availableArmLevels_<id>.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_<id>.json","supported_dispense_items_type":"str","supported_dispense_presets_file":"supportedDispensePresets_<id>.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":680,"y":4340,"wires":[["47b9c773db6efcd4","da640fed8c7458f5"]]},{"id":"47b9c773db6efcd4","type":"debug","z":"1797c1fc2aa93477","name":"debug 245","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":890,"y":4400,"wires":[]},{"id":"7aff5cd755ba2941","type":"mqtt-broker","name":"Jonas_MQTT_Server","broker":"192.168.10.24","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"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"}]

Regards

Caprico85 commented 6 months ago

Hi @FireWizard52

I reopened the ticket.

With your flow, I get the spoken response on my Nest Mini too. No idea what I did different on my first try. On the Nest Hub I see the big blue dot "producing babies", but I don't get a spoken response nor do I see the numbers, their boxes or the button on screen.

Nevertheless, I don't know what we could do to fix this. The data we send to Google seems to be correct, otherwise Google wouldn't be able to read or show any numbers. We cannot control the behaviour of the Nest devices though, This is all done by Google. Our only option would be to open another issue on the Google bug tracker and hope Google won't take forever to fix it (or immediately close the issue as duplicate).

Greetings

FireWizard52 commented 6 months ago

Hello @Caprico85

Thank you for reopening this issue. At least we can discuss it now and it is also visible for others. Maybe @patrik-malina wish to contribute in this discussion as well. (How did he get the values displayed?)

As said, with the Google Mini speaker it is working as expected. After some time I receive a response with the correct results. With the Google Nest Hub it is the same. If I speak to the Nest Hub I receive a spoken response. So far so good. However, as soon as I request the Network Speed the screen shows the "Blue dot, while dropping small blue dots".

No idea, how to terminate that, as the test has been finished. I can swipe to the previous screen. The only way, I have found so far, is to restart the Nest Hub.

After start-up I can swipe top-down and the press a Button, called "Connectivity" (with the Wifi symbol), but no values are shown. But, of course there has not been received any Speed Results. So I understand that.

So the Nest acts the same as a Mini speaker, but the display is not really functioning. It is a "Voice Assistant".

Not only the "Network" is using "followUpResponses". This afternoon, I have been able to make the "Lock/Unlock" work with followUpResponse,

I consider to send you a PR for the two functionalities in the "Example" directory, as that will also solve the question in #143 and #435

I would really prefer to have more clarity about the issues with the Nest Hub, before doing that.

Regards

patrik-malina commented 6 months ago

I will later. I'm on vaccination till monday. I think we could together work this out...

FireWizard52 commented 6 months ago

I hope you mean vacation (holiday). Happy holiday

patrik-malina commented 6 months ago

Ahahah, yes. Stupid autocorrect :)

patrik-malina commented 6 months ago

Hello @Caprico85

Thank you for reopening this issue. At least we can discuss it now and it is also visible for others. Maybe @patrik-malina wish to contribute in this discussion as well. (How did he get the values displayed?)

As said, with the Google Mini speaker it is working as expected. After some time I receive a response with the correct results. With the Google Nest Hub it is the same. If I speak to the Nest Hub I receive a spoken response. So far so good. However, as soon as I request the Network Speed the screen shows the "Blue dot, while dropping small blue dots".

No idea, how to terminate that, as the test has been finished. I can swipe to the previous screen. The only way, I have found so far, is to restart the Nest Hub.

After start-up I can swipe top-down and the press a Button, called "Connectivity" (with the Wifi symbol), but no values are shown. But, of course there has not been received any Speed Results. So I understand that.

So the Nest acts the same as a Mini speaker, but the display is not really functioning. It is a "Voice Assistant".

Not only the "Network" is using "followUpResponses". This afternoon, I have been able to make the "Lock/Unlock" work with followUpResponse,

I consider to send you a PR for the two functionalities in the "Example" directory, as that will also solve the question in #143 and #435

I would really prefer to have more clarity about the issues with the Nest Hub, before doing that.

Regards

Yup. If I use your code, i got responses from mini and hub, but also blue dots animation never ends. Will try to investigate further...

patrik-malina commented 6 months ago

[{"id":"f24edce754882b3c","type":"inject","z":"aa342ddbb02b2bce","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"networkSpeedTestInProgress","payload":"false","payloadType":"bool","x":200,"y":5380,"wires":[["168a0d0abbcc097f"]]}]

this stops animation and shows result on mine hub

patrik-malina commented 6 months ago

[{"id":"d59543924c8b2b09","type":"inject","z":"aa342ddbb02b2bce","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"guestNetworkPassword","payload":"OnlyForGuests","payloadType":"str","x":240,"y":5380,"wires":[["168a0d0abbcc097f"]]}]

This is for showing guest pass on hub

patrik-malina commented 6 months ago

This is mine final version for Router node. It does next:

If anyone is willing maybe to simplify this... I don't have more time.

Code: [{"id":"0599fe37b3a4c91c","type":"poll-state","z":"aa342ddbb02b2bce","name":"Guest net","server":"705207ff.d4d2f8","version":3,"exposeAsEntityConfig":"","updateInterval":"1","updateIntervalType":"num","updateIntervalUnits":"minutes","outputInitially":true,"outputOnChanged":true,"entityId":"switch.Guests","stateType":"habool","ifState":"","ifStateType":"str","ifStateOperator":"is","outputs":1,"outputProperties":[{"property":"Guests","propertyType":"msg","value":"","valueType":"entityState"}],"x":80,"y":5280,"wires":[["5dbcb7fa58731ffb","e51f895b25ee57c9"]]},{"id":"5dbcb7fa58731ffb","type":"function","z":"aa342ddbb02b2bce","name":"","func":"var newMsg = {payload: {}};\n\nnewMsg.payload.networkEnabled = true;\nnewMsg.payload.networkSettings = {ssid: \"Home\"};\n\nnewMsg.payload.guestNetworkEnabled = msg.Guests;\nnewMsg.payload.guestNetworkSettings = {ssid: \"Guests\"};\n\nvar home = global.get(\"homeassistant\").homeAssistant.states['sensor.home'].state;\nvar home5 = global.get(\"homeassistant\").homeAssistant.states['sensor.home_5g'].state;\nvar iot = global.get(\"homeassistant\").homeAssistant.states['sensor.iot'].state;\n\nnewMsg.payload.numConnectedDevices = parseInt(home) + parseInt(home5) + parseInt(iot);\n\n\nreturn newMsg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":175,"y":5280,"wires":[["168a0d0abbcc097f"]],"l":false},{"id":"e51f895b25ee57c9","type":"function","z":"aa342ddbb02b2bce","name":"","func":"msg.topic = \"guestNetworkPassword\";\nmsg.payload = \"OnlyForGuests\";\n\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":175,"y":5340,"wires":[["168a0d0abbcc097f"]],"l":false},{"id":"168a0d0abbcc097f","type":"google-device","z":"aa342ddbb02b2bce","client":"a65d046b0fe19232","name":"Router","nicknames":"Network router; Acces point; Wifi; AP","topic":"","online":true,"room_hint":"Server room","device_type":"ROUTER","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_<id>.json","appselector_type":"str","channel_file":"channels_<id>.json","channel_type":"str","inputselector_file":"inputs_<id>.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_<id>.json","modes_type":"str","command_query_modes":"","toggles_file":"toggles_<id>.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":true,"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_<id>.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_<id>.json","available_fan_speeds_type":"str","trait_sensorstate":false,"sensor_states_supported":[],"arm_levels_ordered":false,"trait_fill":false,"available_fill_levels_file":"availableFillLevels_<id>.json","available_fill_levels_type":"str","supports_fill_percent":false,"ordered_fill_levels":true,"trait_armdisarm":false,"available_arm_levels_file":"availableArmLevels_<id>.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_<id>.json","supported_dispense_items_type":"str","supported_dispense_presets_file":"supportedDispensePresets_<id>.json","supported_dispense_presets_type":"str","trait_networkcontrol":true,"supports_enabling_guest_network":true,"supports_disabling_guest_network":true,"supports_getting_guest_network_password":true,"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":"ackNeeded","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":"3125","pin_objectdetection":"","pin_onoff":"","pin_openclose":"","pin_reboot":"3125","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":320,"y":5280,"wires":[["8af865884a21aa33"]]},{"id":"4734f95023eb25b5","type":"function","z":"aa342ddbb02b2bce","name":"","func":"var newMsg = {payload: {}};\nvar token = flow.get(\"token\");\nvar d = new Date();\n\nvar timestamp = d.getTime() / 1000;\n\nvar dspeed = parseFloat(global.get(\"homeassistant\").homeAssistant.states['sensor.speedtest_download'].state);\nvar uspeed = parseFloat(global.get(\"homeassistant\").homeAssistant.states['sensor.speedtest_upload'].state);\n\nnewMsg.topic = \"NetworkControl\";\nnewMsg.payload = {\n \"status\": \"SUCCESS\", \n \"networkDownloadSpeedMbps\": dspeed, \n \"networkUploadSpeedMbps\": uspeed, \n \"followUpToken\": token };\n\nreturn newMsg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":655,"y":5400,"wires":[["168a0d0abbcc097f","b468bb626a8bc0a9"]],"l":false},{"id":"b468bb626a8bc0a9","type":"function","z":"aa342ddbb02b2bce","name":"function 2","func":"var newMsg = { payload: {} };\nvar d = new Date();\nvar timestamp = d.getTime() / 1000;\n\nvar dspeed = parseFloat(global.get(\"homeassistant\").homeAssistant.states['sensor.speedtest_download'].state);\nvar uspeed = parseFloat(global.get(\"homeassistant\").homeAssistant.states['sensor.speedtest_upload'].state);\n\nnewMsg.payload.lastNetworkDownloadSpeedTest = \n{ \n \"downloadSpeedMbps\": dspeed,\n \"unixTimestampSec\": timestamp,\n \"status\": \"SUCCESS\" \n};\nnewMsg.payload.lastNetworkUploadSpeedTest = \n{ \n \"uploadSpeedMbps\": uspeed, \n \"unixTimestampSec\": timestamp, \n \"status\": \"SUCCESS\" \n};\n\nreturn newMsg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":735,"y":5400,"wires":[["168a0d0abbcc097f","a4547e922ced1aeb"]],"l":false},{"id":"7b72602941354628","type":"function","z":"aa342ddbb02b2bce","name":"function 1","func":"flow.set(\"token\", msg.params.followUpToken);\n\nmsg.topic = \"networkSpeedTestInProgress\";\nmsg.payload = true;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":485,"y":5380,"wires":[["63e77ac7d24dbc5f","168a0d0abbcc097f"]],"l":false},{"id":"a4547e922ced1aeb","type":"function","z":"aa342ddbb02b2bce","name":"function 3","func":"\nmsg.topic = \"networkSpeedTestInProgress\";\nmsg.payload = false;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":805,"y":5400,"wires":[["168a0d0abbcc097f"]],"l":false},{"id":"8af865884a21aa33","type":"switch","z":"aa342ddbb02b2bce","name":"","property":"command","propertyType":"msg","rules":[{"t":"eq","v":"Reboot","vt":"str"},{"t":"eq","v":"EnableDisableGuestNetwork","vt":"str"},{"t":"eq","v":"TestNetworkSpeed","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":435,"y":5280,"wires":[["6fe6fdb7c5c79239"],["fb70d2e5bf65e64a"],["7b72602941354628"]],"outputLabels":["reboot","guest","test"],"l":false},{"id":"63e77ac7d24dbc5f","type":"api-call-service","z":"aa342ddbb02b2bce","name":"speed","server":"705207ff.d4d2f8","version":5,"debugenabled":false,"domain":"homeassistant","service":"update_entity","areaId":[],"deviceId":[],"entityId":["sensor.speedtest_download","sensor.speedtest_upload"],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"last","x":570,"y":5400,"wires":[["4734f95023eb25b5"]]},{"id":"6fe6fdb7c5c79239","type":"api-call-service","z":"aa342ddbb02b2bce","name":"reboot","server":"705207ff.d4d2f8","version":5,"debugenabled":false,"domain":"button","service":"press","areaId":[],"deviceId":[],"entityId":["button.u6_lite_restart"],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":550,"y":5260,"wires":[[]]},{"id":"fb70d2e5bf65e64a","type":"function","z":"aa342ddbb02b2bce","name":"","func":"var newMsg = {payload: {}};\n\nif (msg.payload.guestNetworkEnabled){\n newMsg.payload = \"on\" \n} else newMsg.payload = \"off\";\n\nreturn newMsg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":515,"y":5320,"wires":[["c8c84bd0ee50b509"]],"l":false},{"id":"c8c84bd0ee50b509","type":"api-call-service","z":"aa342ddbb02b2bce","name":"toggle","server":"705207ff.d4d2f8","version":5,"debugenabled":false,"domain":"switch","service":"turn_{{payload}}","areaId":[],"deviceId":[],"entityId":["switch.Guests"],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":5320,"wires":[[]]},{"id":"705207ff.d4d2f8","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"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":"a65d046b0fe19232","type":"googlesmarthome-client","name":"Home","enabledebug":false,"default_lang":"en","usegooglelogin":false,"usehttpnoderoot":false,"port":"3001","httppath":"","ssloffload":true,"local_scan_type":"","local_scan_port":"","localport":"","accesstokenduration":"60","reportinterval":"60","request_sync_delay":"","set_state_delay":""}]

Screenshot (9)

20240219_145914

20240219_145927

FireWizard52 commented 6 months ago

Hello @Caprico85 and @patrik-malina

Finally I found some time to look at this Network Test Issue.

As Patrik uses a number of specific Home Assistant nodes, and as not many users use HA, (at least I do not), I tried to make a better example in order to create a new PR, I noticed a couple of things.

  1. For a Google Home Mini it is sufficient to send only:
msg.topic = "NetworkControl";
msg.payload =
{
    "status": "SUCCESS",
    "networkDownloadSpeedMbps": downloadSpeed,
    "networkUploadSpeedMbps": uploadSpeed,
    "followUpToken": flow.get ("networkTestRouterToken")
};

In order to terminate the ongoing network test, which is visible on a Google Nest Hub, you have to send the following:

msg.topic = "networkSpeedTestInProgress";
msg.payload = false;

However I think it is always better, both with a Mini and a Nest Hub, to send both:

msg.topic = "networkSpeedTestInProgress";
msg.payload = true;

and

msg.topic = "networkSpeedTestInProgress";
msg.payload = false;

So far so good. That is working as expected.

In order to get the display on the Nest Hub show the Download and Upload speed, I have to send the following:

let timestamp = new Date(Date.now()).getTime();

msg.payload =
{
    "networkEnabled" : true,

    "lastNetworkDownloadSpeedTest" : {
    "downloadSpeedMbps": 159.8,
    "unixTimestampSec": timestamp,
    "status": "SUCCESS" 
    },

    "lastNetworkUploadSpeedTest" : {
    "uploadSpeedMbps": 64.1, 
    "unixTimestampSec": timestamp, 
    "status": "SUCCESS" 
    }
}    

The example values are copied from the Google Smarthome page.

This is nicely creating an updated display.

However I receive an error

Screenshot_Error_in_HTTP_actions

@patrik-malina: Do you noticed the same.

@Caprico85 I have no clue how to debug this, as I'm not able to find the error. Any support or ideas are appreciated.

Regards

patrik-malina commented 6 months ago

@FireWizard52 yes i had that error. It is due timestap must be in seconds not miliseconds. You need to divide it with 1000.

FireWizard52 commented 6 months ago

@patrik-malina,

Thank you, this solved my issue.

I had noticed that you divided the current timestamp with 1000, but I did not copy it, as I did not see the necessity, because I overlooked it in the documentation and normally the Unix epoch time is equal to the number of seconds that have elapsed since 00:00:00 [UTC] on 1 January 1970. However in Node-RED the timestamp is in milliseconds and not seconds.

Google documentation:

unixTimestampSec    Integer     
The Unix timestamp (**number of seconds** since the Unix Epoch) of when the last network download speed test was run.

I have planned to update the example, so that it will also nicely terminate the Network Speed test on the Nest Hub display and also to display the correct values. And maybe to show an example with the Guest Network password.

Once again, thank you for the hint.

Regards

Caprico85 commented 6 months ago

Working as expected on my Nest Mini and my Nest Hub.

I was almost certain that this is another one of the half-supported and half-broken devices in Google's smarthome section. But you really got it to work. Awesome work, @patrik-malina and @FireWizard52!

FireWizard52 commented 6 months ago

Hello @Caprico85,

I want to discuss one issue.

The "Device" node, if configured as device type: "Network" always shows "Unknown". Normally, if a device indicates "Unknown", this means something is missing or maybe wrong. I would suggest to modify the "Unknown" indication to something else.

As the "Network" device has a number of attributes, such as Enabling/Disabling Guest Network, Selecting profiles, Network Usage, network Speed Test, number of Connected devices. I would think that perhaps the status is the best, so an indication of "Success" or "Failure" What do you think, would be the best?

Regards

patrik-malina commented 5 months ago

496 - Opened new Issue

Caprico85 commented 5 months ago

Changes published in v0.4.11