#devs_core-archived

1 messages · Page 103 of 1

stiff cove
#

So using those specifics, I think he might want a global weather forecast, say one for Melbourne and one for Amsterdam

#

Say the HA instance is in Melbourne

#

So that one is fine, the issue is that he would like the Amsterdam one to be in its local time

#

But if you look there, the weather platform is just providing stuff in UTC

#

So the bug is with that weather platform, it should give a time with a UTC offset.

#

Then in your card or whatever in the frontend, you can have an option whether to display in HA time or in "sensor" time

raven haven
#

right, that makes more sense to me now. but to be clear this is not about how the dates are stored, this is about the user being able to pick what timezone they want the weather to be displayed in (e.g. Weather for London, displayed in London time) so you can talk to someone in london and say, oh looks like its Sunny on Tuesday and you can be sure you're talking about THEIR Tuesday and not your Tuesday

stiff cove
#

Yeah

keen belfry
stiff cove
#

No since it's in UTC you've already lost some information

#

Like...that forecast data there

#

Is presumably for Vancouver

raven haven
#

hmm you shouldn't be trying to built that kind of intention into the storage of the date though.

stiff cove
#

I guess there's no harm in having it though?

raven haven
#

like you can't store a date with +2 and say "oh that's for XYZ region". obviously with daylight savings and the fact that regions share timezones, you can't say "oh that date is for london"

#

the ISO is not built to support that

keen belfry
stiff cove
#

Yeah, well that's what I meant by the 1:1 there. you can't back out a time zone.

#

But you can get a local time.

#

Yeah, it loses where the sensor is

keen belfry
#

Well that is easy

stiff cove
#

So if those timestamps were stored with a UTC offset

raven haven
#

where the sensor is should not be built into the date, you need to store that separately

stiff cove
#

It would be fine

keen belfry
#

If not

#

it is a bug in the integration

stiff cove
#

Yeah they're not in that example

#

Yes, that's what you said, and what I'm saying too

keen belfry
#

Buienradar 👆 Dutch weather

#

Europe/Amsterdam, current GMT+2

stiff cove
#

Yup

#

Look at his issue. They're all +00:00

#

So it's just a bug in whatever weather platform he's using

#

integration

keen belfry
stiff cove
#

Yup

#

That's what I'm saying too. But just used the wrong word platform instead of integration 😅

keen belfry
#

Alright, agreed on that. I just found an integration that doesn't do it correctly

#

2 already at this point

#

One is my own creation 🙈

raven haven
#

i'm guessing it's not hard to find integrations that aren't perfect

#

Lol

keen belfry
#

It is not, making them perfect is the art 😄

#

Instituto Português do Mar e Atmosfera

#

ah that is IPMA

hoary rover
#

Yeah I wrapped my client.stop() in a function that takes an Event argument, like your example, not sure why it's needed but it works

sly widget
fresh heron
#

Hey folks. First time contributing here but was playing with rest_command and wishing there was a way to get data back from it for use in an automation. I ended up with a generalized way to return values from service calls, but am curious to hear feedback on whether the approach is ok or if I'm totally barking up the wrong tree: https://github.com/home-assistant/core/pull/74729

sly widget
#

your use case for scripts is interesting, and not part of the existing discussion (e.g. templates approach wouldn't help i think)

fresh heron
#

The solution here felt relatively straightforward and was a fairly minimal change. It turned out to make it possible for user scripts to return values as well very simply

#

Might be worth engaging in that architecture discussion

#

Thank you for the pointer

sly widget
#

One of the PRs linked there had a similar approach to use events to return values which was not accepted

#

so typically these architecture discussions (e.g. best practices or changes to core apis) are for larger decisions that have longer term implications about maintenance, how code is structured, or help keep user expectations in check about how things work. They require some approval from a couple core members before proceeding.

#

(I've implemented what i proposed there and its also not super complicated either, but the amount of implementation work isn't necessarily the most interesting part of the discussion)

fresh heron
#

Understood

sly widget
#

Given there wasn't a lot of initial response "e.g. yes, good direction, let's talk through this more", i'm thinking that implicitly means folks aren't super thrilled about this specific proposal without thinking through more implications or something simpler. we can probably keep thinking about it and find something better

fresh heron
#

+1. I think the biggest difference between this and that PR linked in the discussion is that this aims to formalize the construct rather than have a bespoke mechanism for a specific integration. But 100% needs to be vetted and there may be a better way to get there.

#

Also, the approach in that PR doesn't make the data available as a variable (as e.g. loops and waits do) in templates within a script -- you have to rendezvous with it by waiting on the event.

#

So... Maybe there's something meaningfully different there worth discussing?

thick yoke
#

I have my custom integration device and entities setup. Now, I want to add a function to my device which will monitor a serial port and update my entities using local push. Is there an homeassistant call to do this and/or an existing integration I can use as a model? Thanks

fresh heron
sly widget
fresh heron
#

Definitely not mine either 😉

tough lynxBOT
echo sand
#

dont know if this is the correct place to ask this question. so please redirect me to where i should ask this.

i am using pyscript to create a few custom services. currently i am working on the services required to create my custom alarm clock which only requires setting a alarm on google home which will trigger a automation.
i am currently trying to get the alarms of the google home by adapting the scripts given here https://rithvikvibhu.github.io/GHLocalApi/ . i had it all working without home assistant.
i am currently making it callable as a service so i can use it better in home assistant but am stuck at the point where i am calling a blocking function that is part of a external library.

the problem i am having is that i need to use the result of the function and i cant figure out how to call it in a non blocking way and still get back the result from it. the function i am using to call it is above

vital hearth
#

Hi everyone. I maintain the Mazda integration, which communicates with a cloud service that has anti-bot protection in the form of TLS fingerprinting. When HA upgraded to Python 3.10, the default TLS ciphers changed, and my integration stopped working. I tried setting the ciphers back to what they were in Python 3.9, but it didn't help, so there must be something else that changed in the TLS handshake and is triggering the anti-bot mechanism. Does anyone have experience troubleshooting this type of issue?

pallid wadi
#

hello, I'm working on making home assistant from buildroot, and I want ssh access, but I am finding usb import to be tedious. I tried adding authorized_keys to the rootfs overlay, but that did not seem to work. any suggestions?

acoustic kelp
vital hearth
acoustic kelp
#

It has a different signature so didn't trip the antibot proxies.

vital hearth
#

Gotcha. I'll have to give that a try.

#

My case is slightly different because nothing changed on Mazda's servers. The problem started when upgrading from Python 3.9 to 3.10

acoustic kelp
#

The change in python may have changed the timing of the auth if not the request headers. I pasted the issue above if you want to compare

vital hearth
#

Thanks for the link. Mazda is also using Akamai so that gives me some hope. (Not sure if it is Akamai Global Host or some other Akamai product)

drifting pollen
#

Does anyone know how to prevent a browser from using cached images while navigating the HA UI? "Cache-Control": "no-cache" seems to be ignored.

inland storm
#

Anyone after the update to 2022.7 (from 2022.6.7) got a continuos reboot of Home Assistant?

fickle otter
#

Hi everyone.
I´m trying to upgrade my home assistant core from 2021.3.4 to 2022.7.

But I´m getting this error message in Supervisor log.

22-07-10 12:12:23 ERROR (SyncWorker_2) [supervisor.docker.interface] Can't install ghcr.io/home-assistant/raspberrypi3-homeassistant:2022.7.2: 404 Client Error for http+docker://localhost/v1.40/images/ghcr.io/home-assistant/raspberrypi3-homeassistant:2022.7.2/json: Not Found ("no such image: ghcr.io/home-assistant/raspberrypi3-homeassistant:2022.7.2: No such image: ghcr.io/home-assistant/raspberrypi3-homeassistant:2022.7.2")

I´ve check the storage, there should be no problems with full storage.
Do you guys know what may be the issue here?

latent vale
inner linden
#

how can i change an entity unit on the fly?
i tried:

self._unit = self.coordinator.units[self._pid]
self.async_registry_entry_updated()

and

entity_register.async_update_entity(entity_id, unit_of_measurement=temp_unit)

and neither worked

latent vale
inner linden
#

The issue i'm trying to solve by dynamkcally changing the units is the following:
The units are only know some amount of time after the entities are created, because the communication will only work the next time the user enters the car, and i create the entities with an assumed unit, that may be incorrect when i receive the correct ones.

Whats the best way to solve this if i cant change units on the fly?

and this is the entity code, thats why i was updating the self._unit()

    @property
    def native_unit_of_measurement(self):
        """Return the unit of measurement."""
        return self._unit
worn dock
#

return self.coordinator.units[self._pid] I would guess. Then likely empty at first and then sets the correct unit.

zinc creek
karmic dew
#

On entity naming: is it breaking to change the device name of the current device name isn't nice?

#

***"...if the current device..."

wintry holly
#

Hi, Is any docs for core testing guide or how to run unittest?

inner linden
inner linden
#

if an integration stops allowing yaml setup, and needs new configuration parameters, what should i call in async_setup to warn in the UI?

latent vale
#

Are you not able to import the yaml config to the new ConfigEntry? Maybe use an import step where you query the user for the missing information...

inner linden
worn dock
#

You could raise ConfigEntryAuthFailed and thereby allow adding/adjusting it in a reauth flow. Not a perfect fit I guess but would solve your issue.

acoustic kelp
#

Yes, force a reauth to get the info. Don't overcomplicate it for yourself by doing custom config steps. You can warn people with a breaking change in the release notes.

inner linden
#

I'll do that then, thanks for directing me

latent vale
#

I guess you could convert your import step to be a "confirm step" like other discovery methods use - and call a next step from there if you don't want to go the reauth-way.

mental falcon
#

hi. i fixed an error in a dependency which is in pypi. where do i need to insert the new version number? Is it enough to update the manifest.json file of the integration, which uses the dependency?

worn dock
#

Update the manifest and run script.gen_requirements_all

mental falcon
#

thx!

sturdy carbon
sturdy carbon
latent vale
sturdy carbon
#

ah

quick light
ivory narwhal
jagged hazel
#

Hey, I am looking for a little direction in writing an integration for a Ryobi Garage Door Opener that features a Websocket (python's websockets library) for continuous state updates. I'm hoping someone can point me to a similar functioning integration to help me learn. I am writing the library that will communicate with the Ryobi servers right now and am struggling with having a Websocket run in the background (forever) that listens for state update messages while allowing other things to happen (like receiving commands from HA or the user then relaying them to the websocket). Thanks!

latent vale
jagged hazel
mental falcon
#

Hi 🙂 I am implementing a new Homematicip device (HmIP-STE2-PCB). This device has two temperature sensors and a difference value. Should that be presented as 3 different sensors? And does that mean, i have to implement three different classes, which are inherited from Entity?

latent vale
mental falcon
mental falcon
#

okay. There are 3 instances of a temperature sensor entity for the same device. But how to tell, which sensor is for which channel? or rather, which channel one, channel 2 and difference?

#

how to make it visible to the user

mild sail
#

On TrueNAS 13.0 - does anyone know how I update to Cargo edition 2021?
Before I update I'm not able to update HA to 2022.7.*

keen belfry
uneven storm
#

hi, anybody solved this pre-commit issue?

pylint...................................................................Failed
- hook id: pylint
- exit code: 32

Usage: pylint [options]

pylint: error: no such option: --ignore-missing-annotations

I see 2 questions here about that, without solution

brave dome
uneven storm
#

thanks!

sick latch
latent vale
sick latch
#

I'm not the dev, @viscid bronze is tho

viscid bronze
latent vale
# viscid bronze It has met the criteria for a while now (unless they were changed recently) and ...

If it meets the criteria you can do a PR adding the "quality_scale" key to the manifest. Here is an example https://github.com/home-assistant/core/pull/60531 (its hard to search these as the term "quality scale" is in each and every PR 🤪)
You should probably also remove the .coveragerc entries for your integration.
And maybe look into type annotating it 🧑‍💻 and see if you can add it to .strict-typing - but thats not needed - just a nice extra

low lion
#

I'm working on this PR to improve trigger schema validation and I've added some code to device_automation/trigger.py (https://github.com/home-assistant/core/pull/75044/files#diff-c860f93df1901ece1ff65e3a36b91cd20e074e2f6ecc015fc2c3182c723c4248).
I'm having a problem deciding what the right way to handle the error is. If the schema is invalid it throws a vol.Invalid exception. That's caught and wrapped in another vol.Invalid that includes some extra context (e.g. the fact that it's a trigger that failed validation). When the exception is caught and printed (by _format_config_error here: https://github.com/home-assistant/core/blob/dev/homeassistant/config.py#L467) the inner exception is hidden so you only see "invalid trigger configuration" and you don't get the actual schema validation error because vol.Invalid is treated as being "friendly" so it hides the exception stack.

So I've got two options:

  1. Don't set the isFriendly flag for vol.Invalid which would impact a bunch of places, but would log the full exception trace.
  2. Update _format_config_error to loop through the ex.__cause__ and include the messages of all the exceptions all the way down.
    • This is a little cleaner, but then I have to handle the case where the __cause__ is not the same type. E.g. if the outer is vol.Invalid and the inner is not, should isFriendly be set to true? What about the other way around?

Happy to make changes and take suggestions here, I'm just not quite comfortable with the whole code base to know the full impact that a change here would have. 🙂

latent vale
#

Can entities be added to devices of a different integration? Ie. a power sensor entity for some appliance that is already integrated in HA but doesn't provide that feature itself.

swift jackal
#

Hi there, for the dutch smart-lock Loqed we have created an integration which needs to be reviewed. @keen belfry already reviewed, but seems to busy to finish the review. Can someone else look at it? https://github.com/home-assistant/core/pull/70080

keen belfry
#

please don't ask around for reviews, there are PRs open that are older that need attention too

#

If you want things to get reviewed sooner, please join and help out reviewing the queue

swift jackal
#

Ok. Thanks for your response @keen belfry !

stiff cove
#

Has anyone noticed intermittent slowness in ThreadPoolExecutor jobs in 2022.7?

stiff cove
#

Nvm I think I found the issue, will create a PR

formal narwhal
#

this is not a development question

low lion
#

@keen belfry, do you have suggestions for new-ish contributors on how to pick which PRs are good to review. I’ve mostly been focusing on PRs with little to no conversation, but I’m assuming there are older PRs that need new eyes. Is there a tag that we can filter for?

keen belfry
#

There is one exception: “smash”, which are quicker/smaller/HQ/almost finished/needs second pair of eyes PRs

short dock
keen belfry
#

how long does it usually take?
There is no usual

#

So expect nothing (sounds harsh, but that is what it is)

#

in the end

#

someone has to go in and do something with it 🤷‍♂️

#

The "smashed" marked ones generally go faster, and is merely an indicator for people that have a couple of minutes left in their day and want to help out

quick swan
#

hey everyone. I maintain the Risco integration, and recently added local communication to the downstream package (the integration currently communicates over their cloud platform).
I do think a lot of users would still opt for the cloud integration (doesn't require the installer code, works on more models, etc...) but I'm a little torn on whether this deserves a new integration or modification of the existing one.
On the one hand, there will be a lot of common code between the two versions, but on the other, there will be different entities, a completely different config flow, and there are some material differences between the two. Additionally, I'm not even sure what to write in the manifest if it's the same integration (one protocol is cloud poll and the other is local push).
What are your thoughts?

sly widget
#

Mark it local since it can support local, even if it also supports cloud

short dock
#

question - is there interest in making the config / option flow more generic? today, if the configuration is complex, it can either be configured via yaml (which we want to get out of) or via multiple complex navigation menus. i was thinking of extending it to something similar to the automation GUI setup, but it would require some backend + frontend work. I can happily do both, but wanted to know if the overall concept is interesting

keen belfry
short dock
# keen belfry Not sure if I follow what you mean?

basically what i see as missing are two things: 1. the ability for variable sized lists and 2. the ability to have sub-objects. the reason i compared it to the automation is that the screen will be very similar to the automation setup: a few constant fields, and a few variable sized (e.g. in an automation, zero or more conditions, triggers and actions). for each object, you can add one more, duplicate, delete, etc. a very simple use case is to configure the logger, which in yaml is a variable sized list of topic / level. I believe that if this capability is added, it should be simple to move all (or almost all) configuration easily to the UI.

#

another thing (that also exists in automation) is context-aware fields. for example, when you select a trigger of type "state", you get different fields than trigger of type "device". The way I see it, there should be some infrastructure in the frontend, but this would be done for each component in its own config flow

keen belfry
#

I think if such things should be considered for the automation UI, it should be based on a UX design I guess

short dock
keen belfry
#

I'm not sure if I follow

#

you mean the Selectors support?

#

(as in, the "UX" for automations is not something we want to keep for the future, as in, that needs lots of work so lets not copy that 😉 )

short dock
short dock
keen belfry
#

I'm still not following, sorry 🤷‍♂️

#

I don't see the link between automations and config flows

#

Please note that most elements used in automations and blueprints (selectors) are available in config flows (since 2 releases or so)

#

But feel free to set up an architecture discussion to get this sorted though 🙂

short dock
#

today, a config flow can pass async_show_form and create a screen on the UI with a constant set of fields. i am talking about extending the config_flow to enable more complex structures (lists, sub-objects, and fields depending on another field). the reason i used the automations as an example is that the GUI already knows how to do these things for an automation config (via custom panels in the frontend). once this flow exists, the automations (and other flows probably) could be standardized to the same flow. All it needs is the async_show_form to be able to describe this more complex form and for the UI side to know how to interpret it

#

how do you set up an architecture discussion? i am still new to this..

keen belfry
#

(lists, sub-objects, and fields depending on another field)
It already supports list, even with predefined values, key/value pairs, including allowing custom values.
Dependencies have been added recently

#

once this flow exists, the automations (and other flows probably) could be standardized to the same flow.
Automations aren't flows.

bright oak
# short dock today, a config flow can pass async_show_form and create a screen on the UI with...

Think this is a great idea. I also stumbled across a few problems when implementing a config flow, where I needed the user to insert a list of sub objects, but there was no way to do this in the config forms yet, so I decided to use the ObjectSelector with some instructions how to user it, but it's far from user friendly. Would be great to have this extended with more extensive support.

bright oak
keen belfry
#

Sure, all selectors can be used

#

they are used by many helper integrations

#

But is fairly new, so not that many examples available yet (in the existing code base that is)

bright oak
#

I did read this docs before, but could not work out how to provide user friendly configuration for example for this case:

 states_power:
   playing: 8.3
   paused: 2.25

Ideally I want the user to have a plus sign to add a new row. The new row would be an object with 2 selectors, a attribute selector and a float field.
This is similar to how the user can add new condition / action rows in the automations. But I don't see any possibilities for it in the config data flows.

keen belfry
#

Yup combined fields as sets isn't possible (yet)

#

There isn't direct need for it at this point in the core

#

however, there is an core idea in the works that may require it

latent vale
#

I'd also love some extension of the current flow system. Or even better: a canonical way to create custom panels. Right now there is a huge gap between the ease of creating a flow vs. creating a panel. This would help some yaml-only stuff to get to UI config in a user-friendly way - and more beyond that.

keen belfry
#

Or even better: a canonical way to create custom panels.
Panel can be created as you please nowadays. As those are fully custom panels, you can do what you want I guess 🤷‍♂️

short dock
#

but do you know if they allow custom panels in the UI? i thought they were frowned upon. tried to start writing one and they didn't want it. it was some time ago, so perhaps the feelings changed

short dock
sturdy carbon
#

is config_entry_flow.register_discovery_flow a new function? It only seems to be in a couple integrations. And if so does this allow me to do UDP based discovery on the fly instead of when the integration is triggered?

gleaming goblet
latent vale
gleaming goblet
#

Looking at the log I've this : ```
2022-07-19 15:46:15 INFO (MainThread) [homeassistant.components.automation.tesla_change_amps] Tesla Change Amps: If at step 1: Executing step call service
2022-07-19 15:46:19 WARNING (MainThread) [custom_components.solaredge_modbus] Failed to read inverter 1 data
2022-07-19 15:46:19 INFO (MainThread) [homeassistant.components.automation.cmd_porta_abitazione_one_shot] Cmd Porta Abitazione One Shot: Running automation actions

Button for the binary sensor has been pressed at 15:46:16. Trigger started at 15:46:19. Either the ``automation.tesla_change_amps`` or the ``custom_components.solaredge_modbus`` can be the problem?
stiff cove
#

Yes

#

solaredge_modbus looks like a bad actor

#

Assuming this is getting called from the event loop

#

The read_modbus_data call goes down and uses the sync client of pymodbus...

keen belfry
#

Yup that doesn't look right indeed

short dock
keen belfry
#

not in de frontend, it is bundled in the integration

gleaming goblet
# stiff cove The read_modbus_data call goes down and uses the sync client of pymodbus...

This solaredge modbus implementation has started to return a lot of Failed to read inverter x data or Connection to x failed: Timeout probably since the upgrade to 2022.7. I was trying to investigate this problem. Do you have suggestions on how to improve the read from the modbus? Another component for solaredge modbus is https://github.com/erikarenhill/solaredge-modbus-hass which has a different approach to the async. https://github.com/erikarenhill/solaredge-modbus-hass/blob/c9d1c934c0e03cf6634de5386f38320e922b131c/custom_components/solaredge_modbus/sensor.py#L68

latent vale
# short dock just looked in insteon, both on core and looked for it in frontend. where is the...

some are in the frontend as well... https://github.com/home-assistant/frontend/tree/dev/src/panels/config/integrations/integration-panels but I guess these are some kind of special.
Here is insteons panel registration https://github.com/home-assistant/core/blob/dev/homeassistant/components/insteon/api/__init__.py the source itself is loaded as a requirement in manifest.json from pypi (https://github.com/pyinsteon/insteon-panel)

stiff cove
#

But the better way to do it is to use the asyncio methods which the pymodbus library seems to have

#

Take it with a grain of salt though, I don't know what solaredge is and I don't know what modbus is

sturdy carbon
#

I'm migrating a custom integration to core. The call async_step_import is for a YAML config right? I'm assuming i can nix that call?

short dock
# keen belfry not in de frontend, it is bundled in the integration

ok. i see it now. it was in the API section. This is super cool and would allow me to remove yaml configuration from the dynalite component. thanks for your patience. Also, is there any documentation of this API and what is required from the frontend panel (in typescript)?

keen belfry
#

I cannot help you answering frontend questions, sorry.

short dock
acoustic kelp
gleaming goblet
ember arch
#

I'm working on refactoring the volvooncall component to leverage config flow instead of YAML config. However, the existing config schema doesn't seem to work when I feed it to async_show_form(). Is there any documentation that outlines the schema limitations inherent to async_show_form()?

#

Namely, async_show_form() doesn't seem to handle "complex" schemas such as:

vol.Optional( CONF_SCAN_INTERVAL, default=DEFAULT_UPDATE_INTERVAL ): vol.All(cv.time_period, vol.Clamp(min=MIN_UPDATE_INTERVAL)), vol.Optional(CONF_NAME, default={}): cv.schema_with_slug_keys( cv.string ), vol.Optional(CONF_RESOURCES): vol.All( cv.ensure_list, [vol.In(RESOURCES)] ),

robust flame
# ember arch I'm working on refactoring the `volvooncall` component to leverage config flow i...

We don't allow scan interval option. The user can disable automatic polling of any integration that supports config entries and automate polling via the homeassistant.update_entity service. Name should preferably not be needed, if the connection can be identified with something already, like VIN number. We don't allow specifying what resources to set up unless it impacts performance significantly eg, request load on a cloud service. The user can disable any entity, with a unique id, that they don't need.

ember arch
#

Excellent feedback, thanks @robust flame . In summary -- get rid of these config options entirely.

robust flame