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

Best approach to determine amount of time a device run on a given date

$
0
0

@vazquezjm wrote:

Hi.

I’m trying to simplify the way I get the number of minutes a device was ‘on’. Currently, I’m using a SQL query to get the minutes from the SQLite DB, but I’m pretty sure there has to be another way.

So, my sensor template looks like this:

- platform: sql
  queries:
    - name: panel_minutes_today
      query: "SELECT (SUM(Interval) / 60) As panel_minutes FROM (SELECT CAST((JulianDay(T2.created) - JulianDay(T1.created)) * 24 * 60 * 60 As Integer) AS Interval FROM states T1 JOIN states T2 ON T1.entity_id = T2.entity_id AND T2.created > T1.created AND T2.state = 'off'  WHERE T1.entity_id = 'switch.panel_oficina' AND T1.state = 'on' AND date(T1.created) = date('now') GROUP BY T1.entity_id, T1.state, T1.created) t;"
      column: 'panel_minutes'

SQL query for easier reading:

SELECT (SUM(Interval) / 60) As panel_minutes FROM (
	SELECT CAST((JulianDay(T2.created) - JulianDay(T1.created)) * 24 * 60 * 60 As Integer) AS Interval 
	FROM states T1 
		JOIN states T2 ON T1.entity_id = T2.entity_id 
		AND T2.created > T1.created 
		AND T2.state = 'off'  
	WHERE T1.entity_id = 'switch.panel_oficina' 
	AND T1.state = 'on' 
	AND date(T1.created) = date('now') 
	GROUP BY T1.entity_id, T1.state, T1.created
) t;

As you might noticed, I use the states table and based on the state field (‘on’ and ‘off’) I count the seconds between the two dates, then convert to minutes.

This approach works but has a pitfall (probably more) and it is the scenario where the start date is on Date A but the end date is on Date B (where Date B = Date A + day).

Is there a better approach to get the time in minutes a device worked on a given date?

TIA

Posts: 1

Participants: 1

Read full topic


Mobile app "battery state" missing entity

$
0
0

@mkanet wrote:

One of my phones is not creating a “battery state” entity via the phone app… all my other phones do.

Can I just remove the integration, reboot HA, then sign in the phone app again in an attempt to resolve this issue? I’m a little nervous I might break something by doing this. Is it possible the phone just has an incompatible with battery state?

Posts: 1

Participants: 1

Read full topic

How to replace card title mdi icon with custom png?

$
0
0

@mkanet wrote:

How can I change the card mdi icon below to a custom png image; such as a photo?
alyssa

Here’s my card code:

entities:
  - entity: sensor.pvg100_battery_level
    name: 'Battery Level:'
  - entity: sensor.pvg100_wifi_connection
    name: 'Wi-fi:'
  - entity: person.alyssa_person
    name: 'Location:'
icon: 'mdi:account'
show_header_toggle: false
title: Alyssa
type: entities

I tried changing icon: 'mdi:account with icon: '/local/images/Alyssa.png’; however, that didn’t work. If it’s not possible to do this way, maybe there’s a custom card that will let me do this?

Posts: 1

Participants: 1

Read full topic

Sensor for Days to Go

$
0
0

@dicko wrote:

Hi

This is my code for days to go for my next bin collection. Why is it not showing the days to go ?

I use the same code for my days to go when using it for my google calendar. This time Im pulling the date from Node Red

- platform: template
  sensors:
    green_bin_countdown:
      friendly_name: Days to Go
      entity_id:
        - sensor.green_bin
        - sensor.date_time
      value_template: >
        {% set collection_sensor = states.sensor.green_bin.state %}
        {% set collection_date = strptime(collection_sensor,'%A %d %b %Y') %}
        {% set daystogo = strptime(collection_sensor, "%Y-%m-%d %H:%M:%S").strftime("%A") %}
        {% set daystogo2 = strptime(collection_sensor, "%Y-%m-%d %H:%M:%S").strftime("%b %d, %Y") %}
        {% if as_timestamp(collection_sensor) / 86400 - as_timestamp(as_timestamp(now()) | timestamp_custom("%Y-%m-%d 00:00:00",true)) / 86400 == 0.0 %}
        TODAY
        {% elif as_timestamp(collection_sensor) / 86400 - as_timestamp(as_timestamp(now()) | timestamp_custom("%Y-%m-%d 00:00:00",true)) / 86400 == 1.0 %}
        TOMORROW
        {% elif as_timestamp(collection_sensor) / 86400 - as_timestamp(as_timestamp(now()) | timestamp_custom("%Y-%m-%d 00:00:00",true)) / 86400 >= 7.0 %}
        {{ (as_timestamp(collection_sensor) / 86400 + 1 - as_timestamp(now()) / 86400) | int  }} days
        {% elif as_timestamp(collection_sensor) / 86400 - as_timestamp(as_timestamp(now()) | timestamp_custom("%Y-%m-%d 00:00:00",true)) / 86400 >= 2.0 %}
        {{ daystogo }}
        {% else %}
        Unknown
        {% endif %}

Thanks

Martyn

Posts: 1

Participants: 1

Read full topic

I deleted an account, now I can't recreate it.. error: "username_exists"

$
0
0

@mkanet wrote:

So… how do I recreate the account after deleting it if I’m getting the error “username_exists”? The whole reason I deleted the account was because I couldn’t remember the password.

I read somewhere that I have to delete files from the .storage folder. I’m not sure what file(s) to delete. I am very motivated to use the same username… however, I don’t want to lose all my other users and their respective passwords.

Is there a reason why administrators can’t just change passwords for regular users?

Posts: 1

Participants: 1

Read full topic

Media player automation doesn't work in Google Home

$
0
0

@crpgbogor wrote:

Hello friends,

System Environment: Hassio in docker

A noob here. My media_player.play.media works fine on my Google Home when using service call in developer tools, even when using local file (in config/www/local/audio). However, I can never get it to work with automation. I tried using the gui (from configuration/automation) and then click “execute”. It doesn’t work. I tried using the yaml file directly in config/automation.yaml also doesn’t work.

Other automation, such as alarm siren or notify HA in android work just fine. Only the Google Home play.media automation doesn’t work (google home play.media service call in developer tool works fine).

I hope someone here will be able to share some tips.

Many thanks

Posts: 1

Participants: 1

Read full topic

Can't get fold-entity-row coded correctly

$
0
0

@Stevemm wrote:

New to HA within the last few days and haven’t coded anything in nearly 20 years. I currently setup my lovelace dashboard so it pulls up a separate view when I use the IOS app. The way it is currently setup it uses a bunch of fold-entity-rows for all of the different areas of my house. That all works fine but since it’s not in card it is all transparent and doesn’t look too pretty.

Decided to try and make it into a folding entity card, which works, but the toggle switch in the header doesn’t do anything like it does with a normal entity card. The toggle switch for the lights within the cards work but I would prefer to not have to unfold each card to see if something is on if possible. Here is the code I am using, I’m sure its probably a simple fix but I have no idea. I’ve made it this far just frankensteining things together.

entities:
  - entities:
      - entity: light.living_room_lights
        toggle: true
        type: 'custom:slider-entity-row'
      - fan.living_room_fan
      - lock.front_door
    head:
      label: .
      type: section
    type: 'custom:fold-entity-row'
title: Living Room
show_header_toggle: true
type: entities

The toggle switch on the 2nd line from the bottom is the one thats there but does nothing. I also have a period in the label section below head because if it’s not there the arrow to fold and unfold the card is too close to the toggle switch. Not sure if there is a way to just make that blank instead of a .

Posts: 1

Participants: 1

Read full topic

Tracker showing location in battery % area

$
0
0

@peternest wrote:

Hi All,

Not sure what is happening here. This has been working without trouble for several months until now.

I have 2 users that are tracked and a card showing:

peter (username) location
peter battery %
wife (username) location
wifes battery %

But I have noticed it is now showing on the second line only

peter location%

ie my battery percentage is being changed to location %

I am running Home Assistant Core 0.108.3 on ubuntu virtual.

Has anyone seen this before or have any ideas on resolving (or will upgrade resolve).

cheers

Posts: 1

Participants: 1

Read full topic


Tuya bulbs was recognized as switches

$
0
0

@Leandro_Pessoa wrote:

After configuring the integration with the Tuya devices, all lamps were configured as switches, allowing only me to turn them on and off. The lamps have the ability to change color and intensity, but as they were recognized as switches, so I don’t have these features in the home assistant. Has anyone ever experienced this?

Posts: 1

Participants: 1

Read full topic

Button card to show different states

$
0
0

@Mark53 wrote:

I am using a button card for switches that unlock my doors. The state shows as “off”, can I change this to “locked”? If so how would I do this.
Thank you in adviance.
Mark

Posts: 1

Participants: 1

Read full topic

Deconz(conbee 2) can't find Hue bulbs

$
0
0

@JimHead wrote:

Hi All,

This is the first time i’ve tried using the Conbee 2 or Deconz. When i try to add the Hue bulbs to Phoscon it just doesn’t find them. I’m relatively new to HA so i could really use some help.

Info:

  • HA running on a rasberry pi 4 (this all works fine with many other devices).
  • New Conbee 2 connected to the USB 2 ports of the raspberry pi via a ~1m usb extension cable (less than 5cm from the hue bulb). Gateway listed as ConBee 2 version 2.05.75 / 3/8/2020. Device in config is “/dev/ttyACM0”, using the longer device id lists the device as a RasBee in Phoscon and also doesnt work.
  • 3x Hue bulbs (i believe gen 1) originally connected to the V1 hue bridge, all bulbs deleted from the hue bridge app to reset them. Tried turning these off and on before and during the lights scan.

I get the following error listed in the supervisor, not sure if it’s related:
20-05-12 02:46:16 ERROR (MainThread) [supervisor.api.ingress] Ingress error: None

I don’t have any other zigbee devices to test the conbee2 with. Any help before i pull all my hair out would be greatly appreciated.

Posts: 1

Participants: 1

Read full topic

Help needed with Template Sensor (JSON)

$
0
0

@Hurde wrote:

I am pulling information from Google Sheets using the RESTful integration, but I’m having issues extracting the right data out from the reply.

Let’s call my REST sensor sensor.googlesheets and it has a state of

{
   "range":"'Sheet'!B5:B8",
   "majorDimension":"ROWS",
   "values":[
      [
         "value1"
      ],
      [
         "value2"
      ],
      [
         "value3"
      ],
      [
         "value4"
      ]
   ]
}

I’m trying to extract the values value1/value2/value3/value4 to own template sensors, but I can’t get them right. What do I need to fix in my template sensor?

  - platform: template
    sensors:
      googlesheets_value1:
        icon_template: 'mdi-cash-multiple'
        value_template: >-
          {{ states.sensor.googlesheets.state["values"][0][0] }}

Posts: 3

Participants: 2

Read full topic

Changing font size on UI for Entities card

$
0
0

@orc.trial wrote:

any suggestion on how to change the font size on the Entities card? I tried the card-mode plugin but no luck. I have downloaded the card-mod.js file to a local folder /root/addons
and added the url to resources

is there any other way to do it?

sample Entity card config:

entities:
  - entity: switch.dining_light
    name: Dining Light
  - entity: switch.study_light
    name: Study Light
  - entity: switch.garage_light
    name: Garage light
  - entity: switch.garage_entrance
    name: Garage Entrance light
show_header_toggle: false
title: Switches
type: entities

running latest version of HA on raspberry pi with the homeassistant image

Posts: 1

Participants: 1

Read full topic

"Zzh!" (short for "Zig-a-zig-ah!") open-source hardware licensed Zigbee USB-stick based on TI CC2652R

$
0
0

@Gamester17 wrote:

“Zzh!” (short for “Zig-a-zig-ah!”) Zigbee USB-stick/dongle/adapter by Electrolama (open-source hardware licensed projects by @omerk and friends) is now available for purchase for $35 via Tindie.

Based on the Texas Instruments CC2652R chip this can be seen as a much more powerful radio and Zigbee 3.0 capable MCU replacement for the popular CC2530 and CC2531 Zigbee coordinator USB-sticks/dongles/adapters.

More detailed information is available on the project page at Electrolama:

Zzh! (Zig-a-zig-ah!) design is released as open-source hardware licensed under the Solderpad Hardware License 2.0 with its PCB schematic source files available in EAGLE format on GitHub, meaning that if you have the skills you can help the community improve the hardware and/or build your own adapter.

Texas Instruments Z-Stack 3.x Zigbee 3.0 coordinator firmware available for it should make it compatible with the Zigbee2mqtt gateway with Home Assistant (as well as with other home automation software such as IoBroker, Domoticz, and OpenHAB).

There is also initial experimental support for it in the native ZHA integration built-into Home Assistant (which is compatible with many different Zigbee adapters from multiple manufacturers, without Zigbee2mqtt).

It should be highlighted that while both Zigbee2mqtt and the native ZHA integration in Home Assistant can be generally be considered stable, the newly added support for this and other types of Texas Instrument CC chip-based Zigbee adapters to the native ZHA integration is still experimental thus not yet stable so I would only recommend these dongles to developers wanting to help the development of the native ZHA integration or experiment right now.

Note! I have no direct or indirect affiliations with this product or any of its manufacturers/parts.

PS: FYI, I read on the Electrolama project page that Omer also has plans to design an even more powerful version based on the most costly CC2652P chip which radio has an integrated Power Amplifier.

Posts: 2

Participants: 2

Read full topic

Is it still possible to disable updates for Addons? Toggle is now missing

$
0
0

@diagonali wrote:

I used to disable updates to addons when I’d got the whole system working well and take a snapshot image of the entire system in that state (Rpi 4 - SD card install) using the excellent rpi-clone script.

Knowing that a system configuration with specific versions of addons and Home Assistant itself is stable is very valuable.

Has the ability to disable addon updates been removed? I can’t find any information on this anywhere. If so, is there a way to disable all updates (addon and system) so that I can install them manually after having taken snapshots of known-good setups?

Posts: 1

Participants: 1

Read full topic


Newly added node does'nt appear

$
0
0

@liksvette wrote:

I’ve been using zwave successfully for a long time. However, I recently added a new zwave component and it’s not showing up in the Homeassistant interface. I see it in the zwave xml in the config folder and I see it in the zwave logs.
Anyone know what’s going on here? Has there been some changes in the zwave integration lately that affects it?

Posts: 1

Participants: 1

Read full topic

Prometheus metrics and unknown values

$
0
0

@skibbi wrote:

Hello,
I decided to try exporting haas metrics to prometheus. It works fine, however I noticed some issue. I have a sensor which reports data randomly (issues with bluetooth range). So sometimes sensor is giving unknown value in haas UI, but in prometheus metrics it reports 0. This messes the charts as I have 0 instead of nulls. Is there a way to report unknown metrics values as nulls for prometheus?

I use latest haas 0.109.6

Posts: 1

Participants: 1

Read full topic

DLIB - image processing - how to display faces on Lovelace UI

$
0
0

@Thomas_LeBlond wrote:

Hello I’ve succeeded to use DLIB image processing (included no additional required), however i’m not able, as noob to show it on the Lovelace UI with name faces on a card :thinking: :thinking:

:hot_face: I’d like to be able to display :

  • last motion : 1hour
  • last face : Thomas
  • last image : #croppedFaceImage

This is my working config :

  • configuration.yaml
camera:
  - platform: generic
    name: portailWebcam
    still_image_url: http://192.xxx.x.xx:xxxx/cgi/jpg/xxxxxcgi
    stream_source: rtsp://192.xxx.x.xx:xxx/xxxxx.sdp
    username: xxxxxx 
    password: yyyyyyyyy

image_processing:
  - platform: dlib_face_detect
    source:
      - entity_id: camera.portailwebcam

  - platform: dlib_face_identify
    source:
      - entity_id: camera.portailwebcam
    faces:
     Thomas: /config/www/faces/Thomas.jpg
     Michel: /config/www/faces/Michel.png
  • Lovelace UI

image

type: picture-glance
title: Garden
image: 'https://demo.home-assistant.io/stub_config/kitchen.png'
entities:
  - entity: binary_sensor.updater
  - entity: image_processing.dlib_face_portailwebcam_2
aspect_ratio: 0%
entity: image_processing.dlib_face_portailwebcam_2
camera_image: camera.portailwebcam
type: entities
title: Movement / Door Sensor's
entities:
  - entity: image_processing.dlib_face_portailwebcam_2
    name: Last face dectection
    secondary_info: last-changed

Posts: 1

Participants: 1

Read full topic

Problems using script variables in if / else queries

$
0
0

@helfm wrote:

Dear all,

Can somebody help me, please. I’m trying to query a variable in a script. No error is reported. But it never jumps into the branch. What am I doing wrong, or can’t this stuff work?

Example Code:

#**Automation** (Only the call of the service):

  action:
    - service: script.script_rollo_open_all
      data:
        title: 'Sommerautomatisierung'
        message: 'Rollo am Morgen zum Lüften geöffnet!'
        orientation: 'all'

#**Script** (I switch a Boolean as an example):

script_rollo_open_all:

  fields:
    title:
      description: 'The title of the notification'
      example: 'State change'
    message:
      description: 'The message content'
      example: 'The light is on!'
    orientation:
      description: 'geographic direction'
      example: 'all'
        
  sequence:
    # send a message
    - service: notify.telegram
      data_template:
        title: "{{ title }}"
        message: "{{ message }}"
    # Test
    - service: input_boolean.turn_on
      data_template:
        entity_id: >
          {% if ( "{{ orientation }}"  == 'all' ) %}
            input_boolean.automatisierung_schlafzimmer
          {% endif %}

this example does not work: ( “{{ orientation }}” == ‘all’ )
this example works: is_state(‘input_boolean.automatisierung_gaestezimmer’, ‘on’)

Is it even possible to query a string variable in a script with an “If”?

I hope someone can help me.

BR Markus

Posts: 1

Participants: 1

Read full topic

Problems to extract value from website of json format

$
0
0

@Savanna_Chow wrote:

Hi,

Can some one help me to extract value from a website? This website represent local air-quality values in json format:

https://pm25.lass-net.org/data/last.php?device_id=74DA38F20824

I’m trying to get the particle matter value (which is “s_d0”) under “feeds” - “Aribox” of the website json results. So I add a sensor in the configuration.yaml file as below:

sensor:

However, I get no results fro the sensor, it just show up “unknown” from the sensor state. I check most of the discussion on foru, but still got no clues on how to get the correct value. No matter how I try I still get “unknown” :frowning:

Would someone please help me with this?

Thanks~

Posts: 4

Participants: 3

Read full topic

Viewing all 106496 articles
Browse latest View live


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