Help with a macro

Dm114

Well-known member
No, it does not need anything once it reconnects, since the app is running in the background it will still run, and as far as when I go outside the range, there is no change in the sound (the program does not change), so it does not need to run again. The macro would only need to run once as soon as the device is powered up, and the only other time that I would need to change anything would be on Sunday between 0930-1200 while at church, I need to different program running, which is what I have the second macro for, but you are suggesting that I could combine the second one into the first one, and I am fine in doing that as long as I can have it run, and then change back to the other program after noon.
I think everything is clear now 😉
 
OK, so how do I tell the macro to only run one time a day? I have been looking through all the settings and can't figure out which one I would need to add. Also, could you provide me steps for adding in my second macro with the first one? Thanks!
 

hsurB

Well-known member
OK, so how do I tell the macro to only run one time a day? I have been looking through all the settings and can't figure out which one I would need to add. Also, could you provide me steps for adding in my second macro with the first one? Thanks!

You use variables to run macro once/day. Set variable (boolean) to true. And you reset variable back to false for exemple at midnight.
Using constraint variable = true will make macro run only once a day.
It all can be obviously made in one macro using if clauses trigger fired
 
You use variables to run macro once/day. Set variable (boolean) to true. And you reset variable back to false for exemple at midnight.
Using constraint variable = true will make macro run only once a day.
It all can be obviously made in one macro using if clauses trigger fired
OK, where do I find them, and where do I put it? Sorry, I am completely new to this whole thing
 

mapriex

Active member
OK, so how do I tell the macro to only run one time a day? I have been looking through all the settings and can't figure out which one I would need to add. Also, could you provide me steps for adding in my second macro with the first one? Thanks!
beside the method @hsurB suggested, there are these time related options:

it depends how you need the action.
 

Attachments

  • Screenshot_20240120-090136.png
    Screenshot_20240120-090136.png
    188.9 KB · Views: 6
Thanks! I put a time constraint of 0600-1000, that way it should not trigger after that time, correct? I only went with those times due to my routine not being set where I am up and have the hearing aid turned on at a specific time, but it almost always is before 1000.
 

dhj49er

Well-known member
Sorry for the delay in responding.

Are you still using the first macro - hearing aid on?

The easiest way to get that to run only once is to use a Boolean variable, called say HAC as follows

T Hearing Aid Connected C HAC false
T Time 22:00

A your macro, change the if to
If Trigger fired Hearing Aid Connected
add set HAC true after the last ui click action
add else if action
Else if Trigger fired Time 22:00
Set HAC false

With the above changes the macro will only run once irrespective of the heating aids disconnecting and reconnecting throughout the day.

I have used a time of 22:00 to reset the variable. Select the time when you usually turn off the hearing aid.

Have you updated your second macro?

Do you need any help?

If so, please upload a screenshot of the macro and the issues you are having.
 
Sorry for the delay in responding.

Are you still using the first macro - hearing aid on?

The easiest way to get that to run only once is to use a Boolean variable, called say HAC as follows

T Hearing Aid Connected C HAC false
T Time 22:00

A your macro, change the if to
If Trigger fired Hearing Aid Connected
add set HAC true after the last ui click action
add else if action
Else if Trigger fired Time 22:00
Set HAC false

With the above changes the macro will only run once irrespective of the heating aids disconnecting and reconnecting throughout the day.

I have used a time of 22:00 to reset the variable. Select the time when you usually turn off the hearing aid.

Have you updated your second macro?

Do you need any help?

If so, please upload a screenshot of the macro and the issues you are having.
Screenshot_20240120-120400.pngScreenshot_20240120-120321.png
I am not understanding where and how to add the Boolean variable. On the second macro, I was at the church this morning, and it still ran, but it didn't at the same time, according to MD it ran when I got there it ran but, it did not switch the profile, so I am assuming that it triggered due to the Geofence, but the date/time prevented it from executing the rest of the macro.
 

dhj49er

Well-known member
The revised macro 1 should look like the attached screenshot.

The Boolean variable can be created either using set variable action g selecting new variable or directly in the variables tab or in the variables section in the macro.
 

Attachments

  • Screenshot_20240120-195343.png
    Screenshot_20240120-195343.png
    181.8 KB · Views: 4
The revised macro 1 should look like the attached screenshot.

The Boolean variable can be created either using set variable action g selecting new variable or directly in the variables tab or in the variables section in the macro.
OK, I must be doing something wrong. I can not find the Trigger Fired action. I am going to upload the macro itself, if possible, can you edit it with the changes you are suggesting?
 

Attachments

  • Hearing_aid_on.macro
    3.7 KB · Views: 1

dhj49er

Well-known member
I've changed the macro.

I've disabled the constraints - the macro will only run once when the hearing aid connects. You can enable the constraint if you always fit you hearing aids between 6am and 10am every day.
 

Attachments

  • Hearing_aid_on (1).macro
    7.7 KB · Views: 1

dhj49er

Well-known member
Thanks, here is #2, can it combined within the first one?
I've combined the 2 macros.

The combined macro is attached, along with an Action Block - this saves having copies of setting the hearing aid program actions.

I'm unable to test the macro, as I don't have Phonak app installed nor am I near to the areas you have defined for the geofence actions.

Geofence takes time to react to changes in location. I've included time based triggers if the geofence enter and exit triggers haven't already fired.

I find WiFi at a location, if available, is more reliable to use. If the church has WiFi I would use this either alone or with Geofence.

The macro should work as follows.

When you turn on your hearing aids & bluetooth connection to the phone is established and the phone screen is ON, then program 1 is set

Later you go to the church. Either geofence enter area or the time triggers and program 2 is set, providing the phone screen is ON.

On leaving the church. Either geofence exit area or the time triggers and program 1 is set, providing the phone screen is ON.

At 22:00, the variables are reset, ready for the next day.

I have assumed that this macro runs every day of the week. If you only want it to run on specific days of the week, enable the constraint and select the days required. I have set it to Sunday only.

The macro will not work if the screen is OFF when any of the triggers fire (except the last one) as the UI actions only work with the screen ON.

This means the phone screen will need to be on while travelling to the church, otherwise program 2 will not be set.

I think it might be better to let the triggers fire with the phone screen OFF and run the set program when the phone is turned ON after a trigger has fired.

First test the macro and let me know what you think.
 

Attachments

  • Hearing_aid_on_(combined).macro
    22 KB · Views: 3
  • Hearing_Aid_Set_Program.ablock
    4.7 KB · Views: 1
Last edited:
Thanks! For some reason, the macro did not run when I turned on my hearing aid this morning. I had the screen on. I went into MD and did test action on it, and it ran, but for some reason it did not trigger otherwise
 

dhj49er

Well-known member
Thanks! For some reason, the macro did not run when I turned on my hearing aid this morning. I had the screen on. I went into MD and did test action on it, and it ran, but for some reason it did not trigger otherwise
The reason it didn't run is that the variable HAC was set true in the macro I uploaded.
This needs to be false for the hearing aid connected trigger to work.

Tonight the variable will be set to false and tomorrow morning the trigger will work.
 
Last edited:

Dm114

Well-known member
The reason it didn't run is that the variable HAC was set true in the macro I uploaded.
This needs to be false for the hearing aid connected trigger to work.

Tonight the variable will be set to false and tomorrow morning the trigger will work.
...or force its value manually to False and retry the trigger at any time (unless there is a Time trigger)
 

dhj49er

Well-known member
...or force its value manually to False and retry the trigger at any time (unless there is a Time trigger)
He shouldn't change the variable after the macro has run, as the true state prevents the macro running again - as the OP requested.
 

Dm114

Well-known member
He shouldn't change the variable after the macro has run, as the true state prevents the macro running again - as the OP requested.
I haven't seen your macro but I suppose this boolean variable is set to False when hearing aid is NOT connected. It's the reason why I made this suggestion to set this variable accordingly to the connection.

If this variable reflects the BT state, wouldn't it be possible to test this state instead?

I don't want to interfere with your macro so if my suggestions are not useful, don't take them into account.
 
Top