Skip to content

Commit

Permalink
Merge pull request #98 from htmltiger/htmltiger-patch-1
Browse files Browse the repository at this point in the history
additional service params
  • Loading branch information
htmltiger authored Jul 25, 2023
2 parents fb2a630 + 3fb7bf2 commit af1bcdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ or added by clicking the "Add to lovelace" button on the HACS dashboard after in
| toggle_entity | string | | eg `switch.heating` to display a toggle switch |
| param | string | `value` | service parameter
| service | string | `input_number.set_value` | service name
| service_params | object | `{entity_id: entity, [service parameter]: changedvalue}` | additional service params
| moreinfo | string | entity | More info entity eg `sensor.my_max_size`, to navigate eg `/lovelace/mytab`, `false` to disable |

```
Expand All @@ -72,6 +73,9 @@ entities:
state: temperature
service: climate.set_temperature
param: temperature
service_params:
entity_id: climate.heating
hvac_mode: heat
min: 0
max: 30
step: 0.5
Expand Down
5 changes: 3 additions & 2 deletions numberbox-card.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
((LitElement) => {

console.info('NUMBERBOX_CARD 4.13');
console.info('NUMBERBOX_CARD 4.14');
const html = LitElement.prototype.html;
const css = LitElement.prototype.css;
class NumberBox extends LitElement {
Expand Down Expand Up @@ -225,7 +225,7 @@ publishNum(dhis){
if(dhis.pending===false){return;}
const s=dhis.config.service.split('.');
if(s[0]=='input_datetime'){dhis.pending=dhis.numTime(dhis.pending,1);}
const v={entity_id: dhis.config.entity, [dhis.config.param]: dhis.pending};
const v = { ...dhis.config.service_params, [dhis.config.param]: dhis.pending };
dhis.pending=false;
dhis.old.state=dhis.state;
dhis._hass.callService(s[0], s[1], v);
Expand Down Expand Up @@ -374,6 +374,7 @@ setConfig(config) {
refresh: 0,
initial: undefined,
moreinfo: config.entity,
service_params: {entity_id: config.entity},
...config
};
if(this.config.service.split('.').length < 2){
Expand Down

0 comments on commit af1bcdd

Please sign in to comment.