Time Stamp Class Sensor

pardon my ignorance. i’m unfamiliar with prayer time practices. that sensor returned midnight utc+0. which means it specified an absolute time (ie, same instant for the whole world simulteaneously).

  1. is that what is correct? or should it be stripped to current local timezone?
  2. when you did the number of minutes calculation, did you do it relative to your midnight? or relative to utc midnight? the code i gave should work only relative to utc midnight (which is what the sensor is saying).

It should be local time, actually. Thought that the trigger will use my location to provide prayer times…

So, the code you provided is for UTC only…

How to fix that?

make a template sensor that’s 90 minutes before.

in configuration.yaml

template:
- sensor:
  - name: Frajr Prayer Offset
    unique_id: Frajr Prayer Offset
    state: >
      {{ states('sensor.islamic_prayer_times_midnight_time') | as_datetime | as_local - timedelta(minutes=90) }}
    device_class: timestamp

Then your automation

description: ""
trigger:
  - platform: time
    at: sensor.fajr_prayer_offset
condition: []
action:
  - service: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id:
        - light.floor_lamp_socket_1
mode: single

Thank you. I think i need to correct the sensor name on your code so that both be the same, right?

Nope, as long as sensor.islamic_prayer_times_midnight_time is correct, the rest should work as I have it written.

1 Like

oh, blech… nvmd… i think the sensor is converting afterall …

My point is the islamic prayer integration provides 6 sensors including Fajr and Midnight. So should the sensor name mentioned in the template be same like the sensor mentioned in the yaml automation code?

yah, sensor does it all

1 Like

so i dunno why my version didn’t trigger for him… but :person_shrugging: i can figure it out when i get a min.

If you have 6 different times, you’ll need 6 different sensors with the 90 minute offset. So the name:, unique_id: and the input 'sensor.islamic_prayer_times_midnight_time' in the template will all need to change. Also, you’ll need to add 1 trigger for each time trigger.

Yes, that’s my point. I will work on it and let you know.

guys, i just had a catastrophy… I accidently overwritten the configuration.yaml file.

my system is not starting at all… I have home assistant yellow by the way

any help, please!!

This is off topic @moderators can you split this in a topic of its own?

@WestWorld : did you make backups, and did you setup samba or another means for remote access to files?

The latest backup there was is a partial one dates back to 3 days ago… i also have an active account on Nabucasa, if this can help.

The backup may contain the configuration.yaml if you can get at it. If not, you could start with a relatively empty version to get running and then add in the things you need. If you broke out most sections and did not delete any other yaml files the damage shouldn’t be that bad. Question remains, did you set up the samba addon or any other means to access the files? What did you normally use to edit and/or how did you delete your configuration.yaml in the first place?

i did not set up samba addon.
the issue happened after i used the file editor addon to add a template. I saved the file as configuration.yaml
i think this caused to overwrite the original configuraiton.yaml file

can you still access the editor using:
<insert your ip here>:8123/hassio/ingress/core_configurator

i am getting this error message:
homeassistant.local refused to connect.

In that case I’d probably attach a monitor and keyboard to the yellow and try to do a safe boot useing the command line interface, or try to create a small configuration.yaml file from there.

I think i have an old backup file on my pc. Wouldn’t this work?