Hi,
I’ve installed HA (not the OS, dockerized) two hours ago, and it looks like an exciting platform that I’d be happy using (and contributing to). My first foray with adding a script is a little less successful though.
I am trying to use this script available on Github to make HA recognize my iPhone is connected to my home’s wireless network.
A bit about my set-up: I have a TP LINK modem-router, and a Kasda router with DHCP off (acting only as an extension point). The iPhone is connecting to the Kasda wireless network.
My first question is: When adding a new device_tracker
to configuration.yml
, which platform
should I be using? I know there’s no tplink
one, but I don’t know if I should attempt kasda
instead. Right now my Kasda router admin panel is unreachable because of the way I have set it up.
Second question: why does HA not automatically create known_devices.yaml
for me when I specify the above (configuration#device_tracker
)? The docs seem to indicate that it will.
And most puzzling of all, when I put the above script’s device_tracker.py
in custom_components/iphonedetect
, I am getting this in the logs:
Invalid config for [script]: expected a dictionary. Got OrderedDict([('default_config', {}), ('group', {}), ('automation', {}), ('script', OrderedDict([('device_tracker', [OrderedDict([('platform', 'iphonedetect'), ('consider_home', 60), ('scan_interval', 12), ('new_device_defaults', OrderedDict([('track_new_devices', True)])), ('hosts', [OrderedDict([('my_iphone', '192.168.1.1')])])])])])), ('scene', {})]). (See /config/configuration.yaml, line 7).
I am also putting the script code in scripts.yaml
with the correct info from my TP-Link:
device_tracker:
- platform: iphonedetect
consider_home: 60
scan_interval: 12
new_device_defaults:
track_new_devices: true
hosts:
- my_iphone: 192.168.1.1
Can anyone please explain to me what are the pre-requists for using the above script? As I understand it it’s:
- Make it recognize the router integration
- Verify
known_devices.yaml
exists (or create manually if it doesn’t?) - Add plugin python code to
custom_components/iphonedetect/device_tracker.py
- Add yaml code to
scripts.yaml
Am I in the right direction? what am I missing?