substitutions: device_name: cabin-tech friendly_name: "Hytte teknisk" esphome: name: ${device_name} friendly_name: ${friendly_name} esp32: board: esp32dev framework: type: arduino logger: api: encryption: key: !secret api_key ota: - platform: esphome password: !secret ota_password wifi: ssid: !secret wifi_ssid password: !secret wifi_password mqtt: broker: !secret mqtt_broker port: 1883 username: !secret mqtt_username password: !secret mqtt_password topic_prefix: hytte # ── BLE ────────────────────────────────────────────────────────────────────── esp32_ble_tracker: scan_parameters: active: false # passive scanning — don't connect, just listen # Victron MPPT (SmartSolar) — reads BLE advertisements # Get the encryption key from Victron Connect app: # Settings → Product info → Encryption key victron_ble: - id: victron_mppt mac_address: !secret victron_mac bindkey: !secret victron_bindkey sensor: - platform: victron_ble victron_ble_id: victron_mppt battery_voltage: name: "Batteri spenning" id: batt_voltage on_value: then: - mqtt.publish: topic: hytte/sensor/batt_mv payload: !lambda 'return to_string((int)(x * 1000));' battery_current: name: "Batteri strøm" pv_power: name: "Solcelle effekt" load_power: name: "Last effekt" charging_mode: name: "Lademodus" # JBD/JBD BMS — active BLE client connection # External component: https://github.com/syssi/esphome-jbd-bms external_components: - source: github://syssi/esphome-jbd-bms@main refresh: 0d ble_client: - mac_address: !secret jbd_mac id: jbd_ble_client jbd_bms: - ble_client_id: jbd_ble_client id: jbd update_interval: 60s sensor: - platform: jbd_bms jbd_bms_id: jbd state_of_charge: name: "Batteri SOC" id: batt_soc on_value: then: - mqtt.publish: topic: hytte/sensor/batt_pct payload: !lambda 'return to_string((int)x);' total_voltage: name: "Total spenning" current: name: "Strøm" power: name: "Effekt" temperature_1: name: "BMS temperatur" # ── Temperatur ──────────────────────────────────────────────────────────────── # DS18B20 one-wire — juster pin etter installasjon one_wire: - platform: gpio pin: GPIO4 sensor: - platform: dallas_temp name: "Inne temperatur" id: temp_in address: !secret ds18b20_indoor_addr update_interval: 60s on_value: then: - mqtt.publish: topic: hytte/sensor/temp_inne payload: !lambda 'return to_string(x);' - platform: dallas_temp name: "Ute temperatur" id: temp_out address: !secret ds18b20_outdoor_addr update_interval: 60s on_value: then: - mqtt.publish: topic: hytte/sensor/temp_ute payload: !lambda 'return to_string(x);' # ── Bryterkanaler (styres via LoRa-kommandoer) ─────────────────────────────── switch: - platform: gpio name: "Varme" id: switch_varme pin: GPIO16 # juster pin etter installasjon restore_mode: RESTORE_DEFAULT_OFF - platform: gpio name: "Varmtvannsbereder" id: switch_vvb pin: GPIO17 # juster pin etter installasjon restore_mode: RESTORE_DEFAULT_OFF # Lytter på kommandoer fra cabin_node (publisert til lokal MQTT) # HA hjemme → MQTT på alu → LoRa → cabin_node → lokal MQTT → her mqtt: on_message: - topic: hytte/cmd/varme then: - if: condition: lambda: 'return x == "ON";' then: - switch.turn_on: switch_varme else: - switch.turn_off: switch_varme - topic: hytte/cmd/vvb then: - if: condition: lambda: 'return x == "ON";' then: - switch.turn_on: switch_vvb else: - switch.turn_off: switch_vvb