Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge master into config flow. config flow : tested #22

Merged
merged 7 commits into from
Dec 4, 2019
Merged

merge master into config flow. config flow : tested #22

merged 7 commits into from
Dec 4, 2019

Conversation

BlueBlueBlob
Copy link
Contributor

Tested :)
And super fancy

@BlueBlueBlob
Copy link
Contributor Author

I have something big incoming. I will post some screenshots ;)

@BlueBlueBlob
Copy link
Contributor Author

Enjoy :)

README.md Outdated Show resolved Hide resolved
custom_components/grocy/.translations/en.json Outdated Show resolved Hide resolved
custom_components/grocy/__init__.py Show resolved Hide resolved
custom_components/grocy/__init__.py Show resolved Hide resolved
custom_components/grocy/binary_sensor.py Outdated Show resolved Hide resolved
custom_components/grocy/config_flow.py Show resolved Hide resolved
custom_components/grocy/config_flow.py Outdated Show resolved Hide resolved
@BlueBlueBlob
Copy link
Contributor Author

I think config_flow is done.
Works nice for me. Just we need an add-on update, because sensors take to much time to update.
Or optimize pygrocy lib. (No idea for now)

Copy link
Collaborator

@SebRut SebRut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess get_mac() is unique to the machine running HA, we need a unique id for the grocy instance.

@BlueBlueBlob
Copy link
Contributor Author

My core.entity_registry from HA :

{
                "config_entry_id": "ce7c454849da45978763dc8572dbe4f4",
                "device_id": "4635e97fdaef437cba7a4b96428a0ebd",
                "disabled_by": null,
                "entity_id": "sensor.grocy_stock",
                "name": null,
                "platform": "grocy",
                "unique_id": "202481593014205-stock"
            },
            {
                "config_entry_id": "ce7c454849da45978763dc8572dbe4f4",
                "device_id": "4ded9881e7aa4c85bb8401c2080fec38",
                "disabled_by": null,
                "entity_id": "sensor.grocy_chores",
                "name": null,
                "platform": "grocy",
                "unique_id": "202481593014205-chores"
            },
            {
                "config_entry_id": "ce7c454849da45978763dc8572dbe4f4",
                "device_id": "d1b203c7e88e482fb3da9e71b0014452",
                "disabled_by": null,
                "entity_id": "sensor.grocy_shopping_list",
                "name": null,
                "platform": "grocy",
                "unique_id": "202481593014205-shopping_list"
            },
            {
                "config_entry_id": "ce7c454849da45978763dc8572dbe4f4",
                "device_id": "227c181874af4dea90531764921a63b5",
                "disabled_by": null,
                "entity_id": "binary_sensor.grocy_expiring_products",
                "name": null,
                "platform": "grocy",
                "unique_id": "202481593014205-expiring_products"
            },
            {
                "config_entry_id": "ce7c454849da45978763dc8572dbe4f4",
                "device_id": "7a7606a25c22419883c71c8347526121",
                "disabled_by": null,
                "entity_id": "binary_sensor.grocy_expired_products",
                "name": null,
                "platform": "grocy",
                "unique_id": "202481593014205-expired_products"
            },
            {
                "config_entry_id": "ce7c454849da45978763dc8572dbe4f4",
                "device_id": "5bb83cd1479d40ce9a3633b7054d25f4",
                "disabled_by": null,
                "entity_id": "binary_sensor.grocy_missing_products",
                "name": null,
                "platform": "grocy",
                "unique_id": "202481593014205-missing_products"
            }

Sorry I don't understand "unique for Grocy instance"
You are right get_mac is unique on device running HA.

@SebRut
Copy link
Collaborator

SebRut commented Dec 3, 2019

Sorry for that late reply. if I understand correctly, the unique id should identify one entity uniquely. In our case the id should identify a sensor and it's corresponding grocy instance. This means 2 chores sensors for different grocy instances should have different ids but the id of one specific sensor should never change.

@BlueBlueBlob
Copy link
Contributor Author

Like [sensor name] + [ sensor type] + get_mac() ?

@SebRut
Copy link
Collaborator

SebRut commented Dec 3, 2019

That would still lead to 2 different grocy instances in the same HA instance having the same id, as the mac is HA host dependent.

@BlueBlueBlob
Copy link
Contributor Author

Ok sorry I just understand : it needs to work with multiple grocy instances.
We can add API key. Unique for each grocy instance. Not secure, but unique id is stored in internal files.

@SebRut
Copy link
Collaborator

SebRut commented Dec 3, 2019

hashed api key (maybe in combination with uri) sounds like the best we can up with atm, as the api doesn't provide a way of identifying itselft.

@BlueBlueBlob
Copy link
Contributor Author

URL or URI (but I guess it's the URL and uri can be an URL)

SomeHash(API-Key + url ) ?

@SebRut
Copy link
Collaborator

SebRut commented Dec 3, 2019

I guess md5 of api key should be fine

custom_components/grocy/__init__.py Outdated Show resolved Hide resolved
custom_components/grocy/__init__.py Outdated Show resolved Hide resolved
custom_components/grocy/binary_sensor.py Outdated Show resolved Hide resolved
custom_components/grocy/sensor.py Outdated Show resolved Hide resolved
@SebRut SebRut merged commit 725e25b into custom-components:develop Dec 4, 2019
@SebRut SebRut added this to the v0.4.0 milestone Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants