ESPHome 2026.11.0b6
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// Stateless util commands the button platform sends; OFF is a util message too but changes the
14// climate state, so it stays with transmit_state() in the .cpp
15constexpr uint8_t FUJITSU_GENERAL_MESSAGE_TYPE_ECONOMY = 0x09;
18
19// clang-format off
55// clang-format on
56
57// Bits are reversed within each byte, so an odd nibble index is the low half of its byte.
58constexpr uint8_t get_nibble(const uint8_t *message, uint8_t nibble) {
59 return (message[nibble / 2] >> ((nibble % 2) ? 0 : 4)) & 0b00001111;
60}
61
63constexpr void set_nibble(uint8_t *message, uint8_t nibble, uint8_t value) {
64 message[nibble / 2] |= (value & 0b00001111) << ((nibble % 2) ? 0 : 4);
65}
66
67// Nibble indices of the state frame fields.
69constexpr uint8_t FUJITSU_GENERAL_POWER_ON_NIBBLE = 17;
70constexpr uint8_t FUJITSU_GENERAL_MODE_NIBBLE = 19;
71constexpr uint8_t FUJITSU_GENERAL_SWING_NIBBLE = 20;
72constexpr uint8_t FUJITSU_GENERAL_FAN_NIBBLE = 21;
73
75climate::ClimateMode decode_mode(uint8_t mode_field, climate::ClimateMode current_mode);
76
78optional<climate::ClimateFanMode> decode_fan_mode(uint8_t fan_field, optional<climate::ClimateFanMode> current_mode);
79
81
83 public:
90
92 void transmit_util(uint8_t command);
93
94 protected:
96 void transmit_state() override;
97
99 bool on_receive(remote_base::RemoteReceiveData data) override;
100
102 void transmit_(uint8_t const *message, uint8_t length);
103
105 uint8_t checksum_state_(uint8_t const *message);
106
108 uint8_t checksum_util_(uint8_t const *message);
109
110 // true if currently on - fujitsus transmit an on flag on when the remote moves from off to on
111 bool power_{false};
112};
113
114} // namespace esphome::fujitsu_general
void transmit_util(uint8_t command)
Transmit a util message that does not change the climate state (economy, vane steps)
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_(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_MESSAGE_TYPE_ECONOMY
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_MESSAGE_TYPE_NUDGE_VERTICAL
constexpr uint8_t FUJITSU_GENERAL_MESSAGE_TYPE_NUDGE_HORIZONTAL
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
uint32_t value
Definition hal.cpp:41