hsakoh / switchbot-mqtt

SwitchBot MQTT Home Assistant add-on
MIT License
41 stars 1 forks source link

Feature Request - Support for S10 Floor Cleaning Robot #17

Closed BillyFKidney closed 4 months ago

BillyFKidney commented 5 months ago

Would it be possible to support the S10?

hsakoh commented 5 months ago

Currently, the S10 and K10 are not supported by the Switchbot API, making it difficult to properly accommodate them. I'm tracking this issue.

However, looking at the device support status in homebridge-switchbot, there is a possibility that they share the same command structure as the S1.

Referring to #10, setting EnforceDeviceTypes may allow the S10 to be recognized as an S1:

EnforceDeviceTypes:
  - DeviceId: <S10 DeviceId>
    DeviceType: Robot Vacuum Cleaner S1

In this state, could you please verify if various commands and webhooks operate correctly?

BillyFKidney commented 5 months ago

I was able to get the DeviceID but unfortunately nothing appears to be working otherwise.

09:10:56 warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {KEYKEYKEYKEYKEY} may be persisted to storage in unencrypted form.
09:10:56 info: Microsoft.Hosting.Lifetime[14] Now listening on: http://[::]:8098
09:10:56 info: Microsoft.Hosting.Lifetime[14] Now listening on: http://[::]:8099
09:10:56 dbug: SwitchBotMqttApp.Services.AutomatedHostedService[0] Application has started - will start services
09:10:56 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down.
09:10:56 info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production
09:10:56 info: Microsoft.Hosting.Lifetime[0] Content root path: /app/
09:10:56 info: SwitchBotMqttApp.Logics.DeviceConfigurationManager[0] device configuration file found. 3,0
09:10:57 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,devices/IDIDIDIDIDIDIID/status
09:10:57 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/IDIDIDIDIDIDIID/status,{"statusCode":100,"body":{},"message":"success"}
09:10:57 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,scenes
09:10:57 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/scenes,{"statusCode":100,"body":[],"message":"success"}
09:10:57 info: SwitchBotMqttApp.Services.MqttCoreService[0] started
09:10:57 info: SwitchBotMqttApp.Services.PollingService[0] started
09:11:01 info: FluffySpoon.Ngrok.NgrokProcess[0] Starting Ngrok process
09:11:01 info: FluffySpoon.Ngrok.NgrokApiClient[0] Creating tunnel SwitchBotMqttApp
09:11:01 info: FluffySpoon.Ngrok.NgrokApiClient[0] Creating tunnel SwitchBotMqttApp
09:11:01 info: FluffySpoon.Ngrok.NgrokApiClient[0] Tunnel FluffySpoon.Ngrok.Models.TunnelResponse created
09:11:01 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send POST,webhook/queryWebhook
09:11:01 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/queryWebhook,{"statusCode":190,"body":{},"message":""}
09:11:01 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send POST,webhook/setupWebhook
09:11:01 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/setupWebhook,{"statusCode":100,"body":{},"message":"success"}
09:11:01 info: SwitchBotMqttApp.Services.WebhookService[0] start listen https://IPIPIPIPIPIP.ngrok-free.app/webhook
09:11:24 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,devices/IDIDIDIDIDIDIID/status
09:11:24 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/IDIDIDIDIDIDIID/status,{"statusCode":100,"body":{},"message":"success"}
09:11:53 info: SwitchBotMqttApp.Logics.DeviceConfigurationManager[0] device configuration file found. 3,0
09:12:07 info: SwitchBotMqttApp.Logics.DeviceConfigurationManager[0] device configuration file found. 3,0
09:12:16 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send POST,devices/IDIDIDIDIDIDIID/commands
09:12:16 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/devices/IDIDIDIDIDIDIID/commands,{"statusCode":190,"body":{},"message":"not support device type"}
image

I attempted to poll the device status first, but it did not update anything.

image
hsakoh commented 5 months ago

From inspecting the response body, it appears that the API itself indeed does not seem to support S10, as you observed. I will make efforts to update as soon as support for the API is added.

hsakoh commented 4 months ago

@BillyFKidney Since the API specifications for the S10 have been released, I have added support for the S10 in add-on version 1.0.12, which was just released. As I don't own the actual device, the testing was only done theoretically.I would appreciate your feedback after trying it out. If you have previously specified EnforceDeviceTypes, please remove that specification.

BillyFKidney commented 4 months ago

I removed the force entry and updated.

The unit appears but controls are…light. Is that to be expected?

image

hsakoh commented 4 months ago

@BillyFKidney Since the device type is displayed as S1, it seems that previously detected devices may not have been overwritten correctly. Please try deleting the S1 device (and any dedicated devices that can operate PowLevel) defined by the MQTT integration's auto-discovery, then restart the add-on to see if they are detected again.

stinobook commented 4 months ago

For me it works fine? If you want me to check something let me knowimage

hsakoh commented 4 months ago

The following two points are key aspects of the API specifications and unique features of the add-on for the S10:

It would be great if you could confirm the following:

stinobook commented 4 months ago

After some testing last night here is some feedback: I think the workingstatus/tasktype arent working 100% yet. This is my cleaning log: WhatsApp Image 2024-05-18 at 09 08 48 Sensors: Screenshot from 2024-05-18 09-04-21 Screenshot from 2024-05-18 09-04-28

Also it says cleaRing instead of cleaNing ? is this normal or a typo?

Some info from your integration: image

i use the polling service because i don't know what that webhook thingy is.. maybe this is why i'm not getting the updates?

hsakoh commented 4 months ago

@stinobook

Thank you for the feedback.

Clearing is a typo in the API specifications. It has been continuing since the S1 and earlier models (haha). Since the add-on uses the API response as is, I currently don't plan to fix the typo in the add-on. https://github.com/OpenWonderLabs/SwitchBotAPI?tab=readme-ov-file#floor-cleaning-robot-s10-3

To briefly explain the difference between polling and webhooks... image

image

stinobook commented 4 months ago

Oh i see! okay i enabled webhooks. i'll keep you posted how it works tomorrow :)

10:33:27 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,scenes
10:33:27 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/setupWebhook,{"statusCode":100,"body":{},"message":"success"}
10:33:27 info: SwitchBotMqttApp.Services.WebhookService[0] start listen <Configuration required only when using Webhook without ngrok>/webhook
10:33:28 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/scenes,{"statusCode":100,"body":[],"message":"success"}
hsakoh commented 4 months ago

@stinobook Ah, from the way those logs are appearing, it seems like the configuration might not be set up correctly.

stinobook commented 4 months ago

Woops! was to quick and indeed did not set the IP :)

12:16:38 info: SwitchBotMqttApp.Logics.DeviceConfigurationManager[0] device configuration file found. 1,0
12:16:39 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,devices/redacted/status
12:16:39 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/queryWebhook,{"statusCode":190,"body":{},"message":""}
12:16:39 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send POST,webhook/setupWebhook
12:16:40 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/redacted/status,{"statusCode":100,"body":{"deviceId":"redacted","deviceType":"WoSweeperOrigin","workingStatus":"ChargeDone","onlineStatus":"online","battery":100,"waterBaseBattery":100,"taskType":"standBy"},"message":"success"}
12:16:40 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceId,"redacted"
12:16:40 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceType,"WoSweeperOrigin"
12:16:40 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,scenes
12:16:40 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/setupWebhook,{"statusCode":100,"body":{},"message":"success"}
12:16:41 info: SwitchBotMqttApp.Services.WebhookService[0] start listen http://redacted.com:8098/webhook
12:16:41 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/scenes,{"statusCode":100,"body":[],"message":"success"}
12:16:41 info: SwitchBotMqttApp.Services.MqttCoreService[0] started
12:16:41 info: SwitchBotMqttApp.Services.PollingService[0] started
12:17:31 info: SwitchBotMqttApp.Logics.DeviceConfigurationManager[0] device configuration file found. 1,0
12:17:44 info: SwitchBotMqttApp.Logics.DeviceConfigurationManager[0] device configuration file found. 1,0
stinobook commented 4 months ago

Tried sending a command: image didnt do anything.

I've put the robot in 'Mop Drying' mode, which updates only after pressing the 'polling' controll in MQTT home assistant: image

12:40:24 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/redacted/status,{"statusCode":100,"body":{"deviceId":"redacted","deviceType":"WoSweeperOrigin","workingStatus":"Clearing","onlineStatus":"online","battery":100,"waterBaseBattery":100,"taskType":"standBy"},"message":"success"}
hsakoh commented 4 months ago

@stinobook

Based on the API response of parameters error, it seems there might be an error in the API specification... The implementation of selfClean follows the API specification, and the actual payload was as follows:

{"commandType":"command","command":"selfClean","parameter":"2"}

Please also try executing other commands to see if they work.

Additionally, I released version 1.0.15 just now due to an error in the addon's internal CSV master data. However, this only changes the payload values for selfClean from 0, 1, 2 to 1, 2, 3 and should not resolve the parameters error issue.commit image https://github.com/OpenWonderLabs/SwitchBotAPI?tab=readme-ov-file#floor-cleaning-robot-s10-2

hsakoh commented 4 months ago

https://github.com/OpenWonderLabs/SwitchBotAPI/issues/303

stinobook commented 4 months ago

Updated to .15. here are some more command tests: image -- verified doing something on robot (im not at home so just checking through the app)

image --- verified

image --- verified

image --- setVolume not working

image --- Still same error

image --- verified but switched app to 'vacuum' mode (even with waterlevel 1) maybe because i tried vacuum only mode at earlier command?

image can also switch times to 3. app shows nothing selected anymore (it doesn't have an option for 3x so it might be working)

Meanwhile nothing changed in MQTT HASS: image

hsakoh commented 4 months ago

Thank you for trying out so many commands.

stinobook commented 4 months ago

The commands get accepted even if you don't fill out all values in the ingress page :) fyi. i saw them change on my app. Startstate: 1

Command sent: Screenshot from 2024-05-18 14-10-15 New state: 2 New command sent: Screenshot from 2024-05-18 14-10-42 New state: 3

stinobook commented 4 months ago

So another day of testing and I don't get any updates from the web hook. I have to manually press polling to get an update. Any idea how to troubleshoot this ?

hsakoh commented 4 months ago

https://github.com/hsakoh/switchbot-mqtt/issues/17#issuecomment-2118764538 Based on this comment, I understand that you are trying to receive Webhooks by opening ports, etc., without using Ngrok.

https://github.com/hsakoh/switchbot-mqtt/issues/18#issuecomment-2104346541 Referring to this comment, the first step is to ensure that the Webhook can be correctly accessed from the internet and that the ports are correctly opened.

You can use the payload mentioned in that comment, or refer to the following: https://github.com/OpenWonderLabs/SwitchBotAPI?tab=readme-ov-file#floor-cleaning-robot-s10-3 (The primary goal is to confirm that the webhook can be received.)

stinobook commented 4 months ago

Webhooks seem to work: image

Does my hosturl setting also need to have the /webhook/ in it? or just the url ? this is it currently: HostUrl: http://red.acted.com:8098

hsakoh commented 4 months ago

@stinobook The HostUrl setting for the add-on only needs to include the port number, and you do not need to include /webhook. https://github.com/hsakoh/switchbot-mqtt/blob/main/src/SwitchBotMqttApp/Services/WebhookService.cs#L62-L64

It seems that you have confirmed the reception of the webhook (from the internet?). Do you have any other SwitchBot devices that support to webhooks?

Could it be an issue on the SwitchBot side where the S10 webhooks are not being triggered? I'm not sure what the cause is. Sorry I couldn't be of more help..

stinobook commented 4 months ago

I followed the test from the comment you linked so yes it's from the internet. I don't own any other SwitchBot devices sadly. If I use web hooks do I need to disable polling? Because ever since enabling web hooks now the polling doesn't do anything anymore either.

hsakoh commented 4 months ago

Polling and webhooks can both be enabled simultaneously.

I believe the polling responses are being logged by the add-on. Are there any errors showing up? If the Status Lastupdate of the MQTT device is being updated, polling is functioning correctly. It might be that the data on the SwitchBot server is not being updated.

Could it be that the S10 is not communicating properly with the internet or the SwitchBot server? Sometimes, a device restart can help improve the situation. (Even if the S10 is near and can be controlled via the smartphone app, it is likely communicating via Bluetooth, so you may not notice a loss of communication with the server.)

stinobook commented 4 months ago

i tried restarting it but that didnt do anything. i do have this in the logs:

12:00:34 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceId,"redacted"
12:00:34 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceType,"WoSweeperOrigin"

image image image image

hsakoh commented 4 months ago

@stinobook From the information you provided, the following can be inferred:

Points to confirm:

stinobook commented 4 months ago

@stinobook From the information you provided, the following can be inferred:

  • Since trce is recorded, the log level is set to Trace.
  • Polling was executed at 12:00:34.
  • Manual polling was executed at 12:36:22.
  • After the add-on is started (or after the UTC date changes), the API has only been called twice.

i rebooted HASS at 12:00 to restart everything and went to get a bite to eat. when i came back i noticed no updates were done so i pressed manual polling.

Points to confirm:

  • After entering the polling frequency, have you saved the settings?

yes

  • After changing and saving the polling frequency, have you restarted the add-on (or stopped and started the PollingService)?

i just restarted addon now for giving feedback on this comment. i did restart it earlier but can't recall when.

  • Could you provide more specific details such as the time when the add-on was started, the expected times for automatic polling, and the times for manual polling?

Home assistant restarted at 12:00-ish Addon restarted at 13:47 no manual polling since 13:47

  • At the Trace level, logs like the following should be output. Can you provide these logs? trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/XXXXXXXXXXX/status {"statusCode":100,"body":{....},"message":"success"}
    13:46:52 info: Microsoft.Hosting.Lifetime[0] Application is shutting down...
    13:46:52 dbug: SwitchBotMqttApp.Services.AutomatedHostedService[0] Application has stopped - will stop services
    13:46:52 info: SwitchBotMqttApp.Services.PollingService[0] stopped
    13:46:52 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send POST,webhook/updateWebhook
    13:46:52 info: SwitchBotMqttApp.Services.MqttCoreService[0] stopped
    13:46:54 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/updateWebhook,{"statusCode":100,"body":{},"message":"success"}
    13:46:54 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send POST,webhook/deleteWebhook
    13:46:55 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/deleteWebhook,{"statusCode":100,"body":{},"message":"success"}
    13:46:55 info: SwitchBotMqttApp.Services.WebhookService[0] stopped
    13:46:57 warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {redacted} may be persisted to storage in unencrypted form.
    13:46:57 info: Microsoft.Hosting.Lifetime[14] Now listening on: http://[::]:8098
    13:46:57 info: Microsoft.Hosting.Lifetime[14] Now listening on: http://[::]:8099
    13:46:57 dbug: SwitchBotMqttApp.Services.AutomatedHostedService[0] Application has started - will start services
    13:46:57 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send POST,webhook/queryWebhook
    13:46:57 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down.
    13:46:57 info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production
    13:46:57 info: Microsoft.Hosting.Lifetime[0] Content root path: /app/
    13:46:57 info: SwitchBotMqttApp.Logics.DeviceConfigurationManager[0] device configuration file found. 1,0
    13:46:58 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,devices/redacted/status
    13:46:59 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/queryWebhook,{"statusCode":190,"body":{},"message":""}
    13:46:59 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send POST,webhook/setupWebhook
    13:46:59 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/redacted/status,{"statusCode":100,"body":{"deviceId":"redacted","deviceType":"WoSweeperOrigin","workingStatus":"ChargeDone","onlineStatus":"online","battery":100,"waterBaseBattery":100,"taskType":"standBy"},"message":"success"}
    13:46:59 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceId,"redacted"
    13:46:59 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceType,"WoSweeperOrigin"
    13:46:59 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,scenes
    13:47:00 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response POST,https://api.switch-bot.com/v1.1/webhook/setupWebhook,{"statusCode":100,"body":{},"message":"success"}
    13:47:00 info: SwitchBotMqttApp.Services.WebhookService[0] start listen http://redac.ted.com:8098/webhook
    13:47:00 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/scenes,{"statusCode":100,"body":[],"message":"success"}
    13:47:00 info: SwitchBotMqttApp.Services.MqttCoreService[0] started
    13:47:00 info: SwitchBotMqttApp.Services.PollingService[0] started
    13:48:07 info: SwitchBotMqttApp.Logics.DeviceConfigurationManager[0] device configuration file found. 1,0
    13:52:00 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,devices/redacted/status
    13:52:02 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/redacted/status,{"statusCode":100,"body":{"deviceId":"redacted","deviceType":"WoSweeperOrigin","workingStatus":"ChargeDone","onlineStatus":"online","battery":100,"waterBaseBattery":100,"taskType":"standBy"},"message":"success"}
    13:52:02 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceId,"redacted"
    13:52:02 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceType,"WoSweeperOrigin"
    13:57:00 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,devices/redacted/status
    13:57:02 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/redacted/status,{"statusCode":100,"body":{"deviceId":"redacted","deviceType":"WoSweeperOrigin","workingStatus":"ChargeDone","onlineStatus":"online","battery":100,"waterBaseBattery":100,"taskType":"standBy"},"message":"success"}
    13:57:02 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceId,"redacted"
    13:57:02 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceType,"WoSweeperOrigin"
    14:02:00 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,devices/redacted/status
    14:02:02 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/redacted/status,{"statusCode":100,"body":{"deviceId":"redacted","deviceType":"WoSweeperOrigin","workingStatus":"ChargeDone","onlineStatus":"online","battery":100,"waterBaseBattery":100,"taskType":"standBy"},"message":"success"}
    14:02:02 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceId,"redacted"
    14:02:02 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceType,"WoSweeperOrigin"
    14:07:00 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Send GET,devices/redacted/status
    14:07:02 trce: SwitchBotMqttApp.Logics.SwitchBotApiClient[0] Response GET,https://api.switch-bot.com/v1.1/devices/redacted/status,{"statusCode":100,"body":{"deviceId":"redacted","deviceType":"WoSweeperOrigin","workingStatus":"GotoChargeBase","onlineStatus":"online","battery":100,"waterBaseBattery":100,"taskType":"cleanArea"},"message":"success"}
    14:07:02 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceId,"redacted"
    14:07:02 trce: SwitchBotMqttApp.Services.MqttCoreService[0] disable polling paylod RobotVacuumCleanerS10,deviceType,"WoSweeperOrigin"
  • From the following MQTT devices, you can verify the values subscribed by the MQTT device. Can you confirm if messages are being published to topics such as switchbot/XXXXXXXXXXX/status/both or switchbot/XXXXXXXXXXX/status/status? If so, can you provide the timestamps and contents of these messages?

Paste: https://pastebin.com/x491j3cE Word: Y8QDDpu9Bd

there you go :)

PS: Since just rebooting the addon the polling seems to work again! thats already something. but the webhook doesn't automatically update still.

image

hsakoh commented 4 months ago

@stinobook Thank you for the detailed information. It seems that the messages in the MQTT topics are being stored as intended.

I'm glad to hear that the polling started working after the restart. If the issue recurs, please send the same details as this time, and i might be able to identify the cause...

The issue with the webhooks not functioning is still unresolved, unfortunately.

stinobook commented 4 months ago

FYI, doing some more testing on the webhooks:

curl -H "Content-Type: application/json" -H "Authorization: TOKEN" -X POST https://api.switch-bot.com/v1.1/webhook/queryWebhook -d '{"action":"queryUrl"}' response: {"statusCode":100,"body":{"urls":["https://red.a.com:cted8098/webhook"]}

curl -v -H "Content-Type: application/json" -H "Authorization: TOKEN" -X POST https://api.switch-bot.com/v1.0/webhook/queryWebhook -d '{"action":"queryDetails", "urls":["https://red.acted.com:8098/webhook"]}'

{"statusCode":100,"body":[{"deviceList":"ALL","createTime":1716717225850,"url":"https://red.acted.com:8098/webhook","enable":true,"lastUpdateTime":1716717225850}],"message":"success"}

Then i went ahead and deleted the webhook through the api. since i wasnt sure that the existing webhook was from my testing or from the addon. restarted addon did a new queryURL and the URL is back in the list. So far so good !

hsakoh commented 4 months ago

http...s? The HTTP server built into the add-on (ASP.NET Kestrel) does not hold SSL/TLS certificates for the domain (or IP address), so it is set to listen for connections over HTTP. Therefore, if you are not using Ngrok, the domain specified in the add-on configuration needs to use HTTP. (Alternatively, this would not apply if there is an external reverse proxy with SSL offloading so that the add-on is not directly exposed to the internet.)

As of the following comment, I understood it was using HTTP: https://github.com/hsakoh/switchbot-mqtt/issues/17#issuecomment-2118764538

On a slightly different note... So far, no one has successfully received a webhook from the S10. To distinguish whether it is a "connection issue" or "webhooks have not yet been implemented by SwitchBot," using Ngrok temporarily might help with the diagnosis.

stinobook commented 4 months ago

http...s? The HTTP server built into the add-on (ASP.NET Kestrel) does not hold SSL/TLS certificates for the domain (or IP address), so it is set to listen for connections over HTTP. Therefore, if you are not using Ngrok, the domain specified in the add-on configuration needs to use HTTP. (Alternatively, this would not apply if there is an external reverse proxy with SSL offloading so that the add-on is not directly exposed to the internet.)

Ah yes oops that was one of my tries with editing the URL :) leftover from testing different configurations..

As of the following comment, I understood it was using HTTP: #17 (comment)

Back then it probably was :)

On a slightly different note... So far, no one has successfully received a webhook from the S10. To distinguish whether it is a "connection issue" or "webhooks have not yet been implemented by SwitchBot," using Ngrok temporarily might help with the diagnosis.

Oh okay so it's not just me ! ill have a look at that ngrok then, ill keep you posted :)

-- edit: So far no MQTT messages with ngrok.. same as before :) guess we'll wait for switchbot then..