home-assistant-ecosystem / home-assistant-cli

:computer: Command-line tool for Home Assistant
Other
446 stars 69 forks source link

Parse --json option as json #310

Closed spasche closed 2 years ago

spasche commented 5 years ago

I tried to fire an event and noticed that the --json argument content is passed as a string to home assistant, which returns the error: 400 - {"message": "Event data should be a JSON object"}

This PR converts the option into a JSON object.

Example call: hass-cli event fire MY_EVENT --json '{"foo": "bar"}'

homeassistant commented 5 years ago

Hi @spasche,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

codecov-io commented 5 years ago

Codecov Report

Merging #310 into dev will not change coverage. The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev     #310   +/-   ##
=======================================
  Coverage   75.25%   75.25%           
=======================================
  Files          22       22           
  Lines        1560     1560           
=======================================
  Hits         1174     1174           
  Misses        386      386
Impacted Files Coverage Δ
homeassistant_cli/plugins/event.py 47.72% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1528c0a...4f9f1c5. Read the comment docs.

maxandersen commented 5 years ago

rebased to get CI to pass.

@spasche Any chance you can update the tests for events to include verification for your fix here ?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

fabaff commented 2 years ago

Cherry-picked https://github.com/home-assistant-ecosystem/home-assistant-cli/pull/387