Skip to content

Commit

Permalink
command_line changes in 2023.6 #93 #102
Browse files Browse the repository at this point in the history
  • Loading branch information
BeardedTinker committed Jun 9, 2023
1 parent 88dc28f commit ed1afda
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 81 deletions.
2 changes: 1 addition & 1 deletion custom_components/anniversary/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Upcoming anniversary",
"documentation": "https://github.com/amaximus/anniversary",
"issue_tracker": "https://github.com/amaximus/anniversary/issues",
"version": "0.2.2",
"version": "0.3.0",
"dependencies": [],
"codeowners": ["@amaximus"],
"iot_class": "calculated",
Expand Down
5 changes: 1 addition & 4 deletions custom_components/anniversary/sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
import json
import logging
import re
Expand Down Expand Up @@ -68,8 +67,7 @@ def _get_anniversary_date(self, i, year):

return mydate_p

@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
name = config.get(CONF_NAME)
anniversaries = config.get(CONF_ANNIVERSARIES)
date_format = config.get(CONF_DATE_FORMAT)
Expand Down Expand Up @@ -167,7 +165,6 @@ def extra_state_attributes(self):

return attr

@asyncio.coroutine
async def async_update(self):
first_anni = 367
today = datetime.today().strftime(self._date_format)
Expand Down
1 change: 0 additions & 1 deletion custom_components/local_luftdaten/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
})


@asyncio.coroutine
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Luftdaten sensor."""
name = config.get(CONF_NAME)
Expand Down
12 changes: 0 additions & 12 deletions entities/binary_sensors/mqtt_status.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions entities/command_line/binary_sensors/mqtt_status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#####
# Checks if MQTT is open or closed
# If port is closed this is trouble for all services that work with MQTT
#####

binary_sensor:
# platform: command_line
name: MQTT status
unique_id: 44b85908-2738-4b54-8ded-fb6314c06c5b
command: /bin/bash -c "(echo > /dev/tcp/192.168.1.35/1883) > /dev/null 2>&1 && echo open || echo closed"
payload_off: "closed"
payload_on: "open"
scan_interval: 300
device_class: 'problem'
9 changes: 9 additions & 0 deletions entities/command_line/sensors/count_lines.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#####
# Counter that tracks total number of lines in YAML
#
#####

sensor:
# platform: command_line
name: "Number of Lines of Code (YAML)"
command: " find /config/ -name '*.yaml' | xargs cat | wc -l"
10 changes: 10 additions & 0 deletions entities/command_line/sensors/storagenode_status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#####
# This sensor checks if Storagenode from Storj is responding
# to HTTP request on port
#####

sensor:
# platform: command_line
command: curl -I http://192.168.1.35:14002/ 2>/dev/null | head -n 1 | cut -d$' ' -f2
name: Storj Node status
scan_interval: 300
16 changes: 16 additions & 0 deletions entities/command_line/sensors/version_supervisor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#####
# Sensor that checks if there are updates available for Supervisor or Add-On's
# https://community.home-assistant.io/t/update-notifications-core-hacs-supervisor-and-addons/182295
#####

sensor:
#platform: command_line
name: Supervisor updates
command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
value_template: "{{ value_json.addons | length }}"
unit_of_measurement: pending update(s)
json_attributes:
- update_available
- newest_version
- current_version
- addons
16 changes: 16 additions & 0 deletions entities/command_line/switches/switchbot_humidifier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#####
# SwitchBot Humidifier - Switch
# Creates switch for ON/OFF functionality
#
# There is option to use this to pull state
# but haven't implemented thatyet
#####

switch:
name: Swotchbot Humidifier
unique_id: 6c2228fb-d4bd-43ff-80e8-e7f496bd4691
value_template: "{{ states('binary_sensor.switchbot_humidifier_power') }}"
command_on: !secret sbot_hum_on
command_off: !secret sbot_hum_off
# command_state: !secret sbot_hum_state
# friendly_name: Humidifier
8 changes: 0 additions & 8 deletions entities/sensors/system/count_lines.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions entities/sensors/system/ikea_ota.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions entities/sensors/system/storagenode_status.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions entities/sensors/system/version_supervisor.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions entities/switches/switchbot_humidifier.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions integrations/command_line.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#####
# Command Line was changed in 2023.6
#
# This loads up my binary_sensors, sensors and switches from
# command_line integration
#
# https://www.home-assistant.io/integrations/command_line/
#####

command_line: !include_dir_merge_list ../entities/command_line

0 comments on commit ed1afda

Please sign in to comment.