hassio-addons / addon-appdaemon3

AppDaemon3 - Home Assistant Community Add-ons
https://addons.community
MIT License
41 stars 12 forks source link

set_value and/or call_service("input_number/set_value",....... doesn't update the value of the target entity #13

Closed smcallis77 closed 6 years ago

smcallis77 commented 6 years ago

Problem/Motivation

The following snippet used to work. I think prior to 0.67 of HASSIO

sample code snippet

def run_rainfall_callback(self, kwargs):
  self.Target = kwargs["Target"]
  self.Source= kwargs["Source"]
  self.log("Run rainfall update {} with {}".format(self.Target,self.Source))
  TargetValue=float(self.get_state(self.Target))
  SourceValue=float(self.get_state(self.Source))
  self.log("Target = {}".format(TargetValue))   
  self.log("Source = {}".format(SourceValue))
  TargetValue=TargetValue+SourceValue
  if TargetValue <= 2.0 :
    TargetValue=0.0
  else :
    TargetValue=TargetValue - 2.0
  self.log("Target = {}".format(TargetValue))
  self.call_service("input_number/set_value", entity_id = self.Target, value = str(self.get_state(self.Target)))    
  # or just self.set_value(self.Target,TargetValue)
  self.log("New Target = {}".format(float(self.get_state(self.Target))))

Expected behavior

(What you expected to happen)

2018-04-25 03:24:30.210216 INFO UpdateRainfall: Run rainfall set to execute 2018-04-25 03:25:00.012018 INFO UpdateRainfall: Run rainfall update input_number.pws_accumulated_rainfall with sensor.bom_melbourne_rain_today 2018-04-25 03:25:00.019711 INFO UpdateRainfall: Target = 5.2 2018-04-25 03:25:00.026737 INFO UpdateRainfall: Source = 0.6 2018-04-25 03:25:00.033686 INFO UpdateRainfall: Target = 3.8 2018-04-25 03:25:00.920099 INFO UpdateRainfall: New Target = 3.8

(What actually happened)

2018-04-25 03:24:30.210216 INFO UpdateRainfall: Run rainfall set to execute 2018-04-25 03:25:00.012018 INFO UpdateRainfall: Run rainfall update input_number.pws_accumulated_rainfall with sensor.bom_melbourne_rain_today 2018-04-25 03:25:00.019711 INFO UpdateRainfall: Target = 5.2 2018-04-25 03:25:00.026737 INFO UpdateRainfall: Source = 0.6 2018-04-25 03:25:00.033686 INFO UpdateRainfall: Target = 3.8 2018-04-25 03:25:00.920099 INFO UpdateRainfall: New Target = 5.2

Steps to reproduce

Run the code snippet.

Proposed changes

(If you have a proposed change, workaround or fix, describe the rationale behind it)

Other information. home-assistant.log records no error. However, if I do not have any 'input_text' entities defined (I have created a dummy to try to work around the issue) and call set_value then home-assistant.log records an error similar to 'no such service input_text/set_value'

Note: calling input_number.set value from home assistant works as expected. image

frenck commented 6 years ago

Hi there,

This looks like an issue with AppDaemon itself. This repository is for the add-on. The add-on encapsulates the official AppDaemon software.

Please check the official AppDaemon repository/resources for help on this one.

addons-assistant[bot] commented 6 years ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.