Crumpy10
(Simon)
July 19, 2021, 7:02am
1
Hello everyone,
Since updating to core-2021.7.3 I have had the titles error when I check configuration. I have managed to fix at least 3 other issues I had but this one has me stumped. I have checked the breaking changes and also the info for the binary sensors but cant figure it out. I am not a code guru or programmer so please be gentle, if some one could take a look and give me some hints or tips that would be great. Here is a snip of my config.yaml and the error when I try to reboot the server.
### Binary Sensor Setup ##############################
######################################################
binary_sensor:
#Arduino CT coil sensors for Sonoff 4 channel Pro's
- platform: mqtt
name: "Kitchen Lights"
device_class: "light"
state_topic: "arduino/channel1"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Family Lights"
device_class: "light"
state_topic: "arduino/channel2"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Dining Lights"
device_class: "light"
state_topic: "arduino/channel3"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Office Lights"
device_class: "light"
state_topic: "arduino/channel4"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Hall Lights"
device_class: "light"
state_topic: "arduino/channel5"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Georges Light"
device_class: "light"
state_topic: "arduino/channel6"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Frans LEDs"
device_class: "light"
state_topic: "arduino/channel7"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
Invalid config for [binary_sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 317).
Line 317 is
#Arduino CT coil sensors for Sonoff 4 channel Pro's
I just dont understand what may have changed as it all worked fine before the update.
Thanks
tom_l
July 19, 2021, 7:24am
2
The config you posted looks fine.
Are there any other errors, like the mqtt integration not being able to be set up?
What about when you go to the Configuration / Integrations page. Is the mqtt integration there?
Crumpy10
(Simon)
July 19, 2021, 7:38am
3
Hi Tom,
Yeah thats what I thought, I have been going round and round with checking indents etc.
yes my mosquito broker is set up and I have other MQTT switches and sensors etc that seem to be fine and I have just checked a sonoff pow thats on my water pump and thats reported stat back in the last 5 mins…
tom_l
July 19, 2021, 7:49am
4
I meant the integration not the broker but this precludes that being an issue:
What happens if you put a space after this comment marker #
#Arduino CT coil sensors for Sonoff 4 channel Pro's
Like so:
# Arduino CT coil sensors for Sonoff 4 channel Pro's
That shouldn’t be a problem. YAML syntax seems to be just fine according yamllint
:
stdin
4:1 warning missing document start "---" (document-start)
5:2 warning missing starting space in comment (comments)
5:1 warning comment not indented like content (comments-indentation)
55:1 error trailing spaces (trailing-spaces)
None of these should affect the parser.
I think the line numbers in error messages are off by one, i.e. the first line of the file would be line 0.
1 Like
koying
(Chris B)
July 19, 2021, 7:55am
7
Maybe comments are not permitted there anymore.
I assume it works if you just remove the comment?
Crumpy10
(Simon)
July 19, 2021, 7:56am
8
Ah man, I hope not I have comments all over the rest of the config…
The YAML seems to parse just fine:
Parsing YAML with python
$ python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
+ >>> import yaml
+ >>> from pprint import pprint
+ >>> test = """
+ ... ### Binary Sensor Setup ##############################
+ ... ######################################################
+ ...
+ ... binary_sensor:
+ ... #Arduino CT coil sensors for Sonoff 4 channel Pro's
+ ... - platform: mqtt
+ ... name: "Kitchen Lights"
+ ... device_class: "light"
+ ... state_topic: "arduino/channel1"
+ ... payload_available: "Online"
+ ... payload_not_available: "Offline"
+ ... qos: 1
+ ... - platform: mqtt
+ ... name: "Family Lights"
+ ... device_class: "light"
+ ... state_topic: "arduino/channel2"
+ ... payload_available: "Online"
+ ... payload_not_available: "Offline"
+ ... qos: 1
+ ... - platform: mqtt
+ ... name: "Dining Lights"
+ ... device_class: "light"
+ ... state_topic: "arduino/channel3"
+ ... payload_available: "Online"
+ ... payload_not_available: "Offline"
+ ... qos: 1
+ ... - platform: mqtt
+ ... name: "Office Lights"
+ ... device_class: "light"
+ ... state_topic: "arduino/channel4"
+ ... payload_available: "Online"
+ ... payload_not_available: "Offline"
+ ... qos: 1
+ ... - platform: mqtt
+ ... name: "Hall Lights"
+ ... device_class: "light"
+ ... state_topic: "arduino/channel5"
+ ... payload_available: "Online"
+ ... payload_not_available: "Offline"
+ ... qos: 1
+ ... - platform: mqtt
+ ... name: "Georges Light"
+ ... device_class: "light"
+ ... state_topic: "arduino/channel6"
+ ... payload_available: "Online"
+ ... payload_not_available: "Offline"
+ ... qos: 1
+ ... - platform: mqtt
+ ... name: "Frans LEDs"
+ ... device_class: "light"
+ ... state_topic: "arduino/channel7"
+ ... payload_available: "Online"
+ ... payload_not_available: "Offline"
+ ... qos: 1
+ ...
+ ... """
+ >>> pprint(yaml.safe_load(test))
{'binary_sensor': [{'device_class': 'light',
'name': 'Kitchen Lights',
'payload_available': 'Online',
'payload_not_available': 'Offline',
'platform': 'mqtt',
'qos': 1,
'state_topic': 'arduino/channel1'},
{'device_class': 'light',
'name': 'Family Lights',
'payload_available': 'Online',
'payload_not_available': 'Offline',
'platform': 'mqtt',
'qos': 1,
'state_topic': 'arduino/channel2'},
{'device_class': 'light',
'name': 'Dining Lights',
'payload_available': 'Online',
'payload_not_available': 'Offline',
'platform': 'mqtt',
'qos': 1,
'state_topic': 'arduino/channel3'},
{'device_class': 'light',
'name': 'Office Lights',
'payload_available': 'Online',
'payload_not_available': 'Offline',
'platform': 'mqtt',
'qos': 1,
'state_topic': 'arduino/channel4'},
{'device_class': 'light',
'name': 'Hall Lights',
'payload_available': 'Online',
'payload_not_available': 'Offline',
'platform': 'mqtt',
'qos': 1,
'state_topic': 'arduino/channel5'},
{'device_class': 'light',
'name': 'Georges Light',
'payload_available': 'Online',
'payload_not_available': 'Offline',
'platform': 'mqtt',
'qos': 1,
'state_topic': 'arduino/channel6'},
{'device_class': 'light',
'name': 'Frans LEDs',
'payload_available': 'Online',
'payload_not_available': 'Offline',
'platform': 'mqtt',
'qos': 1,
'state_topic': 'arduino/channel7'}]}
+ >>>
koying
(Chris B)
July 19, 2021, 7:57am
10
Might be an indentation issue as well. Try indenting the comment.
Crumpy10
(Simon)
July 19, 2021, 8:11am
11
OK, so I have just taken a backup of my config then deleted that whole posted code. Then got an error for all my light configs, sensor config and binary sensor configs. Deleted them all and its fine but obviously I am missing a lot…
Heres a copy of most of my config.yaml missing anything sensitive at the top…
#############################
# Alexa actions integration #
#############################
input_text:
alexa_actionable_notification:
name: Alexa Actionable Notification Holder
max: 255
initial: '{"text": "This is a test of the alexa actions custom skill. Did it work?", "event": "actionable.skill.test"}'
###################################
# Mysensors gateway configuration #
###################################
mysensors:
gateways:
- device: '192.168.1.200'
persistence_file: '/config/mysensors3.json'
tcp_port: 5003
version: 2.3
retain: true
### Timers Setup ###############################################################
################################################################################
# Hallway Timer
timer:
hall_timer:
duration: '00:02:00'
# Arrowhead Alarm Setup ########################################################
################################################################################
#crowipmodule:
# host: 192.168.#####
# port: ####
# keepalive_interval: 60
# timeout: 20
# areas:
# 1:
# name: 'Home'
# #code: '####'
# outputs:
# 3:
# name: 'spare1'
# 4:
# name: 'spare2'
# zones:
# 1:
# name: 'Firearms'
# type: 'motion'
# 2:
# name: 'Hallway'
# type: 'motion'
# 3:
# name: 'Office'
# type: 'motion'
# 4:
# name: 'Smokes'
# type: 'smoke'
# 5:
# name: 'Master bed'
# type: 'motion'
# 6:
# name: 'Family room'
# type: 'motion'
### Booleans Setup ############################################
###############################################################
#Booleans for 2 way lighting
input_boolean:
2way_toggle1:
name: Kitchen Lights
initial: off
2way_toggle2:
name: Family Lights
initial: off
2way_toggle3:
name: Dining Lights
initial: off
2way_toggle4:
name: Office Lights
initial: off
2way_toggle5:
name: Hall Lights
initial: off
2way_toggle6:
name: Georges Light
initial: off
2way_toggle7:
name: Frans LEDs
initial: off
### Light Setup ###############################################
###############################################################
light:
#First 4 Channel Pro Sonoff for 2 way lighting
- platform: mqtt
name: "Kitchen lights"
state_topic: "stat/sonoff4chan_1/POWER1"
command_topic: "cmnd/sonoff4chan_1/POWER1"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: false
qos: 1
retain: true
- platform: mqtt
name: "Family Lights"
state_topic: "stat/sonoff4chan_1/POWER2"
command_topic: "cmnd/sonoff4chan_1/POWER2"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: false
qos: 1
retain: true
- platform: mqtt
name: "Dining Lights"
state_topic: "stat/sonoff4chan_1/POWER3"
command_topic: "cmnd/sonoff4chan_1/POWER3"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: false
qos: 1
retain: true
- platform: mqtt
name: "Office Lights"
state_topic: "stat/sonoff4chan_1/POWER4"
command_topic: "cmnd/sonoff4chan_1/POWER4"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: false
qos: 1
retain: true
#Second 4 Channel Pro Sonoff for 2 way lighting
- platform: mqtt
name: "Hall Lights"
state_topic: "stat/sonoff4chan_2/POWER1"
command_topic: "cmnd/sonoff4chan_2/POWER1"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: false
qos: 1
retain: true
- platform: mqtt
name: "Georges Light"
state_topic: "stat/sonoff4chan_2/POWER2"
command_topic: "cmnd/sonoff4chan_2/POWER2"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: false
qos: 1
retain: true
- platform: mqtt
name: "Frans LEDs"
state_topic: "stat/sonoff4chan_2/POWER3"
command_topic: "cmnd/sonoff4chan_2/POWER3"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: false
qos: 1
retain: true
#D1MiniPro Garage Door Switch
- platform: mqtt
name: "Garage Door"
state_topic: "stat/GarageDoor/POWER"
command_topic: "cmnd/GarageDoor/POWER"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
optimistic: false
qos: 1
retain: true
### Switches Setup ###################################
######################################################
switch:
# Top Water Pump Sonoff POW
- platform: mqtt
name: "Top Water Pump"
command_topic: "cmnd/Top_Water_Pump/power"
state_topic: "stat/Top_Water_Pump/POWER"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: true
# Georges Blanket Sonoff S26 Plug
- platform: mqtt
name: "Georges Blanket"
command_topic: "cmnd/Georges_Blanket/power"
state_topic: "stat/Georges_Blanket/POWER"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: true
# Masterbedroom Blanket Sonoff POW Plank
- platform: mqtt
name: "Master Blanket"
command_topic: "cmnd/Master_Blanket/power"
state_topic: "stat/Master_Blanket/POWER"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: true
### Binary Sensor Setup ##############################
######################################################
binary_sensor:
# Arduino CT coil sensors for Sonoff 4 channel Pro's
- platform: mqtt
name: "Kitchen Lights"
device_class: "light"
state_topic: "arduino/channel1"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Family Lights"
device_class: "light"
state_topic: "arduino/channel2"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Dining Lights"
device_class: "light"
state_topic: "arduino/channel3"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Office Lights"
device_class: "light"
state_topic: "arduino/channel4"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Hall Lights"
device_class: "light"
state_topic: "arduino/channel5"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Georges Light"
device_class: "light"
state_topic: "arduino/channel6"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
- platform: mqtt
name: "Frans LEDs"
device_class: "light"
state_topic: "arduino/channel7"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
#D1Mini PIR sensors
- platform: mqtt
name: "Hall PIR"
device_class: "motion"
state_topic: "stat/d1mini/pir1/POWER"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
### Sensor setup #################################
##################################################
################################
# Victron Solar Modbus Devices #
################################
- platform: modbus
- name: victron
type: tcp
host: 192.168.1.206
port: 502
sensors:
- name: Grid Power L1
hub: victron
unit_of_measurement: "W"
slave: 30
address: 2600
- name: Grid Voltage L1
hub: victron
unit_of_measurement: "Vac"
slave: 30
address: 2616
scale: 0.1
- name: Grid Current L1
hub: victron
unit_of_measurement: "A"
slave: 30
address: 2617
scale: 0.1
precision: 2
- name: Grid Power L2
hub: victron
unit_of_measurement: "W"
slave: 30
address: 2601
- name: Grid Voltage L2
hub: victron
unit_of_measurement: "Vac"
slave: 30
address: 2618
scale: 0.1
- name: Grid Current L2
hub: victron
unit_of_measurement: "A"
slave: 30
address: 2619
scale: 0.1
precision: 2
- name: Grid Power L3
hub: victron
unit_of_measurement: "W"
slave: 30
address: 2602
- name: Grid Voltage L3
hub: victron
unit_of_measurement: "Vac"
slave: 30
address: 2620
scale: 0.1
- name: Grid Current L3
hub: victron
unit_of_measurement: "A"
slave: 30
address: 2621
scale: 0.1
precision: 2
- name: Battery Charge
hub: victron
unit_of_measurement: "%"
slave: 100
address: 843
precision: 1
- name: Inverter Power Output
hub: victron
unit_of_measurement: "W"
slave: 20
address: 1029
sensor:
# Alarm sensor setup
- platform: template
sensors:
home_power:
device_class: power
friendly_name: "home power"
value_template: "{{ is_state_attr('sensor.crow_alarm_system', 'mains', True) }}"
# Top Water Pump
- platform: mqtt
name: Top Water Pump Current
state_topic: "tele/Top_Water_Pump/SENSOR"
value_template: "{{value_json['ENERGY'].Current }}"
unit_of_measurement: 'amps'
- platform: mqtt
name: Top Water Pump Power
state_topic: "tele/Top_Water_Pump/SENSOR"
value_template: "{{value_json['ENERGY'].Power }}"
unit_of_measurement: 'watts'
- platform: mqtt
name: Top Water Pump Voltage
state_topic: "tele/Top_Water_Pump/SENSOR"
value_template: "{{value_json['ENERGY'].Voltage }}"
unit_of_measurement: 'volts'
# Hot Water Temperature Sensors
- platform: mqtt
name: Cylinder Top
state_topic: "tele/Hot_Water_Temp/SENSOR"
unit_of_measurement: '°C'
value_template: "{{ value_json['DS18B20-1'].Temperature }}"
- platform: mqtt
name: Cylinder Bottom
state_topic: "tele/Hot_Water_Temp/SENSOR"
unit_of_measurement: '°C'
value_template: "{{ value_json['DS18B20-2'].Temperature }}"
- platform: mqtt
name: Solar Collector
state_topic: "tele/Hot_Water_Temp/SENSOR"
unit_of_measurement: '°C'
value_template: "{{ value_json['DS18B20-3'].Temperature }}"
If I delete the following sections it checks out ok and I can reboot. Light Setup, Binary Sensor Setup and Sensor Setup.
koying
(Chris B)
July 19, 2021, 8:38am
12
Seems to correlate with comments indentation.
Although proper YAML, I assume a comment in col 0 is (now?) considered as a new section, which would make, e.g., light
as a section of its own, without platforms.
Try, e.g.,
light:
#First 4 Channel Pro Sonoff for 2 way lighting
- platform: mqtt
name: "Kitchen lights"
and same with the other.
Crumpy10
(Simon)
July 19, 2021, 9:36am
13
No, that did not make any difference either. Also tried putting the comment before light:
I have put all my code back now and the first error it pulls is line 235 which is back to the binary sensor error first.
Joerg
July 19, 2021, 10:35am
14
Did you save the file as UTF-8 or ASCII?
did you run on tasmota? what version?
Crumpy10
(Simon)
July 19, 2021, 8:14pm
16
I am sorry I dont understand where I would do this. I created the config file over time directly in HA file editor.
Crumpy10
(Simon)
July 19, 2021, 8:16pm
17
Hi, Not sure why you are asking this as its the config file in HA itself that I have problems with. If your asking about the sensor that sends the MQTT messages to HA then I built it myself on an Arduino and it has custom code on it.
123
(Taras)
July 19, 2021, 8:26pm
18
I believe it’s due to how your Modbus integration is configured. It has changed significantly and now all Modbus devices are configured under the modbus
domain.
You are still using the old way where a Modbus binary_sensor is defined in the binary_sensor
domain and its platform
is set to modbus
. Home Assistant can’t process that so it skips all binary_sensor configurations.
Crumpy10
(Simon)
July 19, 2021, 8:28pm
19
Hi, Yes I noticed a lot had changed. I will take another look at it and get back.
123
(Taras)
July 19, 2021, 8:34pm
21
Start with the example in this section Configuring platform binary sensor .
# Example configuration.yaml entry for binary_sensor configuration
modbus:
- name: hub1
type: tcp
host: IP_ADDRESS
port: 502
binary_sensors:
- name: "binary_sensor1"
address: 100
scan_interval: 20
slave: 1
- name: "binary_ensor2"
address: 110
device_class: door
input_type: discrete_input