All Projects → Wibias → hass-variables

Wibias / hass-variables

Licence: other
Home Assistant variables component

Projects that are alternatives of or similar to hass-variables

Node Measured
A Node metrics library for measuring and reporting application-level metrics, inspired by Coda Hale, Yammer Inc's Dropwizard Metrics Libraries
Stars: ✭ 500 (+1328.57%)
Mutual labels:  counter, timer
inspector-metrics
Typescript metrics / monitoring library
Stars: ✭ 19 (-45.71%)
Mutual labels:  counter, timer
Dipstick
Configurable metrics toolkit for Rust applications
Stars: ✭ 92 (+162.86%)
Mutual labels:  counter, timer
tm
timers and timeline
Stars: ✭ 31 (-11.43%)
Mutual labels:  counter, timer
React Native Countdown Component
React Native CountDown
Stars: ✭ 193 (+451.43%)
Mutual labels:  counter, timer
performance-counters
Extremely useful library for collecting and tracking performance metrics in your .NET application
Stars: ✭ 16 (-54.29%)
Mutual labels:  counter
gobench
A benchmark framework based on Golang
Stars: ✭ 50 (+42.86%)
Mutual labels:  counter
tiny-timer
🕑 Small countdown timer and stopwatch module.
Stars: ✭ 39 (+11.43%)
Mutual labels:  timer
circlebars
Add circular progress bars and countdown timers easily with circlebars Created by @itaditya. Demo at >
Stars: ✭ 38 (+8.57%)
Mutual labels:  timer
ZLToolKit
一个基于C++11的轻量级网络框架,基于线程池技术可以实现大并发网络IO
Stars: ✭ 1,302 (+3620%)
Mutual labels:  timer
py better exchook
nice Python exception hook replacement
Stars: ✭ 35 (+0%)
Mutual labels:  variables
Tiny-Timer
Simple timer desktop app using electron
Stars: ✭ 51 (+45.71%)
Mutual labels:  timer
ha-google-home
Home Assistant Google Home custom component
Stars: ✭ 285 (+714.29%)
Mutual labels:  homeassistant-integration
telegram-counter-bot
A simple, easy to use counter bot to keep track of all the amazing things in your Telegram group!
Stars: ✭ 29 (-17.14%)
Mutual labels:  counter
use-countdown-timer
React hook exposing a countdown timer with optional expiration reset callbacks
Stars: ✭ 31 (-11.43%)
Mutual labels:  timer
CoreLooper
No description or website provided.
Stars: ✭ 34 (-2.86%)
Mutual labels:  timer
clappr-plugins
Main plugins for the Clappr project
Stars: ✭ 22 (-37.14%)
Mutual labels:  timer
time-tracker-cli
Super tiny and ligthway time tracker for all cli lovers
Stars: ✭ 79 (+125.71%)
Mutual labels:  timer
chronoman
Utility class to simplify use of timers created by setTimeout
Stars: ✭ 15 (-57.14%)
Mutual labels:  timer
textics
📉 JavaScript Text Statistics that counts lines, words, chars, and spaces.
Stars: ✭ 36 (+2.86%)
Mutual labels:  counter

hass-variables

A Home Assistant component to declare and set/update variables (state).

Since rogro82 seems to have abandoned his repository and his custom_component is really useful I just forked it and updated it so it's still works with ^2022.8.0!

Install

Manually

Copy variable folder in to your home-assistant custom_components folder

Automatically with HACS

This card is available in HACS (Home Assistant Community Store)

  1. In the HACS store click on Integrations and then click on the plus in the right bottom corner. Search for hass-variables click on it and then click on INSTALL THIS REPOSITORY IN HACS.
  2. Restart Home Assistant.

Then the variable custom component will be installable through HACS and you will be able to follow the future updates.

Configure

Add the component variable to your configuration and declare the variables you want.

Example configuration

variable:
  countdown_timer:
    value: 30
    attributes:
      friendly_name: 'Countdown'
      icon: mdi:alarm
  countdown_trigger:
    name: Countdown
    value: False
  light_scene:
    value: 'normal'
    attributes:
      previous: ''
    restore: true
  current_power_usage:
    force_update: true

  daily_download:
    value: 0
    restore: true
    domain: sensor
    attributes:
      state_class: measurement
      unit_of_measurement: GB
      icon: mdi:download

A variable 'should' have a value and can optionally have a name and attributes, which can be used to specify additional values but can also be used to set internal attributes like icon, friendly_name etc.

A variable can accept an optional domain which results in the entity name to start with that domain instead of variable.

In case you want your variable to restore its value and attributes after restarting you can set restore to true.

In case you want your variable to update (and add a history entry) even if the value has not changed, you can set force_update to true.

Set variables from automations

The variable component exposes 2 services:

  • variable.set_variable can be used to update a variables value and/or its attributes.
  • variable.set_entity can be used to update an entity value and/or its attributes.

The following parameters can be used with variable.set_variable:

  • variable: string (required) The name of the variable to update
  • value: any (optional) New value to set
  • attributes: dictionary (optional) Attributes to set or update
  • replace_attributes: boolean ( optional ) Replace or merge current attributes (default false = merge)

The following parameters can be used with variable.set_entity:

  • entity: string (required) The id of the entity to update
  • value: any (optional) New value to set
  • attributes: dictionary (optional) Attributes to set or update
  • replace_attributes: boolean ( optional ) Replace or merge current attributes (default false = merge)

Example service calls

action:
  - service: variable.set_variable
    data:
      variable: test_timer
      value: 30

action:
  - service: variable.set_variable
    data:
      variable: last_motion
      value: "livingroom"
      attributes:
          history_1: "{{states('variable.last_motion')}}"
          history_2: "{{state_attr('variable.last_motion','history_1')}}"
          history_3: "{{state_attr('variable.last_motion','history_2')}}"

action:
  - service: variable.set_entity
    data:
      entity: sensor.test_counter
      value: 30

Example timer automation

variable:
  test_timer:
    value: 0
    attributes:
      icon: mdi:alarm

script:
  schedule_test_timer:
    sequence:
      - service: variable.set_variable
        data:
          variable: test_timer
          value: 30
      - service: automation.turn_on
        data:
          entity_id: automation.test_timer_countdown

automation:
  - alias: test_timer_countdown
    initial_state: 'off'
    trigger:
      - platform: time_pattern
        seconds: '/1'
    action:
      - service: variable.set_variable
        data:
          variable: test_timer
          value: >
            {{ [((states('variable.test_timer') | int(default=0)) - 1), 0] | max }}

  - alias: test_timer_trigger
    trigger:
      platform: state
      entity_id: variable.test_timer
      to: '0'
    action:
      - service: automation.turn_off
        data:
          entity_id: automation.test_timer_countdown

Play and Save TTS Messages + Message History - Made by https://github.com/jazzyisj

This is more or less an answering machine (remember those?) for your TTS messages. When you play a TTS message that you want saved under certain conditions (ie. nobody is home), you will call the script Play or Save TTS Message script.play_or_save_message instead of calling your tts service (or Alexa notify) directly. The script will decide whether to play the message immediately, or save it based on the conditions you specify. If a saved tts message is repeated another message is not saved, only the timestamp is updated to the most recent instance.

Messages are played back using the Play Saved TTS Messages script script.play_saved_tts_messages. Set an appropriate trigger (for example when you arrive home) in the automation Play Saved Messages automation.play_saved_messages automation to call this script automatically.

Saved messages will survive restarts.

BONUS - OPTIONAL TTS MESSAGE HISTORY

You can find the full documentation on how to do this and andjust this to your needs in here.


More examples can be found in the examples folder.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].