hsakoh / switchbot-mqtt

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

keypad `createKey` command: Input string was not in a correct format. #5

Closed marcomow closed 11 months ago

marcomow commented 1 year ago

I'm try to send the createKey command, but something in the form validation fails. Here my inputs:

image

I can't understand what I'm inputting wrong. Here the docs https://github.com/OpenWonderLabs/SwitchBotAPI#keypad-2

hsakoh commented 1 year ago

KeyPad is still unverified.

KeyPad's command parameters are unique compared to other products and include optional parameters.

In the test form, It's conducting data type validation. Specifically, if startTime and endTime cannot be parsed into a Long data type, an error occurs. At this point, optional command parameters have not been implemented.

In the MQTT integration, it is difficult to notify the addon of an unspecified state when no value is entered. Therefore, I plan to make modifications to treat -1 as unspecified.

First, what we would like you to confirm is whether it works correctly when you specify startTime and endTime. Also, when specifying 0 and 9999999999, does SwitchBot behave as expected?

marcomow commented 1 year ago

First, what we would like you to confirm is whether it works correctly when you specify startTime and endTime. Also, when specifying 0 and 9999999999, does SwitchBot behave as expected?

it works in the addon test!

hsakoh commented 1 year ago

I have released v1.0.5.

In the test page, you can specify omissions by entering '-1' or an empty string (''). In the MQTT integration, we have made changes to limit the value range from -1 to 9999999999. When you specify -1, you can specify an omission.

MQTT Number transmit only allowed values. Empty values will not be transmit. so i have made it possible to input -1 as a value outside the allowable range. Please give it a try.