Code Monkey home page Code Monkey logo

hass-momentary's People

Contributors

misa1515 avatar tech165 avatar twrecked avatar wrt54g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hass-momentary's Issues

Help with Code for Button

So I added:
momentary:
to my config.yaml

But where do I add the following? Because I added it to a manual card on the lovelace dashboard but it doesn't seem to work. So I have an input select in my Automations.yaml called: input_select.spa_first_blower. Which is linked to the entity called: pool1_channels2_mode in configuration.yaml

So how do I link that to your card?

Where do I put the following and how to I link it to the Entity or the Input_Select, which in addition, which one do I link it to?

In summary: my API to my SPA cycles through states, 'auto' 'on' 'off'. it does not allow me to select one using input select, I actually need to cycle. So I am trying to create a button which allows me to cycle through and shows the current status on the dashboard so that after we finish in the spa we can set it back to 'off'

switch:

platform: momentary
name: Empty House Trigger
mode: on
toggle_for: 5
cancellable: True


I have added the requested info below. The communication is via REST Api with their systems. The problem I am having with the below is that input_select with a drop down does not work because the API does not allow you to select a 'state' it only allows you to cycle through the individual modes - off, on, auto. Ideally I would like to have a button that just sets the state but I am not sure how I would even do that.

So my backup was just to have a button that says "Top Spa Bubbles" and the current state that it is in, so you can press it - check the state and press it again and check the new state.

Thank you for your help!

In my config.yaml I have

spa_first_blower:
name: Top Spa Bubbles
options:

  • "Auto"
  • "On"
  • "Off"
    In my automation.yaml I have:

id: '1628215649697'
alias: Top Spa Bubbles On
description: ''
trigger:
platform: state
entity_id: input_select.spa_first_blower
to: 'on'
condition: []
action:
service: rest_command.poolaction
data:
action_code: 1
device_number: 2
value: 2
delay: 2
service: homeassistant.update_entity
entity_id: sensor.pool1_channels2_mode
mode: single
id: '1628215649696'
alias: Top Spa Bubbles Off
description: ''
trigger:
platform: state
entity_id: input_select.spa_first_blower
to: 'off'
condition: []
action:
service: rest_command.poolaction
data:
action_code: 1
device_number: 2
value: 0
delay: 2
service: homeassistant.update_entity
entity_id: sensor.pool1_channels2_mode
mode: single

7.0a3 - Change names in yaml file gives extra entities in HA

Hi There,

Im more then happy to help you and make this integration better.
I installed the 7.0a3 version and created a 'momentary.yaml' file. Added my switches into it.

HA created new switches without momentary_ part in front. For me better to have this into the entity name.
So added 'Momentary' in front of the name.

Now HA creates second entities with the new names. It doesn't remove the old entities.

I removed the integration. Removed the old entities. Add integration and now I have the correct entities without the old once in system as well.

Off-topic: In future we are able to create switches in HA system itself without the .yaml file? Thats whole idea of the config eco system right?

Confused about where code needs to go

So I added:
momentary:
to my config.yaml

But where do I add the following? Because I added it to a manual card on the lovelace dashboard but it doesn't seem to work. So I have an input select in my Automations.yaml called: input_select.spa_first_blower. Which is linked to the entity called: pool1_channels2_mode in configuration.yaml

So how do I link that to your card?

Where do I put the following and how to I link it to the Entity or the Input_Select, which in addition, which one do I link it to?

In summary: my API to my SPA cycles through states, 'auto' 'on' 'off'. it does not allow me to select one using input select, I actually need to cycle. So I am trying to create a button which allows me to cycle through and shows the current status on the dashboard so that after we finish in the spa we can set it back to 'off'

switch:

  • platform: momentary
    name: Empty House Trigger
    mode: on
    toggle_for: 5
    cancellable: True

Detected that custom integration 'momentary' calls async_write_ha_state from a thread at custom_components/momentary/switch.py...

Since updating to HA Core 2024.5.0 I now this error in the HA logs:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 5:26:48 AM (1 occurrences)
Last logged: 5:26:48 AM

[281472740648384] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1680, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/momentary/switch.py", line 213, in turn_on
    self._start_activity(True)
  File "/config/custom_components/momentary/switch.py", line 210, in _start_activity
    self.async_schedule_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1258, in async_schedule_update_ha_state
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1008, in async_write_ha_state
    self.hass.verify_event_loop_thread("async_write_ha_state")
  File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
    frame.report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'momentary' calls async_write_ha_state from a thread at custom_components/momentary/switch.py, line 210: self.async_schedule_update_ha_state(). Please report it to the author of the 'momentary' custom integration.
Logger: homeassistant.helpers.frame
Source: helpers/frame.py:190
First occurred: 5:26:48 AM (1 occurrences)
Last logged: 5:26:48 AM

Detected that custom integration 'momentary' calls async_write_ha_state from a thread at custom_components/momentary/switch.py, line 210: self.async_schedule_update_ha_state(), please report it to the author of the 'momentary' custom integration

whenever one of my momentary switches is turned on. I was running version 0.6.3 but just updated to 0.7.0.alpha.6 and still have the issue.

Momentary command line switch

Greetings;

I just came upon your momentary switch and have installed and configured it. However, I am not clear on how I actually make the switch trigger things.

My current setup is using various command lines in switches, but inclusion in momentary throws error messages.

For example, from my configuration.yaml:

- platform: momentary name: Increase + mode: on toggle_for: milliseconds: 500 command_on: !secret arizer_increase command_off: !secret arizer_light_off value_template: "{{ value | regex_search('ACTIVE', ignorecase=True) }}"

produces the following error:

Invalid config for [switch.momentary]: [command_on] is an invalid option for [switch.momentary]. Check: switch.momentary->command_on. (See ?, line ?).

Can not create more than one momentary switch entity

If I create a second switch entity inside the configuration.yaml, upon reboot of the core or host the system will only recognize the second entry in the config file. Is there a setting I'm missing or does the functionality to support multiple switch entities not exist?

Feature request: Keep state of switch and timer after HA restart

Hi All,

I love this integration. Would be so nice to have option that the integration can check if there is a HA restart and before the restart switch was on and for how long. Then when HA run again keep state and go with the timer where its end because of restart.

Example:
switch 1 is on for total 7200 seconds. HA restart after 30min of turn on this switch.
When HA is restart, switch keep on and there is 5400 seconds left before it turns off.

I can't figure out how to turn off the momentary switch without having it turn on automatically.

I'm using:

alias: track_fan_toilette_off
description: ""
trigger:
  - platform: state
    entity_id:
      - light.fan_salle_de_bain_light
    to: "off"
condition: []
action:
  - service: homeassistant.turn_off
    data: {}
    target:
      entity_id: switch.momentary_auto_off_fan_toilette
mode: single

and

switch:
- cancellable: true
  mode: 'on'
  name: auto off fan toilette
  platform: momentary
  toggle_for: 15

When I turn off the physical switch, switch.momentary_auto_off_fan_toilette turn off, but it reactivates after 15 secs.

I'm expecting my config to turn off switch.momentary_auto_off_fan_toilette after 15 secs but not the reverse.

v0.3 breaks frontend with multiple switches

With the latest v0.3, when multiple switches are setup, hass frontend doesn't load and no errors are present in the log. Rolling back to v.2, all works as expected.

I am running hasbian docker v 97.2

Feature request: Momentary OFF feature

Similar to momentary ON, please allow an invert so that this can be used as momentary OFF. I would like to have a device ON all the time, but turned OFF for a couple of seconds only in emergency situations. Thank you.

toggle_for not working after upgrade

I did upgrade to version v0.6.1.1, after that toggle_for was not working.

Following my configuration

  • platform: momentary
    name: Allow Unlock
    mode: on
    toggle_for: 30

switch stay 'off' for no more tha 1s intead of 30sec.

I'm running HA as docker on Raspberry PI 4, version is 2023.1.2.

Would you help me?

Thanks in advance
Regards
Stefano

Shorter "on_for" time

Hello

I would like to use shorter on_for time if it possible.
I tried smaller values than 1s but it is not working.
Is it possible change this?

Thanks
Great Job

How to link it with an entity ?

Hello,

I have added a switch as per the documentation.
However, I don't understand how to link this to an entity ?
Ultimate goal is to display a button on lovelace that would trigger this switch

Thanks for your help !

Screenshot?

What does the push button look like in the frontend?

Error in HA logs: "No 'version' key in the manifest file for custom integration 'momentary'"

When the latest version of Home Assistant is starting up with the 0.5 release of the Momentary integration installed, I see the following error in the logs, indicating an issue which needs to be resolved before it becomes breaking:

Logger: homeassistant.loader
Source: loader.py:802
First occurred: 6:00:42 PM (1 occurrences)
Last logged: 6:00:42 PM

No 'version' key in the manifest file for custom integration 'momentary'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'momentary'

Naming

Just tried to remove the prefix and got this error.
Is there some wrong with my entry
Version
HA
core-2021.7.2

Error loading /config/configuration.yaml: could not determine a constructor for the tag '!stop_spray_and_dose'
in "/config/configuration.yaml", line 65, column 11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.