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

Sensor PM10 and PM2.5 not working #382

Closed
FireWizard52 opened this issue Mar 26, 2023 · 6 comments
Closed

Sensor PM10 and PM2.5 not working #382

FireWizard52 opened this issue Mar 26, 2023 · 6 comments

Comments

@FireWizard52
Copy link
Contributor

FireWizard52 commented Mar 26, 2023

I try to get some sensors working and followed the examples on https://developers.home.google.com/cloud-to-cloud/traits/sensorstate

While the SmokeLevel sensor (see also in the example folder), the WaterLeak and AirQuality are working fine, I can't get the PM10 and PM2.5 sensors to convince to give a valid response :)
They keep indicating "Unknown", what ever I send,

The only difference I can see between the working and non-working sensors is that the working ones have descriptive capabilities, but the WaterLeak has no numeric capabilities., while the other two do have that, For SmokeLevel, I do not use it.

I send the following payload:

let pm10 = msg.payload.svalue;
msg.topic = msg.payload.idx;

msg.payload = {
    "currentSensorStateData": [
        {
            "name": "PM10",
            "rawValue": parseFloat(pm10)
        }
    ]
}
return msg

Has anyone an idee? Something missing in the payload? Something wrong with specific sensors?

Regards

@ckhmer1
Copy link
Contributor

ckhmer1 commented Mar 27, 2023

Try this

[{"id":"bfb0457067c3f91b","type":"google-device","z":"3eb7b7e8.e04228","client":"","name":"Test","nicknames":"","topic":"","room_hint":"","device_type":"SENSOR","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":true,"sensor_states_supported":["PM2.5","PM10"],"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":370,"y":2060,"wires":[["80f44c5a9f6cd2b6"]]},{"id":"021278a59b358077","type":"inject","z":"3eb7b7e8.e04228","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"getstate","x":180,"y":2020,"wires":[["bfb0457067c3f91b"]]},{"id":"70963d40c9867860","type":"inject","z":"3eb7b7e8.e04228","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"currentSensorStateData","payload":"[{\"name\":\"PM2.5\",\"rawValue\":10},{\"name\":\"PM10\",\"rawValue\":20}]","payloadType":"json","x":190,"y":2080,"wires":[["bfb0457067c3f91b"]]},{"id":"80f44c5a9f6cd2b6","type":"debug","z":"3eb7b7e8.e04228","name":"debug 159","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":2060,"wires":[]}]

@FireWizard52
Copy link
Contributor Author

FireWizard52 commented Mar 27, 2023

Dear Claudio

Thank you very muchfor your response, @ckhmer1,

I tested your provided flow, but regarding the result it is not different from my test flow.
My flow has a "Function" node in between, that made the translation from the source,
You have as topic "currentSensorStateData", while I have it in the payload.
That does not make any difference.

Still I have the indication "Unknown" and Google is not able to respond to a query.
Yes, as output from the "getstate" "Inject" node, I get the Injected values, but that is also the case with my flow.

So, it is not what I hoped for.

[Edit] After a restart of Node-RED I noticed the following error:

27 Mar 19:27:19 - [error] HttpActions:httpActionsRegister(/smarthome): no user found for access token "9gvyLW66L16YgqHdjq8UAzC5Jg4sch2eQRxYWJ2jVdcn"
27 Mar 19:27:19 - [error] HttpActions:httpActionsRegister(/smarthome): no user found for access token "9gvyLW66L16YgqHdjq8UAzC5Jg4sch2eQRxYWJ2jVdcn"

I have no clue, if this has any relation.

Regards

@Caprico85
Copy link
Collaborator

Finally found the time to try this myself.

For me it works. I don't get the "Unknown" display. States are successfully reported to Google. No UI in the app (as expected). And I had to try several different questions until I got a response from Google Assistant. In German, "Wie ist der Feinstaub beim ?" works. I guess in english I guess it's something like "Whats the particulate matter at the ?". All other questions, like asking for "PM10", "PM10 level", "sensor readings", "state of the sensor", "air quality" and similar, only resulted "Sorry, I did not understand".

I tried it with this flow:

[{"id":"f84a971256283008","type":"debug","z":"ba4ea2f93145cb4f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":810,"y":900,"wires":[]},{"id":"002f9d772f296377","type":"google-device","z":"ba4ea2f93145cb4f","client":"","name":"garage","nicknames":"","topic":"garage/temp","room_hint":"","device_type":"SENSOR","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":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":"query","trait_humiditysetting":false,"min_percent":0,"max_percent":100,"command_query_humiditysetting":"query","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":true,"sensor_states_supported":["PM2.5","PM10"],"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":655,"y":900,"wires":[["f84a971256283008"]]},{"id":"5167db30cb0dfd2c","type":"inject","z":"ba4ea2f93145cb4f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"currentSensorStateData","payload":"[{\"name\":\"PM2.5\",\"rawValue\":10},{\"name\":\"PM10\",\"rawValue\":20}]","payloadType":"json","x":470,"y":880,"wires":[["002f9d772f296377"]]},{"id":"8d6e2dd6709f5750","type":"inject","z":"ba4ea2f93145cb4f","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"getstate","x":460,"y":920,"wires":[["002f9d772f296377"]]},{"id":"9aa27515768743ac","type":"function","z":"ba4ea2f93145cb4f","name":"function 1","func":"let pm10 = 69;\nmsg.topic = 'Bla';\n\nmsg.payload = {\n    \"currentSensorStateData\": [\n        {\n            \"name\": \"PM10\",\n            \"rawValue\": parseFloat(pm10)\n        }\n    ]\n}\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":960,"wires":[["002f9d772f296377"]]},{"id":"a1cedbecd2aa4b52","type":"inject","z":"ba4ea2f93145cb4f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":960,"wires":[["9aa27515768743ac"]]}]```

@FireWizard52
Copy link
Contributor Author

FireWizard52 commented Apr 5, 2023

Hello @Caprico85 and @ckhmer1 ,

I tested the received flow of @Caprico85 , which was more or less identical to @ckhmer1 flow,
It did not work. I believe that I first have to see the status of the sensor, before I can expect an answer from a query.

In the meantime @ckhmer1 made a PR with a fix. I think, that I should wait until an update has been published.

So far, I would like to thank both of you for your effort and support.

Regards

@Caprico85
Copy link
Collaborator

@ckhmer1's fix is merged and released as v0.4.4.

@FireWizard52
Copy link
Contributor Author

Hello @Caprico85 and @ckhmer1,

Thank you both for providing the fix.
This afternoon I have been able to test it.

I wonder, what the advantage is of sending both values to 1 Google SmartHome node.
Indeed I see both PM10 and PM2.5 values under the node, while,if I use a separate node for each of them, I see only one valu under the node. As expected.

So far, I have not been able to find the proper wording in Dutch to receive an answer on querying the google Device.
I tried several combinations, but mostly Google doesn't understand.

But thanks and a happy Easter.

I think, this topic can be closed.

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

3 participants