Giter Site home page Giter Site logo

home-assistant / ios Goto Github PK

View Code? Open in Web Editor NEW
1.4K 77.0 273.0 142.99 MB

:iphone: Home Assistant for Apple platforms

Home Page: https://companion.home-assistant.io

License: Other

Objective-C 0.01% Swift 99.03% Ruby 0.66% JavaScript 0.08% Shell 0.16% Dockerfile 0.06% Procfile 0.01% C 0.01%
swift home-assistant home-automation open-source-app ios hacktoberfest macos

ios's Introduction

Home Assistant for Apple Platforms

TestFlight Beta invite Download on the App Store GitHub issues License Apache 2.0

Getting Started

Home Assistant uses Bundler, Homebrew and Cocoapods to manage build dependencies. You'll need Xcode 15.3 (or later) which you can download from the App Store. You can get the app running using the following commands:

git clone https://github.com/home-assistant/iOS.git
cd iOS

# you must do one of the following, but you do not need to do all of them:

## install cocoapods via homebrew, use that
brew install cocoapods
$(brew --prefix)/opt/ruby/bin/gem install cocoapods-acknowledgements
pod install --repo-update

## install ruby via homebrew, use that
brew install [email protected]
$(brew --prefix)/opt/[email protected]/bin/bundle install
$(brew --prefix)/opt/[email protected]/bin/bundle exec pod install --repo-update

## install ruby via rbenv, use that
brew install rbenv ruby-build
rbenv install
bundle install
bundle exec pod install --repo-update

Once this completes, you can launch HomeAssistant.xcworkspace and run the App-Debug scheme onto your simulator or iOS device.

Testing just the frontend

To just test the frontend, you can use a simulator version built by our GitHub actions.

  1. Install Xcode from the App Store making sure it's at least the version noted above. You do not need to install or run anything else.
  2. Launch the simulator at /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app or in Xcode under the Xcode menu > Open Developer Tool.
  3. Open a simulator under File > Open Simulator. You can install older versions of iOS in Xcode's Components preferences.
  4. Download a simulator build from the the GitHub action under "Artifacts."
  5. Drag the result .app on drop it on top of the simulator.
  6. Locate the app on the home screen and click it to launch.

The simulator behaves different than you might expect:

Action Effect
Click Tap
Click & drag Scroll
Hold ⌥ Add a second touch point
Hold ⇧⌥ Move both touch points
⌘←, ⌘→ Rotate
⌘S Take screenshot
⌘R Record video
⌘K Toggle software keyboard

You can now debug the WebView in this simulator build using Safari's Web Inspector:

  1. Make sure "Show Develop menu in menu bar" is enabled in Safari's Advanced preferences.
  2. Under the Develop menu, expand the "Simulator" menu for the simulator you've opened.
  3. Choose the WebView you want to inspect. A new window will open.

Code Signing

Although the app is set up to use Automatic provisioning for Debug builds, you'll need to customize a few of the options. This is because the app makes heavy use of entitlements that require code signing, even for simulator builds.

Edit the file Configuration/HomeAssistant.overrides.xcconfig (which will not exist by default and is ignored by git) and add the following:

DEVELOPMENT_TEAM = YourTeamID
BUNDLE_ID_PREFIX = some.bundle.prefix

Xcode should generate provisioning profiles in your Team ID and our configuration will disable features your team doesn't have like Critical Alerts. You can find your Team ID on Apple's developer portal; it looks something like ABCDEFG123.

Code style

Linters run as part of Pull Request checks. Additionally, some linting requirements can be autocorrected.

# checks for linting problems, doesn't fix
bundle exec fastlane lint
# checks for linting problems and fixes them
bundle exec fastlane autocorrect

In the Xcode project, the autocorrectable linters will not modify your source code but will provide warnings. This project uses several linters:

Continuous Integration

We use Github Actions alongside Fastlane to perform continuous integration both by unit testing and deploying to App Store Connect. Mac Developer ID builds are available as an artifact on every build of master.

Environment variables

Fastlane scripts read from the environment or .env file for configuration like team IDs. See .env.sample for available values.

Deployment

Although all the deployment is done through Github Actions, you can do it manually through Fastlane:

Deployment to App Store Connect

# creates the builds and uploads to the app store
# each save their artifacts to build/
bundle exec fastlane mac build
bundle exec fastlane ios build

Contributing

See CONTRIBUTING.md

LICENSE

Apache-2.0

Credits

The format and some content of this README.md comes from the SwipeIt project.

ios's People

Contributors

amelchio avatar balloob avatar bgoncal avatar blackgold9 avatar bramkragten avatar daawesomep avatar davidjb avatar dependabot[bot] avatar fabaff avatar frenck avatar github-actions[bot] avatar ibru avatar jjlawren avatar magnus919 avatar mat1th avatar mboeru avatar michalsrutek avatar mnoorenberghe avatar quthla avatar robbiet480 avatar seanpm5 avatar sphanley avatar sroebert avatar tombrien avatar torarnv avatar twilb avatar ukgrant avatar wrt54g avatar xusbadia avatar zacwest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios's Issues

Can't come back from settings screen

iPhone 7 10.2
Hass 0.37.0
App Build 50

When I click on the settings button, all icons at the bottom will disappear, so there is no way to come back or choose other icons, I have to kill the app and open it again to be able to do anything else than settings.

Location reporting timeliness

I remember reading Robbie's comments about the Apple code that controls when it reports location. Sounds a bit difficult to predict.

Have you had a look at Locative's code? It's open source, and Locative itself has now stopped development. But I used it for a year or so prior to moving to the iOS app and found it opened my garage door when I entered my home zone very reliably. Close to 100% of the time it worked, and it passed the wife test :)

That means it knew I had entered the home zone, and reported my location to HASS within about 20sec of entering the zone every time.

I'm finding that the iOS app is nowhere near as quick (sometimes 10min later). Is it worth having a look into the Locative code to see why it reported so much more reliably?
https://github.com/LocativeHQ

Thx
James

App does not resize accordingly on iPad.

When using Home Assistant for iOS on iPad, rotating the display or enabling split view mode can result in some weird behaviours. It chiefly seems that the app remembers the height and width of the viewport. Cards are cut short in the horizontal dimension, and if rotating from landscape to portrait, the display over covers two-thirds of the screen…

App loses enabled component state / connection with HA

I'm finding that at some point the app thinks that the components are no longer loaded / loses connection with HA, therefore location updates and notifications stop working. I can re-save under the "Connection" section and the components become re-enabled again. This can happen multiple times a day, and appear to be after I arrive at one of my locations/zones, but not 100% sure of that just yet. Once I re-save, location and notifications seem to work fine again.

I'm using 1.0.4 of the app along with 0.43.1 of HA, using Haasbian with letsencrypt and duckdns.

Screenshot of the components I'm meaning: http://d.pr/i/DyMvt/2xF7TMN4.

Does anyone have any ideas?

Not able to save a new password

iPhone 7 Plus 10.2
Hass 0.37.0
App Build 50

I've been using the app inside my network only, doing some tests and was not using an API password.
I tried to enable it now, when I oppened the app it will give a 401 error, that fine but I'm not able to save a password.

I add my newly created password, which works on a browser as expected, but if I add it to the settings screen there is no way to save it, no save button and nothing that I do will make the app try to connect.

If I close the app and open it again, the password field will be blank, which means it is not saving it.

Tried to look at Settings App -> Home Assistant but there is no configuration there as well.

Use different 'category' key for actionable notifications and dynamic content?

In my setup I have a camera by the front door for monitoring people coming and going; which is also triggered by a magnetic sensor that monitors it's physical state. Door opens, send notification with camera state — simple.

However, when the home is vacant, this magnetic switch is also used to trigger the security alarm for the house, with a different messaging and a different category that gives the option to silence or stop the alarm.

It would be nice if I could use my custom category for the security alarm controls and the ability to monitor the camera. I understand this can be done by setting up notification actions for the camera category, but I'd rather not have the security notifications fire just when the front door is opened.

Is it possible to split custom categories and dynamic categories? Or is this more engrained into the iOS notification API?

Allow HTTP Basic Authentication

Currently using iOS app version 1.03

I have HA running behind a webserver (Apache) using HTTPS & authentication (via BasicAuthentication with username/password). I do not use the Password option from HA.
This way I have one set of credentials for all services I have at home including HA (web, ftp, etc); one way to set permissions and add/remove users, etc.

With the app it is currently not possible to specify a username/password for HTTP-based authentication.

Please add an option to specify and for the HA URL which will be used as HTTP authentication (next to the HA password option already there).

Switch positions don't update on app restart

When opening the app I'm often greeted with stale/incorrect switch positions on the interface. A light might be "on" but the switch in the app shows "off" if I operated the switch elsewhere (e.g. a hardware switch or through the web interface or an automation).

Despite it being visually incorrect it is still operative: a light that's "on" but showing up as "off," if tapped in the iOS interface, will turn off then show correctly.

To work around this I need to either force-quit and restart the app or go into the app's settings and exit back to the interface. Either will trigger an update. Simply exiting the app, doing something else on the phone, and reentering it does not trigger an update.

Clicking on Settings/URL field will erase the whole URL and take it back to standard https://

iPhone 7 Plus 10.2
Hass 0.37.0
App Build 50

Maybe that's an expected behavior but I'd suggest that when the user clicks on URL field to be able to change it and not erase the whole URL so the user has to add it again. Sometimes we just need to change the end portion of the IP or the initial hostname from a DynDNS service or even the port so this makes the process a little bit annoying.

Covers not showing

iPhone 6 10.2.1
Hass Version: 0.35.3
App Build: 50

Problem:
Covers are not showing. Group all covers gets displayed, but is empty.

In Build 49 covers were working.

Switches missing "handles"

A number of switches in the UI are sometimes missing their "handles" and it has been like this for the last couple of HASS releases. I'm currently using iOS app 1.04, HASS 0.55.2, and iOS 11.1 public beta 4 on an iPhone 7+ (HASS runs in Docker, accessed from the outside world via NGINX reverse proxy and Let's Encrypt in a separate container). Please see the attached screenshot. This occurred in the non-beta iOS 11 release as well.

I wish I could be more precise, but a number of releases ago I never saw the problem, but that would have also been under iOS 10.x.

img_5633

Cannot build in Xcode

I cannot build the current Version. It is missing a target during pod install and that results in Dependency Analysis Errors during the build process in Xcode.

pod install
Analyzing dependencies
[!] Unable to find a target named 'NotificationContentExtension', did find 'HomeAssistant', 'HomeAssistantTests', 'HomeAssistantUITests', 'APNSAttachmentService', 'CameraNotificationContentExtension', and 'MapNotificationContentExtension'.

Not all States are displayed

iPhone 6 10.2.1
Hass 0.35.3
App Build 50

The App doesn't show all states. Some States, like temperature or sun, just need some time to load. Others like mediaplayers, switches or the weather forecast don't load at all.

Leaving known zone doesn't seem to put you into "not_home" state

Hi,

I have zone notifications on so I can debug when the app thinks I enter and leave a hass zone. This morning I noticed it said I left my home zone, and 6 minutes(ish) later it said I entered my work zone. Looking at the ui however doesn't indicate my device state changed to 'not_home' during that 6 minutes.

Zones do not appear to auto refresh / iOS map does not seem to refresh on its own

Zones do not appear to refresh on the iOS app unless the credential save button is clicked or maybe sometime after a forced location update.

I have been updating my zones to test out the iOS app, however I noticed no new zone appearing even after end tasking the app and re-launching it.

It seems like the zone only update after a credential save for sure, not on app launch, also there does not seem to be a location update on app launch as I have forced one a few times to reset my location.

App freezes or hangs when attempting to Enable location tracking

Version: 0.42.3

I enabled notifications first, the app crashed but it did enable, then I went to enable location tracking and the app just freezes without prompting.

After using the Reset option in the app it worked the after subsequent attempts.

More testing on enabling these functions might be needed.

Compiling Error

I got some error during compiling for the simulator:

Library/Developer/Xcode/DerivedData/HomeAssistant-bnkcrgnbhzihnjgteumtodaffhki/Build/Intermediates/HomeAssistant.build/Debug-iphonesimulator/HomeAssistant.build/Script-B641BC261E20BAF3002CCBC1.sh:

it says:

line2: no such file or directory

can anybody help?

i cleared out my name in the filepaths

The future of the iOS app

Hi,

First - by no means do I want to step on anyone's toes here. I am just a community member that loves home assistant and its iOS app, and would love to see both continue to evolve together.

I fully understand that work on this project are best-efforts, as time permits. Everyone has a life and there is no expectation of anything.

Saying all that, I am concerned at the lack of updates, and as such, I would like to volunteer as another maintainer for this project, if that at all is a viable idea to @robbiet480 and the community.

If not, that's fine! But I did want to throw the option out there so that there could be movement on this project.

Add secondary URL address, NAT LOOPBACK

I guess that many people like me will have routers that do not support NAT loopback. What it means basically is that we can't use the global url to acess the interface from inside the LAN, we need to use the local address.

I would be really usefull to add a backup Url in a "if not ==> then" basis. If the app can't connect from the main URL, try the backup. It seems pretty rudimentary, but I have no swift knowledge whatsoever.

Cheers

GPS Accuracy filter

Hi,
I've setup a notification which tells me when one of the five people in my household (using the iOS app) enter and exit the 5 zones I've setup. Have been running it this way for 3 or 4 months (since it was released). Yes - I get a few notifications...

As part of the notification, I also include the GPS accuracy because it was miss reporting that someone had exited a zone when they hadn't. Turns out, when this happens, the GPS accuracy is often 1000.

So can the app have a setting which filters out (stops) location updates if the GPS accuracy is above a number (eg, I would type in 900 or something like that).

This will stop my garage mysteriously opening at 3am because someone's iPhone thinks it left the home zone and then re-entered (when the GPS accuracy comes back)!

I'd love to have a go at this myself, but I I wouldn't know where to start.

Thx
James

Keep attempting to reconnect gracefully

Currently, the app will throw an error when it has issues connecting to the home-assistant server. Every single time I simply have to press save and not change anything to fix it. The app should do some type of backoff/retry algorithm.

Thumbnail not showing in notifications

Using the camera category or a url image attachment, the notification never contains the thumbnail. I've tried setting the hide thumbnail attribute to true and false and it still doesn't work. I did find this post (https://stackoverflow.com/a/39356505) but i'm not sure if the current codebase is using Notification Content Extension or Notification Service Extension.

EDIT:
Looking through the code I see we are implementing both the Notification Service Extension for the notification and then Notification Content Extension for the playback of the live feed. It does look like here https://github.com/home-assistant/home-assistant-iOS/blob/master/APNSAttachmentService/NotificationService.swift#L109 that you are setting the fileidentifier to the the attachmentURL.lastPathComponent but in documentation[0] for that method it says this doesn't work for urls, so maybe that is the issue. It also looks like the identifier is not then being used when calling the init function https://github.com/home-assistant/home-assistant-iOS/blob/master/APNSAttachmentService/NotificationService.swift#L147.

I may be way off on all this, haven't developed in swift for iOS, this is just my poking around at the logic.

[0] - https://developer.apple.com/documentation/foundation/nsstring/1416528-lastpathcomponent

Default view setting

Hello and thank you for the great App! 👍

But one little feature request:
I think it would be very nice to have an option to add a string (e.g. /group.livingroom) to the default url. So you get to this tab right when you start the app:

https://<HA_URL>:8123/states/group.livingroom

Feature request: Update on power state

I want to know when i go to bed, or when i wake up. But the same goes for the wife. I tried lots of things and then something simple hit me.

If ater XX:XX hours and XX is home and phone is Plugged in to power, assume person is going to sleep. Same applies for waking up, if after say 06:00 and unplugged, assume woken up.

Sadly the app doesn't trigger instantly on power change. It would be great if the unplugged/plugged in would update instantly on those types of actions. That way one could make use of it in automation!

Allow using installed client certificate for authentication

My setup has an nginx server reverse-proxying requests to HA using HTTPS and mandating a client side certificate.
Would it be possible for the app to show a list of installed profiles/certificates and use them for SSL challenges?

Sadly, iOS's Safari has a bug where the client side certificate isn't used with websockets and my remote access to HA is unavailable ever since 0.38.

Notification History/List

It would be nice to have a notification history or list accessible in the app. I've occasionally unlocked my phone with HA notifications and had to do some digging to find them. If there was a button that listed the last 20 or so (with an option to clear/dismiss) that would be awesome.

opening from other apps via URL don't work

First i added an event trigger BedTime in Home-Assistant, and tested it with the debug tools. The event trigger works fine. Then i tried to call Home-Assistant-iOS from Workflow with the following urls:

homeassistant://fire_event/custom_event?entity_id=BedTime
homeassistant://fire_event/BedTime

Previously i tried a service call, also with no luck:
homeassistant://call_service/light.turn_on?entity_id=light.decke_kuche

The app opens but nothing happens.

iOS known_device state should default track: true

Considering users must actually activate the feature on the device end I was surprised to find that when devices where eventually added to the known_device file they where defaulted to track: false.

Use Network SSID in the app as a secondary Zone check

When a phone is indoors the location radius gets huge, also the background location update service can be very intermittent.

It would be nice for the app to use a network SSID as a secondary lookup for the app to determine what zone it is in.

This could also help prevent flapping in and out of zones at larger campus type locations without having to set a huge radius.

Current SSID should be exposed in the iOS public network APIs.

As for implementation I would suggest that the SSID be added as an attribute to a zone, similar to how beacons work.

Added bonus this would allow NON GPS enabled iOS devices to do zoning. Such as iPods and iPads

Bottom bar covers part of UI

The bottom bar covers a part of the UI. See attached image. This is the case when the menu is open, but also when you scroll down all the way to the bottom. The last 10-40 (I guess) pixels are covered by the bottom bar. I'm using the latest version (1.0.4).

img_0902

Feature Request: Battery Level

I'm currently converting my location usage from Owntracks over to the ios app. Unfortunately, the app does not send battery level.

This is a feature request for Battery Level information to also be sent along with the gps payload.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.