Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Google Device nodes pass through all inputs to its output when updated #221

Closed
rockstar2020 opened this issue Dec 30, 2021 · 8 comments

Comments

@rockstar2020
Copy link

Hi there,
With the new Google Device nodes I noticed that anytime I update its status by setting the topic to "set" the output node spits out exactly the same input's payload which is problematic for automation.
Imagine you update the status of a thermostat node and the output of the node unexpectedly triggers an API call to set the temprature.
Basically all my automations are now screwed up after this update.

Take a look at below sample flow.
When I click the inject trigger I get exactly the same payload in output which was not the case with older version of the google device nodes.

Appreciate any guidance on how I can fix this issue.

[{"id":"4d331e00d643808f","type":"google-device","z":"006d405f1359c9c7","client":"d4f0165c.9f2998","name":"Soundbar","topic":"soundbar/action","room_hint":"Living Room","device_type":"SOUNDBAR","trait_appselector":false,"trait_channel":false,"trait_inputselector":false,"trait_mediastate":false,"trait_onoff":true,"trait_transportcontrol":false,"trait_modes":false,"trait_volume":true,"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":"{}","inputselector_type":"json","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":"50","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":"","passthru":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":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":540,"y":120,"wires":[["b1eda1ee218766a4"]]},{"id":"d4f0165c.9f2998","type":"googlesmarthome-client","name":"GHome Client","enabledebug":true,"usegooglelogin":false,"usehttpnoderoot":true,"port":"1111","httppath":"","ssloffload":false,"accesstokenduration":"60","reportinterval":"60"}]

image

Many thanks in advance

@rockstar2020
Copy link
Author

rockstar2020 commented Dec 30, 2021

Hi again,
OK, after spending several hours going through your code I noticed where the issue is.
Basically line 2466 in baseDevice.js file should be if (me.passthru) instead of if (!me.passthru).
This is because if pass-through option is disabled, then the node should not pass the input payload to its output.

I appreciate if you could fix it in next release.

Happy Holiday!

Cheers

@ckhmer1
Copy link
Contributor

ckhmer1 commented Jan 1, 2022

The onInput function is called when an input message is received.
If You select the pass-thru option, the original message will be sent in output, otherwise, the updated node state (if it differs from the one before receiving the input message) will be sent in output.

In any case, an input message is needed to send a message in output.

Could You please specify correctly the steps to reproduce the issue?

@Paul-Reed
Copy link
Contributor

Is it possible to feed a msg into the node purely to update homegraph without producing an output?

Example; A Shelly relay connected to a physical light switch, when the user flicks the switch, the state change is fed back to the node purely to update homegraph, so they are in sync, and not to produce a command to change the state.

@ckhmer1
Copy link
Contributor

ckhmer1 commented Jan 1, 2022

I don't think it is possible at the moment to do it.
Should I change the pass through option to three state:

  • none
  • the input message
  • the state only if the state changes
    ?

@Chrischi-
Copy link
Contributor

@ckhmer1
It seems to me that my problem #223 is related to this.

I think the old deprecated devices didn't do that. Only if you had explicitly enabled pass through.
I have exactly the same situation as @Paul-Reed & @rockstar2020 . My shellys are served from another location (manually) and I have to update only the Google Device status without anything getting passed through.
A "none / update" would be ideal.

@rockstar2020
Copy link
Author

@ckhmer1, I think the 2 options of with pass- thru and without pass-thru is sufficient.
As mentioned earlier by making the changes in line 2466 in baseDevice.js everything is working fine now.
My Google device gets updated with the status from input and no output is triggered if pass-thru is not selected in the device node.

@Paul-Reed
Copy link
Contributor

@ckhmer1, I think the 2 options of with pass- thru and without pass-thru is sufficient.

Yes, I agree with @rockstar2020

Most of my flows are written to expect that behaviour now, with most of the processing done before the SH node.
In early stages of development, I constructed the flows with the processing done after the SH node, and then had a feedback loop back into the SH node to update Homegraph.

It may be that I have a better understanding of Smarthome now, than what I had initially, and now I know what to expect, and build my flows accordingly.

@ckhmer1
Copy link
Contributor

ckhmer1 commented Jan 1, 2022

The quick fix should be if (false) for the line 2466, and then the if should be removed completely, if I remember well the flow. I've to check what's happening in all the scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants