Ariela - Home Assistant Android Client

but then the camera needs to be defined first based based on a http url instead of an mqtt feedy ?

Maybe something like this will work:

- id: '1552047950066'
  alias: Camera Save
  trigger:
  - platform: mqtt
    topic: homeassistant/camera/android_galaxy_s8_frontcamera
  condition: []
  action:
  - data:
      entity_id: camera.galaxy_s8_front_camera
      filename: path_to_the_image.jpg
    service: camera.snapshot
  - delay: 00:00:05
  - data:
      message: Message
      photo:
        file: path_to_the_image.jpg
      title: Title
    service: notify.telegram

What it does is:

  1. catch the event that the camera is updated
  2. save the new image to a file
  3. wait for 5 seconds to be sure the file is saved
  4. send the image to telegram

Note that i didn’t test this since i do not have telegram, but i believe it should work.

how do you define this entity id above above?

That’s my entity id of my S8 front camera. Once you enable in Ariela front / back camera, if you have MQTT discovery enabled (https://www.home-assistant.io/docs/mqtt/discovery/) , HA should automatically detect the new camera and assign an id. If you do not have discovery enabled, you will have to fallow camera config instructions from Ariela, paste that instructions to configuration.yaml and restart your HA server. Once you do that, you should be able to find a new camera entity with and id assigned. Please let me know if works.

Does not work for the moment.

- id: 'Back Camera Save'
  trigger:
  - platform: mqtt
    topic: homeassistant/camera/android_elradix_s7a_backcamera
  action:
  - data:
      entity_id: camera.elradix_s7a_back_camera
      filename: /home/homeassistant/.homeassistant/www/back.jpg
    service: camera.snapshot
  - delay: 00:00:05
  - service: notify.telegram
    data:
      title: 'Android Photo'
      message: 'Back Camera'
      data:
        document:
          file: /home/homeassistant/.homeassistant/www/back.jpg
          caption: "back Camera"

Error log below

Summary

Error while executing automation automation.back_camera_save. Unknown error for call_service at pos 1:
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/automation/init.py”, line 375, in action
await script_obj.async_run(variables, context)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/script.py”, line 131, in async_run
await self._handle_action(action, variables, context)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/script.py”, line 210, in _handle_action
action, variables, context)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/script.py”, line 299, in _async_call_service
context=context
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py”, line 85, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py”, line 1133, in async_call
self._execute_service(handler, service_call))
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 331, in iter
yield self # This tells Task to wait for completion.
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 244, in _wakeup
future.result()
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 244, in result
raise self._exception
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 179, in _step
result = coro.send(None)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py”, line 1155, in _execute_service
await handler.func(service_call)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py”, line 188, in handle_service
self._platforms.values(), func, call, service_name
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py”, line 278, in entity_service_call
future.result() # pop exception if have
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 244, in result
raise self._exception
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 181, in _step
result = coro.throw(exc)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py”, line 294, in _handle_service_platform_call
await func(entity, data)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/camera/init.py”, line 500, in async_handle_snapshot_service
_write_image, snapshot_file, image)
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 331, in iter
yield self # This tells Task to wait for completion.
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 244, in _wakeup
future.result()
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 244, in result
raise self._exception
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/camera/init.py”, line 496, in _write_image
img_file.write(image_data)
TypeError: a bytes-like object is required, not ‘NoneType’

Shouldn’t file / filename put withing ’ or " ?

Also version 1.3.0.4 is out.
What’s new:

  • fixed displaying picture-glance cards when no entities are set
  • add ability to change local HA IP address
  • move the configure external option to Settings -> Server connection
  • small update in availability MQTT sensor

@Ionut Thank you for fast response on picture-glance!
@Ionut @elRadix it is possible to do it without saving snapshot to hassio, because I dont want delay? Like this: https://hastebin.com/fosuzewija.pl, I had it for ios notifications.

still not working even with quotes

Hello,
Did you checked if the image is really saved? Do you receive that MQTT topic?

@elRadix @Ionut It is working now, image source me be right:
This is my last config:

  • alias: snap
    trigger:
    platform: state
    entity_id: binary_sensor.d_link_senzor
    to: ‘on’
    action:
    - service: camera.snapshot
    data:
    entity_id: camera.mjpeg_camera
    filename: ‘/config/www/yourcamera.jpg’
    - service: notify.android
    data_template:
    title: cam
    message: move
    data:
    image: ‘https://yourdomain:8123/local/yourcamera.jpg?{{now().second}}’

Can you add function to click on androin notification with snapshot and open the image big screen? If i click on notification it opens just ariela app.

I see now cameras on picture-glance card, but that is all. Can you add to open the stream?

I had some trouble with the Ariela app displaying the home page for my HA. It started on the second view I had configured in lovelace. To correct this I set my UI in the Ariela settings to use the HA website. Now I can’t get back to the Ariela app to change the settings. Is there an easy way to get back to the settings? Can I configure the app to show the home view of my lovelace config?

Slide from left side screen to right and the settings panel will pop out

1 Like

Hello Ionut,

Thank you for all your latest updates, really happy with the app so far!

I was wondering if you plan some updates on the following topics:

  • HANotify component: do you think it can be possible to enable the option to use my own FCM Project?
    What I was thinking was using the “default” HANotify plugin, configuring it with my API keys, and then the ability to configure those API keys in Ariela as well. For the intermediate user your implementation is already great (they just simply have to install the custom-component in Home Assistant), but my proposal would help pro users that are already using FCM for some others automations. Do you think it could be possible/feasible?
  • MQTT built-in implementation: I really like the option to use my own MQTT server, thank you about that. Do you plan on supporting web-sockets as well? Or is the support already baked in? I just see tcp:// and ssl:// as protocol schemes.

Thanks!

edit: I noticed that the battery sensor is not providing an icon anymore: it seems it’s missing the “mdi:” tag in front of the actual icon resource. I was wondering if you could also use the battery-xx icon as default, and the battery-charging-xx version of the icon only when the phone is actually charging.

edit2: nevermind: it seems it was a caching issue on my side.

Hi Ionut,

Could elaborate on the screen turn on/off functionality?

The on/off state of the screen (Android 9, HA MQTT broker, external IP used) is shown immediately after change in the topic included in Ariela’s MQTT sensors section:
homeassistant/switch/android_phone_name_screen/state
{"state":"ON"}

However, trying to turn the screen on or off from MQTT doesn’t work (tried also with OFF/ '"OFF"'/ '{"OFF"}'/ '{"state":"off"}' for payload). Messages are published by the MQTT broker, but screen doesn’t react (I haven’t tried with internal MQTT broker, though). Does it need further Android permissions to activate screen?
mosquitto_pub -t homeassistant/switch/android_phone_name_screen/set -m '{"state":"OFF"}'

Thanks

You cannot use other API keys then the ones provided by Ariela unfortunately. Each application will have its own key.

I will look into this.

The OFF option is currently broken and it will not work.
I suppose you have the MQTT client set to home assistant in Ariela. That will not work if you use other mqtt clients to post messages. If you wanna use other clients , you will also have to enable the build -in mqtt client in Ariela (since the Home Assistant client its using mqtt.publish service to send mqtt topics).
Please let me know if works.

Nope.

First choosing built-in MQTT Client then entering local MQTT broker IP & 1883 port, which is the same as the one used in HA (no external access); settings entered for local MQTT broker are not saved with any combination (there’s only the back icon in the screen and when going back it reverts to same 192.168.1.100:PORT).

Sensors are still available in MQTT however I assume sensor values are sent over HA MQTT Client, not the built-in.

I wanted screen on/off functionality using the camera of the tablet and implemented the following. (This isn’t the prettiest of approaches and I’m sure there is better ways of doing but it works for now)

Utilise Tasker to turn my screen on and off using the Motion Detector app, I was frustrated as could not work out how to lock and unlock screen even with Secure Settings (using a Huawei Tablet) so used a work around that:

  1. Turns Screen On / Off
    a. Created a full size black rectangle that fills the screen under ‘Scenes’
    b. Created a timer that if no motion is detected for x seconds then it overlays this scene and turns brightness to 0
    c. if motion is detected it removes this scene and turns brightness back to 100%

  2. Lock tablet
    a. To allow this to work the ‘Stay Awake’ option must be selected in Developer Options but this means the tablet doesn’t lock
    b. I created another Task to lock the tablet if the power lead is disconnected so if someone removed from the wall then it will lock itself

As i said - sure there are better options and would welcome better ways to implement this that actually turns the tablet screen off,

Please send me the logs so i can check. Thank you.

Hey all. Just double checking, but is MQTT discovery not working at the moment?
Expecting to see a device under the mqtt entry within integrations?

From what i know the devices will not be shown there after discovery. But if you use dev options for example and choose entitoes, you will be able to see there new devices.