Otisburgh_its

Untitled

Jun 25th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.10 KB | None | 0 0
  1. esphome:
  2.   name: car_bmw
  3.   platform: ESP8266
  4.   board: d1_mini
  5.  
  6. wifi:
  7.   ssid: "MySSSID"
  8.   password: "0123456789"
  9.   fast_connect: true
  10.   use_address: 172.16.68.121
  11.   reboot_timeout: 0s
  12.  
  13.   manual_ip:
  14.     static_ip: 172.16.68.121
  15.     gateway: 172.16.68.1
  16.     subnet: 255.255.255.0
  17.  
  18. mqtt:
  19.   discovery: true
  20.   discovery_prefix: homeassistant
  21.   client_id: home-assistant-esphome-bmw
  22.   broker: 172.16.68.62
  23.   username: mqtt
  24.   password: mqttpassword
  25.   reboot_timeout: 0s
  26.    
  27. logger:
  28. ota:
  29.   password: 'pass'
  30.  
  31. binary_sensor:
  32.   - platform: status
  33.     name: "Garage Opened BMW"
  34.     id: garage_opened_bmw
  35.  
  36. sensor:
  37.   - platform: template
  38.     name: "BMW"
  39.     lambda: |-
  40.    
  41.       static int num_cycles = 0;
  42.       static int prev_count = 0;
  43.       int retVal;
  44.       num_cycles += 1;
  45.       bool ha_responded = (id(garage_opened_bmw).state); // Home Assistant set binary_sensor ON
  46.       if (ha_responded) {
  47.         retVal = prev_count;
  48.       }
  49.       else
  50.       {
  51.         retVal = num_cycles;
  52.         prev_count = num_cycles;
  53.       }
  54.       return retVal;
  55.    
  56.     update_interval: 1000ms
Add Comment
Please, Sign In to add comment