Let's talk about Xiaomi 360 camera which is not part of Xiaomi Miio, but could be

Basically Xiaomi Miio is missing basic camera functionality, at least turning it off and on.

I badly needed to turn the camera on and off automatically when nobody at home and finally it seems I can do it :slight_smile:

$ chuangmicamera --ip --token XXXXXXXXXXXXXXXXXXXXXXXXXXX --help
Usage: miiocli chuangmicamera [OPTIONS] COMMAND [ARGS]...

  --ip TEXT     [required]
  --token TEXT  [required]
  --model TEXT
  --help        Show this message and exit.

  alarm                       Sound a loud alarm for 10 seconds.
  clear_nas_dir               Clear NAS directory.
  flip_off                    Flip image 180 degrees off.
  flip_on                     Flip image 180 degrees on.
  full_color_off              Full color off.
  full_color_on               Full color on.
  get_nas_config              Get NAS config info.
  improve_program_off         Improve program off.
  improve_program_on          Improve program on.
  info                        Get (and cache) miIO protocol information...
  light_off                   Light off.
  light_on                    Light on.
  motion_record_off           Motion record off, always record video.
  motion_record_on            Start recording when motion detected.
  motion_record_stop          Motion record off, video recording stopped.
  night_mode_auto             Auto switch to night mode.
  night_mode_off              Night mode off.
  night_mode_on               Night mode always on.
  off                         Power off.
  on                          Power on.
  raw_command                 Send a raw command to the device.
  rotate                      Rotate camera to given direction (left,...
  set_home_monitoring_config  Set home monitoring configuration.
  set_motion_sensitivity      Set motion sensitivity (high, low).
  set_nas_config              Set NAS configuration.
  status                      Retrieve properties.
  test_properties             Helper to test device properties.
  watermark_off               Watermark off.
  watermark_on                Watermark on.
  wdr_off                     Wide dynamic range off.
  wdr_on                      Wide dynamic range on.
$ chuangmicamera --ip --token XXXXXXXXXXXXXXXXXXXXXXXXXXX on
Power on
$ chuangmicamera --ip --token XXXXXXXXXXXXXXXXXXXXXXXXXXX off
Power off

In case anyone is looking on how to setup - edit configuration.yaml file like this:

  - platform: command_line
        command_on: "miiocli chuangmicamera --ip --token XXXXXXXXXXXXXXXXXXXXXXXXXXX on"
        command_off: "miiocli chuangmicamera --ip --token XXXXXXXXXXXXXXXXXXXXXXXXXXX  off"
        command_state: "miiocli chuangmicamera --ip --token XXXXXXXXXXXXXXXXXXXXXXXXXXX status | grep -q 'Power: True'"
        command_timeout: 5
        friendly_name: "Xiaomi Mi Home Security 360"

miiocli should be installed (installed by default in docker container). Works like a charm.

Which container is this installed in?

The default one. ghcr.io/home-assistant/home-assistant:stable.

It’s not in mine

Maybe try updating the docker image/container…? I don’t know, but you got the point - you need this script. It exists in my container.

where i find the token?