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

Enhance test client #3

Merged
merged 15 commits into from
Nov 18, 2022
Merged

Enhance test client #3

merged 15 commits into from
Nov 18, 2022

Conversation

sikmir
Copy link
Contributor

@sikmir sikmir commented Nov 4, 2022

Usage example:

$ mqtt-rpc-client -d db_logger -s history -m get_channels | tr "'" '"' | jq -r '.channels|keys|.[]'
...
wb-msw-v3_31/Humidity
wb-msw-v3_31/Temperature
...

@sikmir sikmir requested a review from webconn November 4, 2022 18:31
Copy link
Contributor

@webconn webconn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я б ещё сразу подумал в сторону подключения через UNIX-сокет по умолчанию, как тут: https://github.com/wirenboard/wb-diag-collect/blob/master/wb/diag/rpc_server.py

try:
import mosquitto
except ImportError:
import paho.mqtt.client as mosquitto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно сразу избавляться от mosquitto, всё равно пользоваться им больше не стоит

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

убрал

dest="driver",
type=str,
help="Driver name",
default="db_logger",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я бы не стал тут делать допущения насчёт значений по умолчанию

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

убрал дефолты

default="get_channels",
)
parser.add_argument(
"-a", "--args", dest="args", type=str, help="Method arguments", default="{}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут можно сделать магию, написав type=json.loads, тогда оно сразу распарсится

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@sikmir
Copy link
Contributor Author

sikmir commented Nov 11, 2022

Я б ещё сразу подумал в сторону подключения через UNIX-сокет по умолчанию, как тут: https://github.com/wirenboard/wb-diag-collect/blob/master/wb/diag/rpc_server.py

Заменил на одну опцию -b, --broker_url.
Например:

  • mqtt-tcp://user:pass@localhost:1883
  • unix:///var/run/mosquitto/mosquitto.sock (default)

@sikmir sikmir requested a review from webconn November 11, 2022 10:52
debian/changelog Outdated Show resolved Hide resolved
debian/control Outdated Show resolved Hide resolved
@sikmir sikmir merged commit 76dd25f into main Nov 18, 2022
@sikmir sikmir deleted the feature/client branch November 18, 2022 13:52
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

Successfully merging this pull request may close these issues.

3 participants