Closed boggiano closed 2 years ago
The timestamp data, used in the uri variable is never updated. It works the first time, when HA is created but it became useless after that.
I just modified the code of sensor.py from:
async def async_update(self): """Update state.""" uri = self.uri res = await async_http_request(self.hass, uri)
to:
async def async_update(self): """Update state.""" uri = self.uri timeNow = timestamp=int(time.time()) * 1000 newTime = "/" + str(timeNow) uri2 = re.sub(r"/[0-9]{1,}$", newTime, uri) res = await async_http_request(self.hass, uri2)
and it's working.
core-2021.12.6
No response
Home Assistant Core
viaggiaterno
https://www.home-assistant.io/integrations/viaggiatreno/
Adding the line: _LOGGER.info("Calling la URL: %s", uri) into async def async_http_request(hass, uri):
_LOGGER.info("Calling la URL: %s", uri)
async def async_http_request(hass, uri):
I saw the same URI, time after time.
viaggiatreno documentation viaggiatreno source (message by IssueLinks)
The problem
The timestamp data, used in the uri variable is never updated. It works the first time, when HA is created but it became useless after that.
I just modified the code of sensor.py from:
to:
and it's working.
What version of Home Assistant Core has the issue?
core-2021.12.6
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Core
Integration causing the issue
viaggiaterno
Link to integration documentation on our website
https://www.home-assistant.io/integrations/viaggiatreno/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
Adding the line:
_LOGGER.info("Calling la URL: %s", uri)
intoasync def async_http_request(hass, uri):
I saw the same URI, time after time.