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

Devices in "Unknown" state #496

Closed patrik-malina closed 3 months ago

patrik-malina commented 5 months ago

Beside Router/Network device I have several with unknown state;

Although they work as expected, always shows this status.

Caprico85 commented 5 months ago

I took a look at the code. Currently, all devices without an explicit state logic show the "Unknown" state. I agree that this is misleading.

As a first step, instead of "Unknown", I would show no state at all. I wouldn't show "Failure" or "Success" as @FireWizard52 suggested. I think "Success" and "Failure" can also be misleading. A device that shows "Success" might still not work because your network is not configured correctly. A device that shows "Failure" may still work, you just injected a wrong value. Serious errors errors like no config being selected will overwrite the state with an error message anyway.

From there, I would go through all traits and/or device types and decide which states are important enough show directly on the status text. I would by no means show all states. This gets too long. If someone wants to see more states, one can still use another node to filter out states from the output and display them on their status text. Or use an external dashboard.

For the Start/Stop trait I would show wether its started. For the RunCycle trait, I would show the current cycle. This should give dishwashers, dryers, washing machines and vacuums a meaningful status text.

For the NetworkControl trait. it's hard to decide which states are important enough to show. I think none of the states is THE state you absolutely want to know about. For some people it's the network on/off state. Others don't switch their network, but they are more interested in the network speed. But the speed is rather temporary if not continuously updated, so maybe not important enough either. I tend to show no state for routers either.

FireWizard52 commented 5 months ago

hello @Caprico85,

You wrote:

As a first step, instead of "Unknown", I would show no state at all. I wouldn't show "Failure" or "Success" as @FireWizard52 suggested. I think "Success" and "Failure" can also be misleading. A device that shows "Success" might still not work because your network is not configured correctly. A device that shows "Failure" may still work, you just injected a wrong value. Serious errors errors like no config being selected will overwrite the state with an error message anyway.

With my suggestion of using "Success" and "Failure", I was not very sure, that this would be the best solution. I agree with you that it also might cause confusion. So it is better to have no status information at all.

I would by no means show all states. This gets too long.

Agree, as that will be impossible.

For the NetworkControl trait. it's hard to decide which states are important enough to show. I think none of the states is THE state you absolutely want to know about

One is not more important as the other.

But the speed is rather temporary if not continuously updated, so maybe not important enough either. I tend to show no state for routers either.

If you update only by means of your Google devices, you are correct. I see it more as a sensor, and every hour it tests automatically the network speed and so updates the value. For me it would be fine, but if it shows no state, it is fine for me, too.

Regards

ckhmer1 commented 5 months ago

Hi, Another possibility could be to add a new jsonata field for defining the status to show. In this way everyone could decide the info to show in the status. I'm wondering if the status in the node editor is so important.

FireWizard52 commented 5 months ago

Hi,

No, I don't think that the status in the node editor is very important, I think that most people use it in order to check that their flow is working.

Do not spend too much of your time on it.

patrik-malina commented 5 months ago

Hi,

No, I don't think that the status in the node editor is very important, I think that most people use it in order to check that their flow is working.

Do not spend too much of your time on it.

I agree with that...

Caprico85 commented 5 months ago

I pushed some new changes. For the StartStop and RunCycle traits it now shows if it is started and the current cycle.

image

If a device doesn't have any status logic, nothing is shown.

image.

I'm currently converting the dishwasher into an example, then I'll release this as a new version.

patrik-malina commented 5 months ago

Good job. Thanks.

One Q: Can you make start/stop trait not to be mandatory on washer, dryer and disher? Mine does not have those.

I know Google says it is mandatory, but also on doors and locks there is mandatory PIN, but it works without it.

Caprico85 commented 5 months ago

One Q: Can you make start/stop trait not to be mandatory on washer, dryer and disher? Mine does not have those.

I expected Google to give an error. But it actually seems to work. Done, will be included in the next release.

patrik-malina commented 5 months ago

Thank you. I'm closing this issue.

ckhmer1 commented 5 months ago

Hi Caprico, Could you please add a comment in the code, just to remember that should be mandatory, but Google doesn't complain if missing. Perhaps one day Google starts to complain about it. Thanks

Caprico85 commented 5 months ago

I already did when I changed it in 40440ae8943d90fe217aa84fee3bfe06d4e0650c.

Caprico85 commented 5 months ago

Changes published in v0.4.11

patrik-malina commented 5 months ago

I tested this. Google wont throw error, but on Home app and Hub it still shows play/stop button, so you can revert changes back.

Caprico85 commented 5 months ago

Reverted it.

I didn't had the start/stop buttons. I had an empty blue circle in the app. I think that was supposed to be the RunCycle indicator. But I wasn't able to show anything on this circle. Maybe because without the StartStop trait, the device isn't actually started and therefore won't show any progress.