Skip to content

Instantly share code, notes, and snippets.

@oki
Created April 22, 2021 08:21
Show Gist options
  • Save oki/70ede6a04a8e2e0309f0a7d6c7b0caf9 to your computer and use it in GitHub Desktop.
Save oki/70ede6a04a8e2e0309f0a7d6c7b0caf9 to your computer and use it in GitHub Desktop.
events_forwarder:
module: events_forwarder
class: EventsForwarder
entities:
# - binary_sensor.aqara_door_1_contact
# - binary_sensor.debug_contact
# - sensor.aqara_multi_outdoor_temperature
- sensor.day_night_custom
- sensor.zwift_online_1013655
- binary_sensor.aqara_water_rain_water_leak
- sensor.raingauge_tips
# - light.kotlownia
import appdaemon.plugins.hass.hassapi as hass
import requests
class EventsForwarder(hass.Hass):
def initialize(self):
self.log("Hello from AppDaemon Events forwarder")
self.log( self.args["entities"] )
for entity in self.args["entities"]:
self.listen_state(self.forward_event, entity)
def forward_event(self, entity, attribute, old, new, kwargs):
# self.log("Changed!!! [state]")
# self.log(entity)
# self.log(attribute)
# self.log(old)
# self.log(new)
if old != "unknown":
requests.post('http://000.000.00.00:0000/ha_events_slack_bot_this_is_only_fyi', json={"entity": entity})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment