Quantcast
Channel: Configuration - Home Assistant Community
Viewing all 105910 articles
Browse latest View live

Zoneminder + object detection + zmeventnotification + mqtt + appdemon = virtual motion sensor = success!

$
0
0

@stryker wrote:

I’ve got zoneminder configured with object detection and zmevenotification and it all works very well. I’m not using the zm integration in HA, couldn’t see the point, however I do have zmeventnotification setup to publish to my mqtt server. I had the idea that maybe somehow when zm detected a “person” on my drive or in my back garden I’d like to use that in my HA setup. So using an input_boolean, a binary_sensor and some code in appdaemon I’ve made myself a virtual motion sensor. When a person is detected the motion sensor records “detected” for 30 seconds, which of course can be used in your automations, I use mine in my alarm system… I also use the front drive one to make an announcement over my google home speaker.

Here is how it works.

First of all in your appropriate config file configuration.yaml for me create an input_boolean for the appdaemon script to use.

input_boolean:
  person_front_drive:
    name: Person front drive
    initial: off

Then create a binary_sensor to act as the motion sensor which uses the input_boolean to set its state.

binary_sensor:
  - platform: template
    sensors:
      zm_person_front_drive:
        value_template: "{{ is_state('input_boolean.person_front_drive', 'on') }}"
        device_class: motion

Now for appdaemon, first of all in your apps.yaml add the following.

object_drive:
  module: zoneminder
  class: ZoneminderHass
  monitor_id: 4
  alarm_duration: 30
  switch: input_boolean.person_front_drive
  object_detect: "person"

Monitor Id = your zoneminder monitor id
alarm_duration = how long to leave your virtual motion sensor as “Detected” in seconds.
switch = the boolean_switch we created
object_detect = the object type to trigger a motion event, the object is as named by zoneminder

Next you need this code in your appdaemon apps directory, simply paste it into a file called zoneminder.py

import adbase as ad
import json

class ZoneminderHass(ad.ADBase):

  def initialize(self):
     self.adbase = self.get_ad_api()
     self.hass = self.get_plugin_api("HASS")
     self.mqtt = self.get_plugin_api("MQTT")

     self.monitor_id = self.args['monitor_id']
     self.alarm_duration = self.args['alarm_duration']
     self.switch = self.args['switch']
     self.object_detect = self.args['object_detect']

     self.mqtt.listen_event(self.event_callback, "MQTT_MESSAGE", topic = 'zoneminder/' + str(self.monitor_id))

# HANDLE A ZM MOTION EVENT, IF ITS A PERSON THEN SET THE MOTION SENSOR TO ON
  def event_callback(self, event_name, data, kwargs):
#     self.adbase.log("======================" + data['payload'])
     details = json.loads(data['payload'])
     personCount = 0

     for detection in details['detection']:
       if detection['label'] == self.object_detect:
         personCount += 1

     logMessage = "Num %s detected %s" % (self.object_detect,str(personCount))
     self.adbase.log(logMessage)

     if personCount > 0:
       logMessage = "Setting %s to on" % (self.switch)
       self.adbase.log(logMessage)
       self.hass.turn_on(self.switch)
       self.adbase.run_in(self.timeout_callback, self.alarm_duration)

# SET THE VIRTUAL MOTION DETECTION TO CLEAR
  def timeout_callback(self, kwargs):
    self.hass.turn_off(self.switch)
    logMessage = "Setting %s to off" % (self.switch)
    self.adbase.log(logMessage)

And there you go, you end up with a virtual motion sensor (the binary_sensor you created above).

Hope this helps someone, if anyone has a better way of doing this then let me know.

Cheers,

Jon

Posts: 2

Participants: 2

Read full topic


Template to count entities that contain certain characters?

$
0
0

@TMB wrote:

I am trying to get a count (number) of all my entities that contain the word tmpl in the entity_id

I suffix all my template sensors with tmpl to distinguish them from the normal sensors.

I found this code and modified a bit. It returns all the entities as a list.

{%-for state in states 
    if (
          (state.entity_id.endswith("tmpl"))
        )  -%}        
        {%- if loop.first -%}{% elif loop.last -%} {% else -%}  {% endif -%} 
           {{state.name}} {% if state.name.endswith('tmpl')%}  {%else%}  {%endif%}
{% endfor%}

Now my question is; how do I count them?

Posts: 4

Participants: 2

Read full topic

Xiaomi temperature sensor has no history

$
0
0

@amundmr wrote:

Hi!
I’ve been struggeling a lot getting my Xiaomi Aqara temp&humid sensor display history. I get a reading, and it updates when the temperature changes, however there is no history. This article might be of help to me, but I want it to work regularly in stead of this. It did work before, and suddenly stopped working. The state info looks like this:
image

I’ve tried resetting my database and waiting for new data… Didn’t work. I’ve tried switching my entire database to MariaDB; didn’t work. I’ve also tried:

recorder:
  db_url: !secret mariadb_connection_url
  include:
    entities:
      - sensor.temperature_158d0002253007

With no luck.

The history data from the sensor is available in the Xiaomi Home app.

My only error log is like this:

2020-03-15 12:45:19 ERROR (MainThread) [homeassistant.core] Error doing job: SSL error in data received
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 526, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 207, in feed_ssldata
    self._sslobj.unwrap()
  File "/usr/lib/python3.7/ssl.py", line 767, in unwrap
    return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2609)

Also: Other sensors (Like raspberry pi CPU temp) works flawlessly with history.
You can also see my HA github repo here: https://github.com/amundmr/HomeAssistant which has two screenshots of the non-working Xiaomi temp sensor and the working RPi CPU temp sensor in the lovelace ui using mini-graph-card.

Does anyone know what I can try?
Best regards.

Posts: 1

Participants: 1

Read full topic

433mhz devices gives me "This entity does not have a unique ID"

$
0
0

@TheHoff wrote:

Greetings
I’m in the process of migrating from Domoticz to Hass.io 0.106.6 but have run into trouble with my 433mhz setup. I’m using RFXtrx433E with 1043Pro1 firmware which I took right from my Domoticz where it’s been running for years. I’m using 433mhz primarily for Oregon WGR800 wind gauge and some temperature sensors but I also a few wall switches and a bunch of cheap remote devices controlling lights and heaters.
HA detects the transceiver and starts populating the Entities table but when I click any of these devices I get the message “This entity does not have a unique ID, therefore it’s settings can not be managed from the UI.” Adding the devices manually in the configuration doesn’t help.
I need some pointers?

My configuration.yaml is
rfxtrx:
  device: /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A120MAML-if00-port0
  
binary_sensor:
  platform: rfxtrx
  automatic_add: true
  devices:
    0b1100260087ff3e10010f70:
        name: Utelampor
sensor:
  platform: rfxtrx
  automatic_add: true
  devices:
    105602104a0000e1004200456874205269:
        name: Vidmatare
switch:
  platform: rfxtrx
  automatic_add: true
light:
  platform: rfxtrx
  automatic_add: true
cover:
  platform: rfxtrx
  automatic_add: true

Regards
Fredrik

Posts: 2

Participants: 2

Read full topic

I cant see white value slider

$
0
0

@lpt2007 wrote:

Why I can’t see white value slider?

here is my config:

  - platform: mqtt
    name: "mqtt_bathroom_ir_light"
    state_topic: "home/rooms/bathroom/light/status"
    command_topic: "home/rooms/bathroom/light/status"
    availability_topic: "home/devices/controllers/ir2wifi-01/status"
    brightness_command_topic: "home/rooms/bathroom/light/dimm"
    brightness_state_topic: "home/rooms/bathroom/light/dimm"
    brightness_scale: "100"
    white_value_command_topic: "home/rooms/bathroom/light/ct"
    white_value_state_topic: "home/rooms/bathroom/light/ct"
    white_value_scale: "100"
    qos: 0
    payload_on: "on"
    payload_off: "off"
    optimistic: false
    retain: true

Posts: 1

Participants: 1

Read full topic

Door Sensor automation xiaomi

Tado valves and thermostat: Battery

Methodology Question

$
0
0

@martoq wrote:

I have been running HA for probably two years now and in that time my home has acquired more and more smart devices. I’m doing so I’ve noticed a degrading affect with HA and Alexa. There are countless duplicate items learned either in HA or Alexa and they introduce them to the other.

My question is which should be the “athuority” on all devices. Should it be Alexa knowing everything and HA learns them from it or the inverse where HA learns everything and Alexa learns it from HA.

-Ross

Posts: 1

Participants: 1

Read full topic


Rendering a "screenshot" of the current state of a Lovelace card

$
0
0

@ryanm7780 wrote:

Does anyone know of a way to automate the creation of an image file (JPG, PNG, etc.) that shows the current state of a Lovelace card? What I’m trying to accomplish is getting what would be like a screenshot of a card so that I can use it in automations. For instance, I’d like to send a telegram message showing the events for the day on a calendar in the morning. The same would be cool with the weather forecast for the day from a weather card. Anyone know of a way to do that?

Posts: 1

Participants: 1

Read full topic

Hide_if_away option (with value 'False') is deprecated

$
0
0

@Johann_Edelmuller wrote:

I have searched all my yaml configs with notepad ++, but nowhere have more hide_if_away entries!

Protokolldetails ( WARNING )
Logger: homeassistant.components.device_tracker
Integration: Geräte-Tracker (documentation, issues)
First occured: 15:57:27 (4 occurences)
Last logged: 16:02:38

The 'hide_if_away' option (with value 'False') is deprecated, please remove it from your configuration. This option will become invalid in version 0.107.0

Posts: 3

Participants: 3

Read full topic

Can you template from an array of attributes?

$
0
0

@klogg wrote:

Is it possible to template on arrays of attributes? (I think I have the terminology right :wink: )

I know I can do this:

{% set sensor_id= '1' %}
{% set my_value = state_attr('sensor.my_sensor_' ~ sensor_id, 'my_attribute') %}

But what if the attributes are an array? As far as I am aware the only way to extract these is to use the form:

{% set my_value = states.sensor.my_sensor_1.attributes.array[0].my_attribute %}

What I’d like to be able to do is this (which obviously doesn’t work and neither do the many other forms I’ve tried)

{% set my_value = states.sensor.my_sensor_{{ sensor_id }}.attributes.array[0].my_attribute %}

Is there a way to do this?
Thanks

Posts: 1

Participants: 1

Read full topic

Where are the home directory held in hassio

$
0
0

@gbond wrote:

home assistance install on virtual box and node red install when I out put to a file within node-red

where do I find the file in the virtual machine directory

Posts: 1

Participants: 1

Read full topic

Deconz ikea on/off no entity

$
0
0

@RezzZ wrote:

Hi guys, just started with the combeeII with deconz in docker. All works so far, migrating xiaomi sensors etc and just tried my first tradfri light with on/off switch. All are paired in deconz, and the switch works when setting up rules to control the light via deconz.

The integration with HA also shows all devices (even xiaomi smoke detectors that are not shown in deconz but are connected).
Problem is, my on/off switch doesn’t show an entity like all other sensors and lights:

any thoughts? what am I missing? or is this a bug?

Posts: 3

Participants: 2

Read full topic

The scene.create service: Is it documented?

$
0
0

@klogg wrote:

Shortest question ever.
The title says it all.

I can’t find anything about it anywhere, not even on the Scenes page :wink:

Posts: 2

Participants: 2

Read full topic

Adding My First Integration (Lutron)

$
0
0

@Pashovski wrote:

After watching many videos, and doing lots of the reading on here, I have come to the realization that I must humbly ask for help. In the community addons I theLutron Certificate . In the documentation for the Lutron Caseta, it says:

The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.

  1. Search for the “Lutron Certificate” add-on in the add-on store and install it.
  2. Start the “Lutron Certificate” add-on.
  3. Check the logs of the “Lutron Certificate” add-on to see if everything went well.
  4. Open the web UI for the “Lutron Certificate” add-on and follow the steps.
  5. Configure [Lutron Caseta ] in your configuration.yaml file.

But when I get to setp 4 it asks me to put in the IP address, and every time I do it, I get: internal server error

Cont…To use Lutron Caseta devices in your installation, you must first log in to your Lutron account and generate a certificate that allows Home Assistant to connect to your bridge. This can be accomplished by downloading and executing get_lutron_cert.py,

Am I not doing what the documentation says correctly - downloading and executing get_lutron_cert.py ?

The documentation also says to assign a static IP to the Lutron Smart Bridge Pro - Currently it is on DHCP and the IP is 192.168.1.2 Should I change that, and what should I assign it to eg, 192.168.1.7 ? When I unselect DHCP in the Lutron App I get a warning saying: Changing these settings can make the Lutron System Unreachable

I swear I wanted to get farther in the process than this before I started asking for help. Hopefully, I am not as lost as I feel. I’m trying to provide as much info as possible to not spam up the forums:
Hassio Lovelace on Raspberry pi4, 7 Lutron Caseta Wireless dimmers, Lutron Smart Bridge Pro.I have installed SambaShare, and File editor. On my PC I have installed VS Code. On my PC I am able to navigate to the config.yaml

Posts: 1

Participants: 1

Read full topic


Dynamic cameras? Can I turn cameras on/off without errors?

$
0
0

@elduderino1 wrote:

I have a couple of cameras (Wyze Cams) that I want to turn on and off based on whether I’m in the house.

Currently I have them set up as ffmpeg camera entities, but they throw lots of errors when the cameras are turned off.

Is there a way to have the camera entities only update/fetch images under certain conditions?

Posts: 2

Participants: 2

Read full topic

Add Light to AREA

$
0
0

@Vaughanza wrote:

Hi Guys
I added a Sonoff Basic with these setting ( setoption19 1 & setoption30 1 ) and found light ( sonoff ) in my integrations but can not find how to add the Light to a AREA ?

Thanks

Posts: 3

Participants: 2

Read full topic

How do I create a button in my overview that can represent the current state

$
0
0

@Lars_Andersen wrote:

I want to create a button which I can trigger and shows the current state of a flow.
I am using Node Red and I am trying to create a flow that changes a sensor depending on if I am home or not. I would like to have a button in my dashboard showing if I am home or not and that I actually can force a change of state by clicking the button.
I saw some discription on the input bolean. I think I manage to setup a input_boolean.yaml file which looks like this:

notify_home:
name: Lars Home
initial: on
icon: mdi:car

I am missing the link to how I can use this to be shown in the overview and then change the state if I am home or not.
I use Life360 which works fine in my node-red flow.
In my overview I am trying to correct an entity card, but I can see my new created input boolean. Maybe this is not the right way to do this?
Please be a bit detailed as I am totally new to Home Assistant.

Posts: 1

Participants: 1

Read full topic

Dynamic Cards / Layout?

$
0
0

@Adam_Zilko wrote:

Is there a way to dynamically show cards / adjust the layout of items in Lovelace? For example, I have a lot of media players - can I have the one(s) playing to display at the top (or wherever)?

Similarly - let’s say I’m driving home, can I have the garage cards show at the top?

Posts: 1

Participants: 1

Read full topic

Todoist - update_entity service not working for todoist

$
0
0

@PlayedIn wrote:

I wanted to ask if the update_entity service does not work for the todoist integration by design? If I’m not mistaken, the scan_interval for the component is set to 15 minutes. That is roughly the time it takes from when I add a new todoist task before it shows up in the calendar entity.

I tried setting the scan_interval in configuration.yaml, but that had no effect. I tried using the update_entity service to get the calendar to update, but that doesn’t work either.

Perhaps the api for todoist only allows for 15 minute updates for the free version of Todoist?

I wanted to ask this before considering setting it up as a custom component and changing the MIN_TIME_BETWEEN_UPDATES to something less than 15 minutes in calendary.py:

Posts: 1

Participants: 1

Read full topic

Viewing all 105910 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>