Closed sognen closed 3 years ago
There is nothing right now that decorates that on if it isn't provided (You could fake it with an "online" state property using a "Static" mapper to true....) there probably should be. Ill add something in the next release for that and the undocumented "status" property.
Where are you seeing it being "reported being offline" though? I haven't seen anywhere that tells you that, nor have I found any issues around this being missing in terms of functionality, so you must be looking at something I haven't seen before.
Nest hub has these quick tiles that will tell you the status of each device, for example, for a tile for a bulb it will tell you whether it is off or on and brightness in percentage. Example: https://9to5google.com/wp-content/uploads/sites/4/2020/10/chrome_0PrmdOKA42.png?w=1000
Tiles for devices connected through Homeautio just say offline. Devices do however respond to voice commands.
I followed your advice and added the static online:true. When issueing a voice command I can see the device changing status to "online" for a brief moment for then to change status to offline again.
Response with online to true: {"requestId":"14844550806288342576","payload":{"devices":{"livingroom/fan":{"on":true,"online":true,"currentFanSpeedSetting":"medium","currentFanSpeedPercent":74,"timerRemainingSec":0,"timerPaused":false}}}
I then see a response to query which lists device without device states:
{"inputs":[{"intent":"action.devices.QUERY","payload":{"devices":[{"id":"livingroom/thermostat"},{"id":"livingroom/ac"},{"id":"livingroom/fan"},{"id":"livingroom/airPurifier"},{"id":"livingroom/airFreshener"},{"id":"bedroom/thermostat"},{"id":"other/camera/danmarksplass"},{"id":"other/camera/festplassen"},{"id":"other/camera/floyen"},{"id":"other/camera/puddefjordsbroen"},{"id":"other/camera/torgallmenningen"},{"id":"bedroom/vacuumCleaner"}]}],"requestId":"7138190270187865614"}
Could it be the second response that returns offline status?
Got ya. None of mine are showing offline even with the current setup here. While Ill definitely include the "online" status in a future update for completeness, and because Google's own schema files dictate it be present (even though it seems to work without), I'm wondering if you are seeing a different issue...
That second "response" looks like a QUERY request body, not a response to a request, just FYI.
Is your HomeGraph setup working correctly? The behavior you are describing sounds like the initial response works, and then the HomeGraph update fires and something goes wrong. Do you see anything like "Google Home Graph update failed for devices" in the logs?
First, thank you for your assistance. Second, my devices are"online" now. I found an error I missed yesterday in my log. The error was Value cannot be null. (Parameter 'source')" errors. This reminded me of a device that I have configured in homeautio but never gotten around to feeding it with values/states.
After publishing some default values to it, the other devices started to come "online" in the nest hub. I also removed the online:true added yesterday.
Conscious that this may be a coincidence, but it appears to me that if a device is without state values other devices does not report online as they should. Under you can find the error that prompted me to populate the device with values.
2020-11-27 05:00:10.497 +00:00 [Error] Connection id ""0HM4I937OBB59"", Request id ""0HM4I937OBB59:00000001"": An unhandled exception was thrown by the application.
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func
2 predicate)
at HomeAutio.Mqtt.GoogleHome.Models.State.Device.GetGoogleStateFlattened(IDictionary2 stateCache) in /app/HomeAutio.Mqtt.GoogleHome/Models/State/Device.cs:line 137 at HomeAutio.Mqtt.GoogleHome.Models.State.Device.GetGoogleQueryState(IDictionary
2 stateCache) in /app/HomeAutio.Mqtt.GoogleHome/Models/State/Device.cs:line 76
at HomeAutio.Mqtt.GoogleHome.IntentHandlers.QueryIntentHandler.<>cDisplayClass5_0.1 source, Func
2 keySelector, Func2 elementSelector, IEqualityComparer
1 comparer)
at HomeAutio.Mqtt.GoogleHome.IntentHandlers.QueryIntentHandler.Handle(QueryIntent intent) in /app/HomeAutio.Mqtt.GoogleHome/IntentHandlers/QueryIntentHandler.cs:line 69
at HomeAutio.Mqtt.GoogleHome.Controllers.GoogleHomeController.Post(Request request) in /app/HomeAutio.Mqtt.GoogleHome/Controllers/GoogleHomeController.cs:line 72
at lambda_method(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
Ah that makes sense, yes. It's interesting that Google interprets an error as "all requested devices are now offline". This would happen anytime a badly configured device is part of the request and has a null topic
, but no valueMap
defined.
I am actually rewriting how this works at the moment, and the new version already has a fix for this incorporated now, thanks to you pointing this out. Thank you!
Great, thanks for your help.
Added online status as default on all devices now in 2.0.
Hi I got homegraph configured and I can see from the log that it is being updated. My devices are however reported being offline. On the google developer site, it appears that online status is part of the response to the device.query call - https://developers.google.com/assistant/smarthome/reference/rest/v1/devices/query#queryresponsepayload.
I am not sure if there is something wrong with my home graph setup or if "online status" is something that is not currently implemented.
Any insight into this is much appreciated.
Cato