Time sensor

Hi

I am new in Home Assistant and have some difficulties. I am not able to have clock working on lovelace. In the log the time sensor seems to be not starting. Bug somewhere or my mistakes?
When I follow the youtube instruction about setting a clock on the lovelace I can’t have these time sensors.

I only have one sensor.date_and_time and that gives all the time status “unknown”.

Is this because of Ubuntu / Oracle Virtualbox? Or how come?
My system

System Health

version core-2022.4.4
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.108
arch x86_64
timezone Europe/Helsinki
Home Assistant Cloud
Home Assistant Supervisor
Dashboards
configuration.yaml
automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml

logger:
default: info

default_config:

sensor:

platform: time_date
display_options:
    'time'
    'date'
    'date_time'
    'date_time_utc'
    'date_time_iso'
    'time_date'
    'time_utc'
    'beat'

sensor:

platform: nordpool
VAT: False
currency: "EUR"
low_price_cutoff: 0.95
region: "FI"
precision: 2
price_type: MWh
additional_costs: "{{0.0|float}}"
sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_utc'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'
      - 'beat'

Note the missing dashes in your config.

Just saw your deleted post. This may help:

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

Sorry here the config.yaml copied correctly

‘’’
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

logger:
default: info

default_config:

Example configuration.yaml entry

sensor:

  • platform: time_date
    display_options:
    • ‘time’
    • ‘date’
    • ‘date_time’
    • ‘date_time_utc’
    • ‘date_time_iso’
    • ‘time_date’
    • ‘time_utc’
    • ‘beat’

sensor:

  • platform: nordpool
    VAT: False
    currency: “EUR”
    low_price_cutoff: 0.95
    region: “FI”
    precision: 2
    price_type: MWh
    additional_costs: “{{0.0|float}}”
    ‘’’

Ha, nope. Try again. Three backticks on their won lines like this:

```

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'

```

Sorry here the config.yaml copied correctly

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

logger:
  default: info

default_config:

# Example configuration.yaml entry
sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_utc'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'
      - 'beat'
      
sensor:
  - platform: nordpool
    VAT: False
    currency: "EUR"
    low_price_cutoff: 0.95
    region: "FI"
    precision: 2
    price_type: MWh
    additional_costs: "{{0.0|float}}"
1 Like

You should have only one sensor: line in your configuration.yaml with all sensors listed under it, like this:

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_utc'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'
      - 'beat'

  - platform: nordpool
    VAT: False
    currency: "EUR"
    low_price_cutoff: 0.95
    region: "FI"
    precision: 2
    price_type: MWh
    additional_costs: "{{0.0|float}}"

Another option is to keep your sensors together in a seperate file to declutter your configuration.yaml file.

configuration.yaml file

sensor: !include sensors.yaml

sensors.yaml file (note, no sensor: line)

- platform: time_date
  display_options:
    - 'time'
    - 'date'
    - 'date_time'
    - 'date_time_utc'
    - 'date_time_iso'
    - 'time_date'
    - 'time_utc'
    - 'beat'

- platform: nordpool
  VAT: False
  currency: "EUR"
  low_price_cutoff: 0.95
  region: "FI"
  precision: 2
  price_type: MWh
  additional_costs: "{{0.0|float}}"
1 Like

Thanks! :slight_smile:

No probs. Just updated my post with some extra info.

Wow. Sounds reasonable.