home-assistant-cli icon indicating copy to clipboard operation
home-assistant-cli copied to clipboard

Parse --json option as json

Open spasche opened this issue 5 years ago • 4 comments

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"}'

spasche avatar Oct 21 '19 19:10 spasche

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!

homeassistant avatar Oct 21 '19 19:10 homeassistant

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.

codecov-io avatar Nov 17 '19 23:11 codecov-io

rebased to get CI to pass.

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

maxandersen avatar Nov 17 '19 23:11 maxandersen

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.

stale[bot] avatar Jan 17 '20 00:01 stale[bot]

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

fabaff avatar Sep 29 '22 21:09 fabaff