Where does notify.notify put files?

Then you should be seeing the warning in the log if you are successfully creating the file notify integration. Where are you putting this?

Configuration.yaml

I restart Home Assistant, and the only notify entity is notify.notify

I know I have six months before I have to do this, but I like to try to stay ahead of breaking changes.

Besides, if I finally grok, then I may be able to help others when the change is no longer optional.

I think that the only thing stopping me from using the notify.send_message service is making a file entity.

1 Like

:man_shrugging:

I’m out of ideas.

go to Devices-Services , click Entities , search for i.e " text "

Then also go to the File-Integration (Under Integrations) , check how many(if Any) “Entity” it says you have there ( And what you happend to “name” them )

I think you are confusing your self

And btw, you can delete the notify.notify , which is something you created, and it’s just confusing (as you said it gives you the warning)

PS: From now, use the File-Integration , Not Yaml, to configure a “file”

These files ( you find in the File-Integration ) you can check the state of in DEV-Tools#States

17.06.2024_10.15.50_REC

PS: If you want to know how many “notify-Services” you have, check DEV-Tools#Services ( Type “notify” …and scroll through :slight_smile:

Thank you! If there is a way to set the name in the UI, then that’s fine.

I thought someone said you couldn’t. That would force me to reconsider updating.

For the record, I personally find it easier to edit YAML than to use the UI, but I understand some find that more challenging. So I get why things are being moved. Just please don’t completely remove functionality!

I said you can’t when creating the entity.

2 Likes

I grok. Finally.

All of the replies here did contribute to the final realization (that I missed step 1).

Yes, but not deliberately.

My confusion began with “Your existing YAML configuration has been imported into the UI automatically”. I deleted this from my configuration.yaml:

notify:
  - name: notify
    platform: file
    timestamp: true
    filename: notify.txt

but, I could not resolve in my mind why there was still a notify.notify in developers tools → states.

Finally, after being told the third time to use the File integration, I got it. I created a new file entity, and everything that @tom_l and @boheme61 were telling me made sense.

This works in services:

service: notify.send_message
target:
  entity_id: notify.file
data:
  message: "This is a test"

Now, I can create whatever file entities I need in the file integration.
My only quibble is that I can’t control the name of the entity. Each additional file just adds to the _# confusion:
notify.file
notify.file_2
notify.file_3… etc.

But it works…

Thanks to all who got me here.

2 Likes

hehe. yeah, i was also very “confused” even after deleting in yalm, as i had a few automations, after about 5 days, i just deleted the damn “Warning” :joy:
Was thinking "wth i’ll notice what it kept referring to when old-legacy final “removed” :laughing:

Where can I find to which file the notifier is writing? Or change that file name? I see the [filename] in the config entry name, but that can be changed, and it still writes to the original filename (it’s just a part of the name of the config entry).

With the new file integration, you can neither see nor change the file (path) or the timestamp option.
Just have to delete the ‘entry’ and create a new one.

Grasshopper-

“When the student is ready, the teacher will appear”, Lao Tzu

I just learned most of this in the past two days of asking some really dumb questions, but now the student is the teacher.

Open the file integration
Click on “Add Entry”
Click on “Set up a notification Service”
Enter the file path. It can be any file path that Home Assistant can access. (For example, /config/temp.txt will be written to the file “temp.txt” in your configuration directory)
Optionally, select the timestamp option.

This makes an entity named notify.file:

They will all be named “notify.file” in the integration. But the second one will be “notify.file_2”. The third will be “notify.file_3”.

Now, to make a meaningful name, click on the “1 entity” below the File[/config/temp.txt] to open the Entities tab.
Now click on the entity, then on the cog icon.
From here, give it a friendly name that means more than notify.file_2.

Now, when you create a script or automation, for service, select notify.send_message, and when you click on “Choose Entity”, you will see the freindly names of your file entities:

Yes, but that is not the question.

I all found this and did exactly as you described. But now you did all this, where can you see/verify the filename that is written to?

You answers to “How do I configure the filename to write to?”

In your example the config entry name is

File [config/temp.txt]

But this is just the name. I tested with a dummy file name, but then I changed the name to the real filename, only to discover the old filename is still being used, and I only changed the name of the config entry. There is NO WAY (that I know of) to find (or change!) the filename that is written to.

Hence my question: Where can I find to which file the notifier is writing? (for verifying and/or changing purposes)

You create a file, where ever you want ( As usual “old style” ) FILE-Integration
Now in FILE-Integration UI, you can create a Sensor-File or a Notify-File
( pointing to a file of your choice ) Hint: the " File [/config/temp.txt] "

Your Dummy-file-name vs real filename And “old name”, doesn’t make alot of sense unless you show your “example”

So If you want to change the name of the file that is written to ( i.e the one by you created " temp.txt >to>dummy.txt " ) then you do it like you normally change a file name, in the filestructure, And your in UI created notify-file will not change

The Files created in the UI And the previous from config.yaml, you find in the Integration(UI), or under “Entities”

If you want a “new” notify-file or sensor-file, pointing to another temp2.txt or dummy2.txt, Yes then you have to create a “new” entry in the ( Now in the UI ) ( And ofcause new files to write to,when calling the Notify-SERVICE )

The sensor-file shows the state of the file ( Cording to the FILE-Integration, as previously “last entry” )

The Newly added feature/service Notify-File writes to the file of your choice

If you change any of these entity-names, then it’s those entity-names you have to CALL
Just like you if change a entity-name, i.e light.my_light >to> light.light_1, THEN you also have to change the name name in the i.e script/automation where you CALL this entity

So go to Devices-Services,Click i.e FILE-Integration, there you see the files belonging to this Integration
IF you by any chance i.e have Tibber-Integration, or Other Integration which Supports the Notify-Service, you will most likely also there find a i.e “notify.tibber” entity(which is cool btw)

Your Mobile-App(Integration) Support The Notify-Service

DEV-Tools: Services ,list notif

So what’s new in the UI-Version of FILE-Integration ( Beside it previous sensor-file ) Is the Notify-File

Take a look at my pics above And You’ll see where you find the file which are written to (the place you initially choosed, when you “wrote” the “PATH” in the UI (same as you had to write a PATH in Yaml)

OK, this is what I did (sorry for the lengthy post):

I collect utility values (electricity) hourly, and place them in a file. I have my configuration split up over several files. My legacy config (in config/notifiers/file.yaml) is:

 - name: utility_hourly
  platform: file
  filename: www/utility_hourly.csv

- name: utility_with_prices_hourly
  platform: file
  filename: www/utility_with_prices_hourly.csv

These logfiles are created:

  • config/www/utility_hourly.csv
  • config/www/utility_with_prices_hourly.csv

I did not yet change the automation. The action part is:

    service: notify.utility_with_prices_hourly
    data: 
      message: >
        {{ states('sensor.remote_date_time') }}, {{
        states('sensor.remote_energy_consumption_tarif_1') }}, {{
        states('sensor.remote_energy_consumption_tarif_2') }}, {{
        states('sensor.remote_energy_production_tarif_1') }}, {{
        states('sensor.remote_energy_production_tarif_2') }}, {{
        states('sensor.remote_gas_consumption') }}, {{
        states('sensor.remote_smartelec_current_marketprice') }}, {{
        states('sensor.remote_huidige_gas_marktprijs') }}

I wanted to test the new code by adding a new logfile:

image

which is confirmed:

image

resulting in:

Finally I changed the entity name to be more descriptive:

This didn’t change anything in the Integration Entries screen, so I changed that as well via the 3dot-menu=>rename:

image

Then i made a new automation with this action:

    service: notify.send_message
    target: 
      entity_id: notify.mytestfile
    data: 
      message: >
        {{ states('sensor.remote_date_time') }}, {{
        states('sensor.remote_energy_consumption_tarif_1') }}, {{
        states('sensor.remote_energy_consumption_tarif_2') }}, {{
        states('sensor.remote_energy_production_tarif_1') }}, {{
        states('sensor.remote_energy_production_tarif_2') }}, {{
        states('sensor.remote_gas_consumption') }}, {{
        states('sensor.remote_smartelec_current_marketprice') }}, {{
        states('sensor.remote_huidige_gas_marktprijs') }}

When I run this automation, the file config/www/mytestfile.csv is created and a log line is added to it.

Everything works as expected, so I want to move this config to production.

First I renamed the legacy notifiers to:

  • notify.utility_hourly0
  • notify.utility_with_prices_hourly0

Then I changed the new notifier:
Name from: mytestfile to: utility_hourly
Entity_id from: notify.mytestfile to: notify.utility_hourly

I also changed the config entry name:

image

And I disabled the legacy config by renaming the config file to config/notifiers/file.yaml0 and restarting Home Assistant.

Finally I changed the automation as well:

service: notify.send_message
target: 
  entity_id: notify.utility_with_prices_hourly
data: 
  message: >
    {{ states('sensor.remote_date_time') }}
    # rest of template truncated for readability 

When I run this automation, The log is still written to config/www/mytestfile.csv

  • I reloaded the yaml config, but this didn’t change the behavior
  • I restarted Home Assistant, but this didn’t change the behavior
  • I also removed config/www/mytestfile.csv, but running the automation just recreates the file.

I checked with the dev tools:

but here the file name that is written to is not visible/available.

I solved this (workaround) by creating a new notifier with the correct filename, but in a year or so I won’t remember the details of this config. As all changes are in names only, my question still is:

Where can I view/change the filename the notifier is writing to?

Another use case: If I want to add the timestamp, where can I enable that afterwards? I see this setting only when creating the notifier entry…

1 Like

Right, the xxx.csv will never be “visible” in any “entity” tables

Your light.my_light you can rename to what ever you will, it will still turn on/of the “light” which it’s associated with in it’s integration(Device_id_child) ( And you can’t change that )
( You can even “convert it” to a switch.my_light and rename it, It will still belong to the same(Device), not magically another (Device)

Sorry i can’t be of more help here

Good there is this “feature”, to ADD Entities pointing to relevant Files, just in case you wanted to change your xxx.csv location or wanted another xxx2.csv
( And maybe eventually the ability to change PATH )

I suggest you keep the file-PATH(NAME) in the Integration-admin, and settle with Friendly-Name, and don’t mess around to much in your system, set up a “structure” you fell comfortable with, and stick to it
Maybe eventually DEV’s come up with another idea of “telling you” where you placed the TEXT-Files you writes to, i doubt the will/can change the functionally of FILE-Sensor/FILE-Notify

1 Like

This forum is great! So many people willing to share, not only their trials and tribulations, but also what they’ve discovered along the way. Thank you!!!

But, and I’m sorry about this, I just have to comment again about how completely unnecessary this whole fiasco seems. I keep shaking my head and asking myself why?

1 Like

Indeed, i’ve been “confused” for days, and i really felt comfortable with the YAML-Mode, Now it feels like “Blinded on 1 eye, and left hand tight on the back” :joy:

However this is yet to “Be Discovered” Not sure how/when this will “take place”

Well, If things are NOT working, I always try to check everything. But in this case, I can’t.

Anyway: that’s the answer for now: “You can’t verify the filename/location”

Just out of curiosity, where/how did you “verify” that before ?

I used the legacy file notifier. The file path is in the yaml code