iphonedetect icon indicating copy to clipboard operation
iphonedetect copied to clipboard

Where to configure

Open kuduacz opened this issue 3 years ago • 19 comments

After updated to 2.0. where i can configure entites?

kuduacz avatar Apr 15 '22 10:04 kuduacz

Hi @kuduacz Thanks for trying the pre-release!

For now only the consider home time can be configured once the entity is set up. You do that in the Configuration -> Devices & Services page in HASS. Here you also can add (click + and search for iphone detect tracker) and delete tracked devices.

After first import you can delete config in configuration.yaml and also remove devices from known_devices.yaml (if not used by other integrations). Check that Person entity is using the wanted device_tracker as name might have changed.

Does that answer your question?

I haven't updated the readme yet, please report any findings or ideas :)

mudape avatar Apr 15 '22 11:04 mudape

Hmm. Ok, add integrwtion and find all devices whitch i add on configuration. Ten delete lines on conf file and known devices. And nie, when i restart HA got notification about integrwtion not loaded properly.

kuduacz avatar Apr 16 '22 07:04 kuduacz

image image

kuduacz avatar Apr 16 '22 07:04 kuduacz

Ah, sorry. I messed up when first releasing and have since adjusted the code under the same version. Was hoping no one had downloaded yet. Please redownload the integration in Hacs

You might need to power cycle hass if restarting in the ui doesn't work

Again, sorry!

mudape avatar Apr 16 '22 08:04 mudape

unfortunately no results. the effect is still the same even when I completely removed the integrations

kuduacz avatar Apr 16 '22 10:04 kuduacz

Strange, should work after restart of HASS. At this time I would recommend reverting back to 1.4.0 as basically no logging is done.

I have this running on both HASSOS (Rpi4) and on core in docker, must have missed something causing your system not to load the integration.

mudape avatar Apr 16 '22 10:04 mudape

Ok. Back to 1.4 ale wait to oficial release and readme😜 Good job anyway.

kuduacz avatar Apr 16 '22 10:04 kuduacz

See my silly mistake.. I have more device_tracker platforms in my configuration.yaml so didn't catch it before. For you the code was trying to access stuff that wasn't there so failed.

Hopefully fixed with 2.0.1, please give it a try. Still no readme..

mudape avatar Apr 16 '22 22:04 mudape

Oh! and now it works as it should! TY.

No entries on configuration yaml and on known devices. Great job and happy easter!

kuduacz avatar Apr 17 '22 05:04 kuduacz

When trying 2.0.1

Logger: homeassistant.setup
Source: setup.py:298
First occurred: 17:53:40 (1 occurrences)
Last logged: 17:53:40

Unable to prepare setup for platform iphonedetect.device_tracker: Unable to set up component.
Deze fout is ontstaan door een aangepaste integratie.

Logger: homeassistant.setup
Source: custom_components/iphonedetect/__init__.py:39
Integration: iPhone Device Tracker (documentation, issues)
First occurred: 17:53:40 (1 occurrences)
Last logged: 17:53:40

Error during setup of component iphonedetect
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 235, in _async_setup_component
    result = await task
  File "/config/custom_components/iphonedetect/__init__.py", line 39, in async_setup
    con_home = int(entry.get(CONF_CONSIDER_HOME, DEFAULT_CONSIDER_HOME))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.timedelta'
  - platform: iphonedetect
    consider_home: 60
    scan_interval: 10
    new_device_defaults:
      track_new_devices: true
    hosts:
      gphone_detect: 192.168.79.11
      mphone_detect: 192.168.79.12
      nphone_detect: 192.168.79.13
      fphone_detect: 192.168.79.14

gieljnssns avatar Apr 19 '22 16:04 gieljnssns

Thanks for reporting @gieljnssns Just pre-released 2.0.2 that hopefully solves it.

Sidenote, I realize imported entities gets suffixed (like device_tracker.phone_2) on import from configuration.yaml Meaning one still has to update tracked device in Person. So, maybe not import at all as hands on stuff needs to be done anyhow...

mudape avatar Apr 19 '22 22:04 mudape

@mudape Thanks a lot. This version(2.0.2 and 2.0.3) works as expected. I updated, restarted, removed old entities from known files, removed yaml config, restarted, rename all entities(remove _2)

gieljnssns avatar Apr 21 '22 18:04 gieljnssns

@mudape Thanks a lot. This version(2.0.2 and 2.0.3) works as expected. I updated, restarted, removed old entities from known files, removed yaml config, restarted, rename all entities(remove _2)

Thanks @gieljnssns, both for reporting and the feedback. Very appreciated !

mudape avatar Apr 21 '22 19:04 mudape

Hi, still 1.4 to download - when you release version 2.0?

Senbei123 avatar Jul 18 '22 13:07 Senbei123

@mudape Thanks a lot for the integration. I have been using settings in configuration.yaml. Recently (seems to be starting from HA 2022.8) the UI settings appeared - got duplicates & errors in log. Can I continue using settings in configuration.yaml? (assume I do not need per-entity defined consider_home) Is using UI config mandatory? If YES - this is a very BAD decision. I prefer to keep settings in yaml.

So far my settings included this:

device_tracker:
  - platform: iphonedetect
    ...
    hosts:
      iphone_5s_iphonedetect: !secret ip__iphone_5s
      iphone_6_iphonedetect: !secret ip__iphone_6
      ...

The idea was to use IPs defined in ONE place. Moving settings to UI w/o possibility to define them in yaml makes this scenario impossible and drastically makes using less flexible. There is a current trend "Let's move settings to UI and not support them in yaml any more" - it is hated by many people.

Now settings in UI for your integration DOES NOT allow to change IP of some device! Earlier I needed just edit IP in one place in config.yaml - now I probably need to remove old entry & add new entry in UI - with defining old entity_id - many useless extra steps.

ildar170975 avatar Sep 15 '22 18:09 ildar170975

Hi @ildar170975 Config flow for this integration came with its beta release, not HA. You can downgrade to 1.4 again or continue with what you have now.

I agree configuration.yaml is nice for the setup but as you say stuff if moving away from that, so will this too.

Regarding defining IP in one place I also agree, but do it in your DHCP which is the master of the address? I can add the option to edit the tracked address in UI, actually had that for a while. It shouldn't change though (looking from this integrations perspective) so I'm ok with the remove/add option.

mudape avatar Sep 17 '22 13:09 mudape

I agree configuration.yaml is nice for the setup but as you say stuff if moving away from that, so will this too.

But developers of integrations are NOT forced to move to UI. You may support two ways - UI & yaml... Like it is done for other stuff like "zone", "person" etc.

Config flow for this integration came with its beta release, not HA.

Strange thing that those errors in log came with 2022.8.0... Of course, I may be wrong.

Regarding defining IP in one place I also agree, but do it in your DHCP which is the master of the address?

Addresses are defined by DHCP in router based on a static rules (MAC - address). List of devices' ips is defined in "secrets.yaml", so addresses are available in the whole config. Addresses are used in many integrations. So, managing settings in yaml is very flexible.

Also, I may just comment some lines in yaml if do not need this functionality for some period. And I may copy/paste a code and use it in other HA instance. So, many use-cases are possible with using settings in yaml.

ildar170975 avatar Sep 17 '22 13:09 ildar170975

At least you can support a "yaml settings keep read from yaml, Ui settings edit in UI" if you want using UI so much. Check some other integrations: if settings are imported from yaml - they are read-only; only UI-entered settings are available for changing in UI.

ildar170975 avatar Sep 20 '22 03:09 ildar170975

I'm always for written configs and optional UI for easier setup for newbies.

Text I can copy/paste, comment out, experiment, version control in git… And UI is nice when you don't event know what the config should look like. Having both worlds is the best ;)

MacDada avatar Nov 10 '22 17:11 MacDada