Hass NFC - Control Home Assistant with NFC tags


#21

which NFC tag you recommend?


#22

Great that it’s working now!


#23

That’s a good idea. How would you see this? Write the actual payload on the tag, or keep a ‘database’ in the app which simply is loaded when you use a specific tag. Writing the payload on the tag could in theory cause for privacy issues. That’s why I choose for this option to simply call scripts. I do understand that it’s a little cumbersome to create a script for every little thing though!

I’m also thinking about adding some kind of option. Call a script, or call an actual entity like a group or a light and give the on/off/toggle command.

There’s no roadmap/agenda right now, but I am writing down all suggestions and ideas from you guys. If there’s anything you want let me know. I want to gather all ideas so everything can enjoy it.

Also if you guys prefer a different way of discussing and/or bug reporting and/or idea posting let me know.


#24

Depends what kind of form factor you’re looking for. Not sure where you’re from and which store to go to. If you google for generic tags that work with most smartphones you should be good!


#25

Actually I think the ideal solution would be, that the “location” of the data can be defined per app. So for example a tag is preloaded with the data for a specific action, which would enable multiple users to perform the same action without additional work. But if the user has added a custom action within the app for the same tag, then this action would be performed.
I don’t have a specifix use case in my mind right now, but something like disarming an alarm system and presence could be done. Without any configuration in the app the alarm system could be disarmed, but with a custom app the alarm would be disarmed and the presence of user X would be set to home. You get the idea.
This could make things far more complicated. But I’m just thinking out loud. :smiley:


#26

I think .99 cents would be the max I’d pay, maybe not even that, for your consideration. I’m sure other people would happily pay more.


#27

Thanks for the ideas.

I don’t think it’s really clear to have an overlap (Perform an action from the tag AND the app). I think it should either have:

  1. A payload which performs an action (like turn the lights on, disable the alarm), which can be called from anyone with the Hass NFC app installed and configured
  2. Call a script (like now), which can be run by anyone with Hass NFC installed and configured
  3. Call a specific stored function in Hass NFC which basically saves a payload in the app, but unlike the first option it’s securely saved in the app instead of the tag.

I do like the third option, but I’m not sure if it’s easy to write down a JSON payload for normal users… Unless I could make some dropdowns so you could add an action (turn on/off, toggle), and an entity which it should target.

Also thinking out loud here.


#28

In my thoughts that was an OR. I don’t know the internal of NFC, so I’m not sure if what I think is even possible. But in pseudo-code:

if known_tag + local_data_for_tag:
  execute local_data
  if execute_both:
    execute tag_data
elif known_tag:
  execute tag_data

So it’s just a matter of the app detecting if the tag is valid, and what happens next depends on how the app is configured. The data on the tag would be the fallback in case the app has no custom data for the specific tag.


#29

Ah I see. Not sure whether that’s the best way to go though. I’m not really in for an overlap of data on two parts.

But I think the biggest issue is that a NFC chip cannot hold much data. It can vary from something around 130 characters to something like 800+. So there’s not much room there in some cases.

But it should be possible, but I think it should be on the tag OR on the app. In your pseudo-code in the first if, there’s first the local data that’s executed, and after that it also executes the tag data. I think that can be confusing, and there are two places where you can store what happens.

Storing it in the app would be easier and safer (because everyone can read a tag), and you could store a lot more data.

Let me know if I understood you wrong.


#30

What I meant by that is that the app should have something like a dropdown where you can choose to either do what the tag says AND what you have locally (execute_both in my pseudo code), or just what you have locally. So three possible scenarios:

  1. The tag provides the action (tag only)
  2. The app provides the action and ignores the action from the tag (app only)
  3. The app provides the action and executes the action from the tag too (both)

This would allow you to store local actions which wouldn’t be limited by the capacity of the tags, but would also enable full control via tag if the app has no assigned actions. This would provide the most flexibility I guess.


#31

Thanks for clarifying. I see what you mean.

I’ll have to think what my next move is. I think I first have to change the way the data is stored on the tag right now. Have to somehow save what should happen. Would it be a big problem if the current tags would not work anymore and have to be rewritten? Would make my work easier, but maybe be a problem for users right now. Maybe I can work around it.

Basically I’m gonna save on the tag what should be done. Like "execute script: " or “turn_on: light.name” or something like that to make things as flexible as possible.

What would be the #1 improvement right now? I think directly turning on/off/toggling lights or whatever in Hass would be nice?

Storing a payload directly on the tag and/or app and combining commands can always be added later for sure.


#32

In my opinion it wouldn’t be a problem at all. HASS-users deal with breaking changes all the time. :smiley:
Another idea: it should be possible to import and export local data. That would make it easy to transfer exisiting actions to another device.


#33

Cool. Right now I’m planning to make a huge update. Hass works with domains (light or group for example) and services (turn on/turn off/toggle for example), and I want to make a dropdown for these, and an entity_id field you can enter. This way you can trigger any and all things in your Hass. I do want to make this a separate page for advances users, so you can keep using the simple script dropdown like now.

Importing and exporting sounds good. How/where would you want to export that? To a file on your device which you can move to another device and import there? What should be in it?


#34

I’ve just pushed Hass NFC 1.0.1 to the store. Changelog:

  • Added an advanced way to control Hass. Select a domain (light, script, etc) and a service (turn_on, turn_off, toggle, etc). You can control your entire Home Asisstant without the need of a script for every action. For complex/dynamic control over Hass a script is preferred. The entity_id field is a manual field, but will be a dropdown with all entities.

  • Please note that you HAVE to write your tags again! The way data is stored has changed which means the old data is not readable any more.

It’s a rather large update, so there’s always a chance a bug is present, so let me know if you find anything.

As said in the changelog, the ‘entity_id’ field (if the service has the field) is a manual input field for now. You have to enter ‘light.bedroom’ for example yourself. In a next release I want to show a dropdown (like with the old write page for a script) where you can select a specific entity.

The same goes for fields that have predefined values. I believe an example is the “turn_off” service for the domain “light”. A field here is something like flash yes/no. Since those are the only values, that should also be a dropdown.

Anyway, let me know what you think!


#35

Just released Hass NFC 1.0.2. Changelog:

  • Added a dropdown for entity_id field in the advanced write page
  • Added a dropdown for values if available

#36

Released 1.0.3:

  • It’s now possible to select an empty value for predefined values in dropdowns
  • Added full entity_id behind readable name in dropdown of entities

How are you guys liking the app so far with the advanced write option? Any major things you’d like to see next?


#37

I just discovered and purchased through the play store. This app is working great so far. Only problem I am having is that I can’t get it to work over https. It works fine over http. Any ideas?


#38

That’s weird. I am using https myself Are you sure you have a valid SSL certificate?


#39

They are self signed. I will try to regenerate them again to see if that fixes it. Otherwise the program works great. Thanks again!


#40

Self-signed certificates won’t pass SSL checks except when you add the root certificate to the trust-chain of your device.

@Gerben321
That’s the next feature request: add a toggle to disable SSL verification. :wink: