Skip to content

Commit e04820a

Browse files
committed
Bump version and fix set_value(), add set_textvalue()
1 parent 4e57799 commit e04820a

File tree

5 files changed

+77
-5
lines changed

5 files changed

+77
-5
lines changed

appdaemon/plugins/hass/hassapi.py

+11
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,17 @@ def toggle(self, entity_id, **kwargs):
357357

358358
@hass_check
359359
def set_value(self, entity_id, value, **kwargs):
360+
self._check_entity(self._get_namespace(**kwargs), entity_id)
361+
if kwargs == {}:
362+
rargs = {"entity_id": entity_id, "value": value}
363+
else:
364+
rargs = kwargs
365+
rargs["entity_id"] = entity_id
366+
rargs["value"] = value
367+
self.call_service("input_number/set_value", **rargs)
368+
369+
@hass_check
370+
def set_textvalue(self, entity_id, value, **kwargs):
360371
self._check_entity(self._get_namespace(**kwargs), entity_id)
361372
if kwargs == {}:
362373
rargs = {"entity_id": entity_id, "value": value}

appdaemon/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import asyncio
44
import pwd
55

6-
__version__ = "3.0.1"
6+
__version__ = "3.0.2"
77
secrets = None
88

99
class Formatter(object):

docs/APIREFERENCE.rst

+48-2
Original file line numberDiff line numberDiff line change
@@ -1245,13 +1245,13 @@ Parameters
12451245
entity\_id
12461246
''''''''''
12471247

1248-
Fully qualified entity\_id of the input\_slider to be changed, e.g.
1248+
Fully qualified entity\_id of the input\_number to be changed, e.g.
12491249
``input_number.alarm_hour``.
12501250

12511251
value
12521252
'''''
12531253

1254-
The new value to set the input slider to.
1254+
The new value to set the input number to.
12551255

12561256
namespace = (optional)
12571257
''''''''''''''''''''''
@@ -1266,6 +1266,52 @@ Examples
12661266
12671267
self.set_value("input_number.alarm_hour", 6)
12681268
1269+
set\_textvalue()
1270+
~~~~~~~~~~~~~~~
1271+
1272+
This is a convenience function for the ``input_text.set_value``
1273+
function. It is able to set the value of an input\_text in Home
1274+
Assistant.
1275+
1276+
Synopsis
1277+
^^^^^^^^
1278+
1279+
.. code:: python
1280+
1281+
self.set_textvalue(entity_id, value)
1282+
1283+
Returns
1284+
^^^^^^^
1285+
1286+
None
1287+
1288+
Parameters
1289+
^^^^^^^^^^
1290+
1291+
entity\_id
1292+
''''''''''
1293+
1294+
Fully qualified entity\_id of the input\_text to be changed, e.g.
1295+
``input_text.text1``.
1296+
1297+
value
1298+
'''''
1299+
1300+
The new value to set the input text to.
1301+
1302+
namespace = (optional)
1303+
''''''''''''''''''''''
1304+
1305+
Namespace to use for the call - see the section on namespaces for a detailed description. In most cases it is safe to ignore this parameter
1306+
1307+
1308+
Examples
1309+
^^^^^^^^
1310+
1311+
.. code:: python
1312+
1313+
self.set_textvalue("input_text.text1", "hello world")
1314+
12691315
select\_option()
12701316
~~~~~~~~~~~~~~~~
12711317

docs/HISTORY.rst

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
Change Log
22
==========
33

4+
3.0.2
5+
------------------
6+
7+
**Features**
8+
9+
- added ``set_textvalue()`` api call.
10+
11+
**Fixes**
12+
13+
- Fixed incorrect service call in ``set_value()``
14+
15+
**Breaking Changes**
16+
17+
None
18+
419
3.0.1
520
------------------
621

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
# built documents.
5858
#
5959
# The short X.Y version.
60-
version = '3.0.1'
60+
version = '3.0.2'
6161
# The full version, including alpha/beta/rc tags.
62-
release = '3.0.1'
62+
release = '3.0.2'
6363

6464
# The language for content autogenerated by Sphinx. Refer to documentation
6565
# for a list of supported languages.

0 commit comments

Comments
 (0)