node-red-contrib-google-smarthome
Version:
Lets you control Node-Red via Google Assistant or the Google Home App
623 lines • 17 kB
JSON
[
{
"id": "e813a9ab126b0d7f",
"type": "inject",
"z": "6c9fef1d.18bdb",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payloadType": "str",
"x": 490,
"y": 740,
"wires": [
[
"975f158c4c663c6b"
]
]
},
{
"id": "975f158c4c663c6b",
"type": "change",
"z": "6c9fef1d.18bdb",
"name": "Combining state & brightness",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"on\":true,\"online\":true,\"brightness\":75}",
"tot": "json"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "set",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 740,
"wires": [
[
"1f998b8914071db8"
]
]
},
{
"id": "1f998b8914071db8",
"type": "google-device",
"z": "6c9fef1d.18bdb",
"client": "",
"name": "table lamp",
"nicknames": "",
"topic": "lounge/lamp",
"online": true,
"room_hint": "Lounge",
"device_type": "LIGHT",
"trait_appselector": false,
"trait_channel": false,
"trait_inputselector": false,
"trait_mediastate": false,
"trait_onoff": true,
"trait_transportcontrol": false,
"trait_modes": false,
"trait_volume": false,
"trait_toggles": false,
"trait_brightness": true,
"trait_colorsetting": true,
"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": "rgb",
"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": 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": 960,
"y": 580,
"wires": [
[
"0d9a3c264f46b9b4",
"5b4b597e5e02e3f1"
]
]
},
{
"id": "0d9a3c264f46b9b4",
"type": "debug",
"z": "6c9fef1d.18bdb",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1130,
"y": 580,
"wires": []
},
{
"id": "a56347520a3a0166",
"type": "comment",
"z": "6c9fef1d.18bdb",
"name": "Dimmable light",
"info": "",
"x": 520,
"y": 580,
"wires": []
},
{
"id": "7183a42b9a69fe1f",
"type": "inject",
"z": "6c9fef1d.18bdb",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "on",
"payload": "true",
"payloadType": "bool",
"x": 750,
"y": 580,
"wires": [
[
"1f998b8914071db8"
]
]
},
{
"id": "4f84463ab01ccc13",
"type": "inject",
"z": "6c9fef1d.18bdb",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "on",
"payload": "false",
"payloadType": "bool",
"x": 750,
"y": 620,
"wires": [
[
"1f998b8914071db8"
]
]
},
{
"id": "3551c8257caffade",
"type": "inject",
"z": "6c9fef1d.18bdb",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "brightness",
"payload": "25",
"payloadType": "num",
"x": 730,
"y": 660,
"wires": [
[
"1f998b8914071db8"
]
]
},
{
"id": "bc75039346bc1163",
"type": "inject",
"z": "6c9fef1d.18bdb",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "brightness",
"payload": "100",
"payloadType": "num",
"x": 720,
"y": 700,
"wires": [
[
"1f998b8914071db8"
]
]
},
{
"id": "5cda6c8cd01518d0",
"type": "inject",
"z": "6c9fef1d.18bdb",
"name": "color:#00ffff",
"props": [
{
"p": "payload.color.spectrumRgb",
"v": "#00ffff",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 730,
"y": 780,
"wires": [
[
"1f998b8914071db8"
]
]
},
{
"id": "76d367c38950fb84",
"type": "function",
"z": "6c9fef1d.18bdb",
"name": "Combining RGB channels",
"func": "var combinedColor = (msg.payload.red << 16) | (msg.payload.green << 8) | msg.payload.blue;\n\nreturn {\n \"payload\": {\n \"color\": {\n \"spectrumRgb\": combinedColor\n }\n }\n};",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 690,
"y": 820,
"wires": [
[
"1f998b8914071db8"
]
]
},
{
"id": "56087f34642b7c6a",
"type": "inject",
"z": "6c9fef1d.18bdb",
"name": "",
"props": [
{
"p": "payload.red",
"v": "127",
"vt": "num"
},
{
"p": "payload.green",
"v": "255",
"vt": "num"
},
{
"p": "payload.blue",
"v": "0",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 490,
"y": 820,
"wires": [
[
"76d367c38950fb84"
]
]
},
{
"id": "5b4b597e5e02e3f1",
"type": "function",
"z": "6c9fef1d.18bdb",
"name": "Split RGB channels",
"func": "let input = msg.params.color.spectrumRGB;\n\nreturn {\n \"payload\": {\n red: (input >> 16) & 0xff,\n green: (input >> 8) & 0xff,\n blue: input & 0xff,\n }\n};",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1170,
"y": 660,
"wires": [
[
"d8404910df6cb423"
]
]
},
{
"id": "d8404910df6cb423",
"type": "debug",
"z": "6c9fef1d.18bdb",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1390,
"y": 660,
"wires": []
},
{
"id": "b0664c369adc5b1d",
"type": "function",
"z": "6c9fef1d.18bdb",
"name": "Convert color to #RRGGBB",
"func": "return {\n \"payload\": \"#\" + msg.params.color.spectrumRGB.toString(16).padStart(6, '0')\n};",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1200,
"y": 620,
"wires": [
[
"53ec00de27d09247"
]
]
},
{
"id": "53ec00de27d09247",
"type": "debug",
"z": "6c9fef1d.18bdb",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1390,
"y": 620,
"wires": []
}
]