ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
fujitsu_general.h
Go to the documentation of this file.
1#pragma once
2
3#include "esphome/core/log.h"
7
9
10constexpr uint8_t FUJITSU_GENERAL_TEMP_MIN = 16; // Celsius // TODO 16 for heating, 18 for cooling, unsupported in ESPH
11constexpr uint8_t FUJITSU_GENERAL_TEMP_MAX = 30; // Celsius
12
13// clang-format off
49// clang-format on
50
51// Bits are reversed within each byte, so an odd nibble index is the low half of its byte.
52constexpr uint8_t get_nibble(const uint8_t *message, uint8_t nibble) {
53 return (message[nibble / 2] >> ((nibble % 2) ? 0 : 4)) & 0b00001111;
54}
55
57constexpr void set_nibble(uint8_t *message, uint8_t nibble, uint8_t value) {
58 message[nibble / 2] |= (value & 0b00001111) << ((nibble % 2) ? 0 : 4);
59}
60
61// Nibble indices of the state frame fields.
63constexpr uint8_t FUJITSU_GENERAL_POWER_ON_NIBBLE = 17;
64constexpr uint8_t FUJITSU_GENERAL_MODE_NIBBLE = 19;
65constexpr uint8_t FUJITSU_GENERAL_SWING_NIBBLE = 20;
66constexpr uint8_t FUJITSU_GENERAL_FAN_NIBBLE = 21;
67
69climate::ClimateMode decode_mode(uint8_t mode_field, climate::ClimateMode current_mode);
70
72optional<climate::ClimateFanMode> decode_fan_mode(uint8_t fan_field, optional<climate::ClimateFanMode> current_mode);
73
75
77 public:
84
85 protected:
87 void transmit_state() override;
89 void transmit_off_();
90
92 bool on_receive(remote_base::RemoteReceiveData data) override;
93
95 void transmit_(uint8_t const *message, uint8_t length);
96
98 uint8_t checksum_state_(uint8_t const *message);
99
101 uint8_t checksum_util_(uint8_t const *message);
102
103 // true if currently on - fujitsus transmit an on flag on when the remote moves from off to on
104 bool power_{false};
105};
106
107} // namespace esphome::fujitsu_general
ClimateIR(float minimum_temperature, float maximum_temperature, float temperature_step=1.0f, bool supports_dry=false, bool supports_fan_only=false, climate::ClimateFanModeMask fan_modes=climate::ClimateFanModeMask(), climate::ClimateSwingModeMask swing_modes=climate::ClimateSwingModeMask(), climate::ClimatePresetMask presets=climate::ClimatePresetMask())
Definition climate_ir.h:25
uint8_t checksum_state_(uint8_t const *message)
Calculate checksum for a state message.
void transmit_state() override
Transmit via IR the state of this climate controller.
uint8_t checksum_util_(uint8_t const *message)
Calculate cecksum for a util message.
bool on_receive(remote_base::RemoteReceiveData data) override
Parse incoming message.
void transmit_off_()
Transmit via IR power off command.
void transmit_(uint8_t const *message, uint8_t length)
Transmit message as IR pulses.
const LogString * message
Definition component.cpp:35
ClimateSwingMode
Enum for all modes a climate swing can be in NOTE: If adding values, update ClimateSwingModeMask in c...
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_HORIZONTAL
The fan mode is set to Horizontal.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ CLIMATE_SWING_BOTH
The fan mode is set to Both.
ClimateMode
Enum for all modes a climate device can be in.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_QUIET
The fan mode is set to Quiet.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
optional< climate::ClimateFanMode > decode_fan_mode(uint8_t fan_field, optional< climate::ClimateFanMode > current_mode)
Unassigned values keep the current fan mode.
constexpr uint8_t FUJITSU_GENERAL_POWER_ON_NIBBLE
constexpr uint8_t get_nibble(const uint8_t *message, uint8_t nibble)
constexpr uint8_t FUJITSU_GENERAL_TEMPERATURE_NIBBLE
climate::ClimateSwingMode decode_swing_mode(uint8_t swing_field)
constexpr uint8_t FUJITSU_GENERAL_TEMP_MIN
constexpr uint8_t FUJITSU_GENERAL_SWING_NIBBLE
constexpr uint8_t FUJITSU_GENERAL_MODE_NIBBLE
climate::ClimateMode decode_mode(uint8_t mode_field, climate::ClimateMode current_mode)
Unassigned values keep the current mode, except that OFF becomes HEAT_COOL.
constexpr uint8_t FUJITSU_GENERAL_FAN_NIBBLE
constexpr void set_nibble(uint8_t *message, uint8_t nibble, uint8_t value)
Write a nibble into a zero-initialised frame.
constexpr uint8_t FUJITSU_GENERAL_TEMP_MAX